software reverse engineering · 2020. 2. 11. · virtualbox virtualboxoption: bridged network...

23
ì Software Reverse Engineering COMP 293A | Spring 2020 | University of the Pacific | Jeff Shafer Behavioral Analysis – Networking Edition

Upload: others

Post on 31-Dec-2020

10 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

ìSoftware Reverse EngineeringCOMP 293A | Spring 2020 | University of the Pacific | Jeff Shafer

Behavioral Analysis –Networking Edition

Page 2: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

ì

Spring 2020Software Reverse Engineering

2

Malware

Page 3: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

Shamoon – August 2012

ì Cyber warfare against Saudi Aramco and Qatar RasGas

ì Capabilitiesì Dropper – Creates ‘NtsSrv’ for persistence. 32 and 64 bit versionsì Worm – Spreads computer-to-computer across networkì Locate targeted files, exfiltrates them, and then erases themì Overwrites the master boot record of system 😈ì “Logic bomb” – Data wiping payload scheduled to execute on all

systems on Aug 15 2012 at 11:08am – Right before Ramadan holiday to delay detection

ì Impactì 30,000 Windows computers overwritten at Saudi Aramco

(75% of enterprise systems)ì Weeks of downtime and system restoration fun for IT staff

Spring 2020Software Reverse Engineering

3

Page 4: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

Shamoon – Politically Motivated

Spring 2020Software Reverse Engineering

4

"We, behalf of an anti-oppression hacker group that have been fed up of crimes and atrocities taking place in various countries around the world, especially in the neighboring countries such as Syria, Bahrain, Yemen, Lebanon, Egypt and ..., and also of dual approach of the world community to these nations, want to hit the main supporters of these disasters by this action. One of the main supporters of this disasters is Al-Saud corrupt regime that sponsors such oppressive measures by using Muslims oil resources. Al-Saud is a partner in committing these crimes. It'shands are infected with the blood of innocent children and people. In the first step, an action was performed against Aramco company, as the largest financial source for Al-Saud regime. In this step, we penetrated a system of Aramco company by using the hacked systems in several countries and then sended a malicious virus to destroy thirty thousand computers networked in this company. The destruction operations began on Wednesday, Aug 15, 2012 at 11:08 AM (Local time in Saudi Arabia) and will be completed within a few hours."

Page 5: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

The Full Shamoon

Spring 2020Software Reverse Engineering

5

https://securityintelligence.com/the-full-shamoon-how-the-devastating-malware-was-inserted-into-networks/

Page 6: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

Shamoon

ì MD5 for 2012 variant (Shamoon 1.0):d214c717a357fe3a455610b197c390aa

ì https://www.virustotal.com/#/file/f9d94c5de86aa170384f1e2e71d95ec373536899cb7985633d3ecfdb67af0f72/

ì http://contagiodump.blogspot.com/2012/08/shamoon-or-disttracka-samples.html

Spring 2020Software Reverse Engineering

6

Page 7: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

ìNetworking

Spring 2020Software Reverse Engineering

7

Page 8: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

VMWare

VMWare Networking

Spring 2020Software Reverse Engineering

8

Windows VM Linux VM

Switch

NAT

Native Applications

Your Computer

Native Applications

Communication

Communication

Communication

Page 9: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

Spring 2020Software Reverse Engineering

9

Page 10: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

VirtualBox

VirtualBox Networking

Spring 2020Software Reverse Engineering

10

Windows VM Linux VM

Switch

NAT

Native Applications

Your Computer

Native Applications

No Communication

NAT

The isolation of VMs is an intentional design

feature

No Communication

Communication

Page 11: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

Spring 2020Software Reverse Engineering

11

“VirtualBox makes me sad…”

~ The Cat

Page 12: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

VirtualBox

VirtualBox Option: Bridged Network

Spring 2020Software Reverse Engineering

12

Windows VM Linux VM Native Applications

Your Computer

Native Applications

Communication

Communication

Switch Communication

Most common suggestion on Stack Overflow: Bridged mode

Page 13: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

VirtualBox Option: Bridged Network

ì Bridged = “As if you had 3 computers all plugged into the same network switch”

ì Prosì Everyone (VMs, host OS, even remote PCs) can communicateì No annoying NAT in the way

ì Consì All your VMs are directly on the network (e.g. PacificNet)

ì Isolation? Protection? Easier to make a mistakeì If you manually configure the IP address assignment – such as to force Windows to

use Linux as a default gateway – it will be very easy to accidentally pick an IP already in use by a classmate

ì Wireshark will capture more external noiseì Will need to reconfigure manual addresses each time you change physical network

(e.g. lab WiFi to home WiFi)ì Not all network administrators tolerate multiple hosts on same interface

Spring 2020Software Reverse Engineering

13

Page 14: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

VirtualBox Options

Spring 2020Software Reverse Engineering

14

VM ↔ Host VM ↔ VM VM -> Internet VM <- Internet

NAT Port Forwarding

Bridged

Host-Only

Internal

NAT Network

Port Forwarding

For REM labs, we don’t need VM ↔ Host or VM<-Internethttps://www.virtualbox.org/manual/ch06.html#networkingmodes

Page 15: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

VirtualBox

ì Oracle VM VirtualBox: Networking options and how-to manage themì https://blogs.oracle.com/scoter/networking-in-

virtualbox-v2

ì Manualì https://www.virtualbox.org/manual/ch06.html#net

workingmodes

Spring 2020Software Reverse Engineering

15

Page 16: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

ìNetworking Tools

Spring 2020Software Reverse Engineering

16

Page 17: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

Networking Tricks

ì We’re already configured our Windows VM (running malware) to use REMnux Linux VM as its default gateway and as its default DNS server

ì We could just forward to the public Internet, but that is an uncontrolled environment 😈

ì What can we do with the network traffic within our VM sandbox?ì Intercept and monitor all trafficì Tamper with DNSì Tamper with HTTPì Tamper with <any service>

Spring 2020Software Reverse Engineering

17

Page 18: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

accept-all-ips

ì Shell script that configures Linux network stack. OS will accept data to any IP address as-if it was its own

ì Purpose?ì Malware tries to communicate with <IP in

Russia> but is really communicating with REMnux

ì Usageì accept-all-ips startì accept-all-ips stop

Spring 2020Software Reverse Engineering

18

Page 19: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

httpd

ì Built-in Nginx webserver in REMnux

ì Purpose?ì Malware wants to communicate with a

webserver – let’s give it one and see what happens next

ì Usageì httpd start

ì httpd stop

Spring 2020Software Reverse Engineering

19

Page 20: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

fakedns

ì DNS emulator

ì Purpose?ì Malware wants to communicate with

suspect-domain.com

ì Instead of querying public DNS, just return <IP of REMnux> and have the malware communicate with Linux

ì Usageì fakedns (CTRL-C to exit)

Spring 2020Software Reverse Engineering

20

Page 21: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

inetsim

ì Internet Services Simulation Suiteì Simulates common network servicesì HTTP/HTTPS, SMTP, POP3, DNS, FTP, TFTP, NTP, IRC

ì Purpose?ì Malware sends HTTP to download malware.exe –

inetsim can respond with its own binary

ì Usageì inetsim (CTRL-C to exit)

Spring 2020Software Reverse Engineering

21

Page 22: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

wireshark

ì Network packet capture

ì Just a reminder that it’s preferrable to run Wireshark in Linux, as opposed to in the Windows VM running the malwareì Less noise produced in tools like Process

Monitorì One less tool for the malware executable to

detect and be suspicious of

ì Usageì wireshark

Spring 2020Software Reverse Engineering

22

Page 23: Software Reverse Engineering · 2020. 2. 11. · VirtualBox VirtualBoxOption: Bridged Network Software Reverse Engineering Spring 2020 12 Windows VM Linux VM Native Applications Your

Spring 2020Software Reverse Engineering

23

Lab 3Now you can proceed

to the networking section! J