Skip to content

Commit f1919a4

Browse files
author
RPISEC
committed
Initial commit
0 parents  commit f1919a4

File tree

65 files changed

+719
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+719
-0
lines changed

ACKNOWLEDGEMENTS

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ACKNOWLEDGMENTS / AUTHORS OF MALWARE ANALYSIS
2+
3+
Original Authors
4+
* Branden Clark
5+
* Austin Ralls
6+
* Aaron Sedlacek
7+
8+
Special thanks to
9+
* The RPI CS Department for giving us this opportunity and letting us run with it
10+
* Professor Bülent Yener for sponsoring such a course
11+
* Our students who put up with us all semester

Labs/Lab_01/Lab_01.pdf

59.4 KB
Binary file not shown.

Labs/Lab_01/Lab_01.zip

20.6 KB
Binary file not shown.

Labs/Lab_01/solution.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
#### Malware Analysis - Fall 2015
2+
#### Lab 01 Solution
3+
4+
##### Lab_01-1.malware
5+
6+
7+
1. 2009-05-14 10:12:41
8+
9+
2.
10+
a. ShellExecuteExA - Can be used to run applications
11+
12+
b. Socket APIs - Make network connections
13+
14+
c. File API - read/modify files
15+
16+
3.
17+
a. 60.248.52.95 - Potential network signature
18+
19+
b. http://www.ueopen.com/test.html - Potential network signature
20+
21+
c. cmd.exe - The malware could be trying to run shell commands
22+
23+
d. *(SY)# - Potential network signature, possible used for a remote shell prompt
24+
25+
4. Connects to 60.248.52.95, offers up a remote shell, then deletes itself
26+
27+
5. Process name. Ensures procmon data involves the sample
28+
29+
6. Nothing particular, except for the command it runs to delete itself
30+
31+
`cmd.exe /c del $PATH > null`
32+
33+
7.
34+
a. Connects to port 443 on 60.248.52.95
35+
36+
b. *(SY)# - Remote shell prompt
37+
38+
8. The file's self deletion was a nuisance. This can be overcome by keeping a separate
39+
copy, or by NOP'ing the delete call
40+
41+
9. To act as a backdoor by offering a remote shell to the attacker
42+
43+
##### Lab_01-2.malware
44+
45+
1. 02658bc9801f98dfdf167accf57f6a36
46+
47+
2.
48+
a. CreateProcessA - Execute applications
49+
50+
b. WriteFile - Write to files
51+
52+
c. HttpOpenRequestA - Access websites
53+
54+
3.
55+
a. wuauclt.exe - Windows update program, potential trojan or disguise
56+
57+
b. cmd /c - run shell commands
58+
59+
c. 69.25.50.10 - Potential network signature
60+
61+
4. Nothing appears on screen. In the background it is attempting to connect to
62+
69.25.50.10, but fails. If it succeeds it offers a remote shell.
63+
64+
5. Process name. Ensures procmon data involves the sample
65+
66+
6. Runs wuauclt.exe
67+
68+
7. Connects to 69.25.50.10. Remote pseudo-shell commands (putf, getf, /tasks/, exit)
69+
70+
8. No, though more information could have been made available if 69.25.50.10 was up
71+
72+
9. Acts as a backdoor, allowing remote file access and program execution.
73+
74+
##### Lab_01-3.malware
75+
76+
1. Yes, very few strings and imports. VirtualSize >> Size of Raw Data. Possibly UPX packed.
77+
78+
2. No, UPX reports an error, "file is modified/hacked/protected; take care!!!"
79+
80+
3.
81+
a. Mozilla/4.0 - Possible user agent
82+
83+
b. http://%s/%s/ - Format string for making URLs
84+
85+
c. www.practicalmalwareanalysis.com - Potential network signature
86+
87+
4. Connects to website "http://\<url from resources\>/\<base64 local hostname\>/"
88+
89+
5. No
90+
91+
6. The URL and user agent
92+
93+
7. The packing, I'm not sure what else the malware is doing besides connecting out.
94+
This program will have to be unpacked manually.
95+
96+
8. Besides reporting the hostname to the attacker, there's no way to tell without further
97+
analysis.
98+

Labs/Lab_02/Lab_02.pdf

54.9 KB
Binary file not shown.

Labs/Lab_02/Lab_02.zip

10.9 KB
Binary file not shown.

Labs/Lab_02/solution.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#### Malware Analysis - Fall 2015
2+
#### Lab 02 Solution
3+
4+
##### Lab_02-1.malware
5+
6+
7+
1.
8+
a. Main is at 0x004011A0
9+
10+
b. Main checks if there is internet connection, using http://reversing.rocks/ as a domain to check. If the test passes it runs a subroutine, otherwise it exits right away.
11+
12+
i. It uses a call to an import in the import table. It also uses an if in the form of test/jz. Finally it calls the subroutine or exit.
13+
14+
ii. "http://reversing.rocks/" Seems like an interesting string.
15+
16+
2.
17+
18+
a. InternetConnectA(hInternet, "reversing.rocks", 0x4D2, 0, 0, 3, 0, 0)
19+
20+
i. (HINTERNET) hInternet => Handle from the InternetOpen
21+
(LPCTSTR) lpszServerName => Server name = "reversing.rocks"
22+
(INTERNET_PORT) nServerPort => Port = 1234
23+
(LPCTSTR) lpszUsername => NULL
24+
(LPCTSTR) lpszPassword => NULL
25+
(DWORD) dwService => 3 => HTTP
26+
(DWORD) dwFlags => 0
27+
(DWORD_PTR) dwContext => NULL
28+
29+
b. It opens a connection and goes to reversing.rocks and calls another subroutine. When that is done, it closes the connection.
30+
31+
i. Makes several calls to import tables, and the subroutine. Also has an if to check that the connection was opened correctly.
32+
33+
3.
34+
35+
a. Many calls to imported functions. An if to check if the first file could be found, and a while that will go loop though all files.
36+
37+
b. FindFirstFileA, HttpOpenRequestA, HttpSendRequestExA, InternetWriteFile, FindNextFileA, HttpEndRequestA, InternetCloseHandle, FindClose
38+
39+
c. Sends files that match "\\*" through post
40+
41+
4. The malware attempts to connect to the creator's site and then exfiltrate files from the local drive to his server. It then closes the connection and quits.
42+
43+
##### Lab_02-2.malware
44+
45+
1.
46+
47+
a. AllocConsole, FindWindowA, ShowWindow, fopen, time, fputs, ctime, fclose
48+
49+
i. AllocConsole creates a console for the process, FindWindow finds a window for the process and returns its handle, ShowWindow shows a window, the other functions are more normal c functions.
50+
51+
ii. "\\WINDOWS\\lzwindowlz.av", "\nStarted logging:"
52+
2.
53+
54+
a. GetAsyncKeyState, fopen, fseek, fread, fputc
55+
56+
b. There is a large switch with several cases
57+
58+
3. The malware is a keylogger that then sends the log to the owner.
59+
60+
a. One possible signature is looking for calls to GetAsyncKeyState
61+
62+
i. This would be used by keyloggers to get the keypresses without needing to have an active window. Detecting this could help find keyloggers in general.
63+
64+
b. The sample creates lzwindowlz.av which it fills with key presses that it records. Special keys are replaced with brackets and their name. This is then emailed every 100 characters to the address specified. The file is cleared at this point.

Labs/Lab_03/Lab_03.pdf

66.6 KB
Binary file not shown.

Labs/Lab_03/Lab_03.zip

32.8 KB
Binary file not shown.

Labs/Lab_03/solution.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#### Malware Analysis - Fall 2015
2+
#### Lab 03 Solution
3+
4+
##### Lab_03-1.malware
5+
6+
1. Yes, there is a dll, it can be extracted using FileAlyzer or Resource Hacker.
7+
8+
2.
9+
a. LoadResource - Load the dll info from the resources
10+
11+
c. WriteFile – Allows malware to log to file or write more malware to a file
12+
13+
d. IsDebuggerPresent – Malware could act differently if it detects a debugger is being used
14+
to analyze it
15+
16+
3.
17+
a. "http://rpis.ec/" - Potential network signature
18+
19+
b. "regsvr32 /s C:\Windows\atidrv.dll" - Potential persistence / hiding place
20+
21+
c. "C:\Users\IEUser\Downloads\BHOinCPP_src\BHOinCPP\Release\launch.pdb" - BHOinCPP is a project from CodeProject
22+
23+
4. It unpacks and creates a dll, and then registers that dll as with regsvr
24+
```
25+
CLSID\\{3543619C-D563-43f7-95EA-4DA7E1CC396A}\\InProcServer3
26+
Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Browser Helper Objects\\{3543619C-D563-43f7-95EA-4DA7E1CC396A}
27+
CodeProject Example BHO
28+
```
29+
30+
5. {3543619C-D563-43f7-95EA-4DA7E1CC396A}
31+
32+
6. IWebBrowser2
33+
34+
7. 0xa4 = put_Visible - Show the window
35+
36+
0x2c = Navigate - Go to page in browser
37+
38+
This combination displays one of the RPISEC URLs found in the adware
39+
40+
##### Lab_03-2.malware
41+
42+
1. MD5 is bf4f5b4ff7ed9c7275496c07f9836028. VirusTotal reports that it created and opened a file in the C drive, then copied it to the user's directory as java.exe.
43+
It also says it made a DNS request to us.t28.net
44+
45+
2.
46+
a. GetLogicalDrives – Gets bitmask representing all available drives. Could be used for environmental keying or host identification
47+
48+
b. gethostbyname - Could be used to resolve an attackers host for communication
49+
50+
c. GetOEMCP - Could be checking for VM
51+
52+
3.
53+
a. 'SOFTWARE\Microsoft\Windows\CurrentVersion\Run' - Registry key that auto runs when the user logs in, possible persistence mechanism
54+
55+
b. 'configserver)/r(ndr29(xhhoxxx2)00xAAAAAA....' - Could be an encrypted configuration file
56+
57+
c. '\java.exe' - The file it might make for persistence.
58+
59+
4. It sets the key in 'SOFTWARE\Microsoft\Windows\CurrentVersion\Run' to 'C:\DOCUME~1\User\java.exe', which is a copy of itself that it made. Some host-based signatures are that its in documents and settings for the user and copies under 'java.exe'.
60+
61+
5.
62+
Lists processes: 0x0402310
63+
64+
Remote Shell: 0x0402490 and 0x0402660 to use
65+
66+
Upload File: 00402210
67+
68+
6.
69+
List processes: The command id is 0x7
70+
71+
Remote Shell: The command id is 0x9 and 0x10
72+
73+
Upload File: The command id is 0x6
74+
75+
7.
76+
List processes: It sends the process name (xored with 0x55) and process id back to the control server
77+
78+
Remote Shell: 0x9 opens cmd.exe, 0x10 sends a command to it (xored with 0x55) and then reads from the named pipe and sends the result back (xored with 0x55)
79+
80+
Upload File: It maps the file into memory, xors it with 0x55, and sends it to the control server
81+
82+
8.
83+
Lists processes: CreateToolhelp32Snapshot, Process32First, Process32Next
84+
85+
Remote Shell: CreateProcessA, PeekNamedPipe, WriteFile
86+
87+
Upload File: CreateFileA, CreateFileMappingA, MapViewOfFile
88+
89+
9.
90+
0x2 - List contents of directory
91+
92+
0x5 - Download a file to infected computer
93+
94+
0x8 - Terminate process by PID

Labs/Lab_04/Lab_04.pdf

48.9 KB
Binary file not shown.

Labs/Lab_04/Lab_04.zip

5.9 KB
Binary file not shown.

Labs/Lab_04/solution.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#### Malware Analysis - Fall 2015
2+
#### Lab 04 Solution
3+
4+
##### Lab_04-1.malware
5+
6+
This sample was first statically analyzed with IDA to determine what calls to look at. It was then run in a VM with no ASLR with break points at the interesting calls, and ran with these break points to see what happened.
7+
8+
1. Its calling KERNEL32!GetProcAddress for VirtualAlloc
9+
2. Its calling VirtualAlloc to allocate 0xB000 bytes at 0x0C000000 as PAGE_EXECUTE_READWRITE
10+
3. 0x401360 calls KERNEL32!GetProcAddress, 0x40137e also calls KERNEL32!GetProcAddress, but with advapi32.dll, and 0x401388 uses user32.dll.
11+
4. GetModuleFileNameA,ExitProcess,CopyFileA,GetWindowsDirectoryA,LoadLibraryA,RegCreateKeyA,RegSetKeyValueA,RegCloseKey,MessageBoxA,
12+
5. I set break points on the functions calling getProcAddress and looked at the arguments that were being passed.
13+
6. Copies itself to C:\\WINDOWS\\virus.exe and then sets a registry key to auto run itself:
14+
```C
15+
RegCreateKeyA("Software\\Microsoft\\Windows\\CurrentVersion\\Run");
16+
RegSetKeyValueA("viri","C:\\WINDOWS\\virus.exe");
17+
```
18+
19+
It then creates a message box saying "Infected!". After that it exits.
20+
21+
##### Lab_04-2.malware
22+
23+
This sample was unpacked with UPX when there was no aslr enabled, otherwise it failed to run after unpacked. Once unpacked, I statically analyzed it and recognized the structure of a few loops preforming xor and comparison operations, as well as a nibble swap loop. To reverse this I wrote a small python script.
24+
25+
1. 0x004011BC For the win function
26+
2. For each character that you enter it flips the nibbles. So 0x41 becomes 0x14 and so on.
27+
3. The encrypted data is at 0x0040303C, and the string xored with it to decrypt it is at 0x00403018.
28+
4. flag{Pra1se_th3_Sun!}
29+
30+
Script:
31+
```Python
32+
f = "{ga1F_1auTca_eht_t0n_s!_s1hT}galf"
33+
data = "1DA17747F15A16776663359418E35B816A23D67C88000000"
34+
data = data.decode('hex')
35+
flag = ""
36+
37+
for i,c in enumerate(f):
38+
nc=ord(data[i%21])^ord(c)
39+
flag+=chr(((nc&0xf)<<4)+(nc>>4))
40+
41+
print flag
42+
```

Labs/Lab_05/Lab_05.pdf

63.4 KB
Binary file not shown.

Labs/Lab_05/Lab_05.zip

15.7 KB
Binary file not shown.

Labs/Lab_05/solution.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#### Malware Analysis - Fall 2015
2+
#### Lab 05 Solution
3+
4+
##### Lab_05-1.malware
5+
6+
1. It drops a file from its resource section (RC_DATA "DROP") into "C:\Program Files\Google\Update\GoogleUpdate.exe"
7+
8+
2. By replacincg "C:\Program Files\Google\Update\GoogleUpdate.exe" the malware is run every time Google Updater is triggered.
9+
This is a great host-based signature because we can check the validity of this file.
10+
11+
3. It uses the mutex 'WODUDE'
12+
13+
4. It hides the console window
14+
15+
It replaces a "trusted" file/program
16+
17+
5. SetWindowsHookExW - Enables a callback function on keypresses
18+
19+
SetWinEventHook - Enables a callback function on window focus change
20+
21+
6. WH_KEYBOARD_LL, EVENT_SYSTEM_FOREGROUND, WINEVENT_SKIPOWNPROCESS|WINEVENT_OUTOFCONTEXT
22+
23+
7. It writes keylogged data to a file in the current directory, in this case "C:\Program Files\Google\Update\\\<hostname\>"
24+
25+
##### Lab_05-2.malware
26+
27+
1. This malware downloads the file at "http://malcode.rpis.ec/update_defender" and uses it to replace the file at
28+
"C:\Program Files\Mozilla Maintenance Service\maintenanceservice.exe". If that fails, it will replace that file
29+
with the DROP resource
30+
31+
2. Similar to Lab_05-1.malware, this overwrites an update service, this time for Firefox. We can verify this file to
32+
confirm presence of the malware
33+
34+
3. A second mutex is required so that only one enumeration of child windows is done at a time. The first enumeration to
35+
run will grab the mutex, and the next enumerations will have to wait for this mutex to be released
36+
37+
4. Sends an Event/Message to a window. This can be used for updates or triggers, e.g. mouse, keyboard
38+
39+
5. 0xD2 - EM_GETPASSWORDCHAR - gets the character that an edit control message shows when a user is typing a password
40+
instead of showing the password
41+
42+
0xCC - EM_SETPASSWORDCHAR - sets the character that an edit control message shows when a user is typing a password
43+
instead of showing the password. In this case, the malware sends a parameter of 0 which
44+
means the control message will show the password plainly
45+
46+
0xC4 - EM_GETLINE - gets the line of text specified in an edit control message
47+
48+
6. This sample looks for password boxes in foreground windows. Once it finds one it will remove the password mask
49+
using EM_SETPASSWORDCHAR, steal the password with EM_GETLINE, and then reset the password mask. This differs from the
50+
last sample which hooked keyboard events to log all keystrokes. This sample specifically targets password fields
51+
52+
7. The malware writes all the data it collects into a file in the current directory,
53+
so it will be in "C:\Program Files\Mozilla Maintenance Service\\\<hostname\>"

Labs/Lab_06/Lab_06.pdf

46.2 KB
Binary file not shown.

Labs/Lab_06/Lab_06.zip

6.62 KB
Binary file not shown.

0 commit comments

Comments
 (0)