I’m wondering.. How can I quickly decode all these base64 strings? We not gonna decode it one-by-one aren’t we? There are hundreds or probably thousand of it.
So… We going to leverage Excel & macro (yes. you read it right. MACRO) to automatically decode those base64 strings for us. We going to Excel-Fu out of this data.
The macro code that we’ll be using as below:
Function TextBase64Encode(strText, strCharset)
Dim arrBytes
With CreateObject("ADODB.Stream")
.Type = 2 ' adTypeText
.Open
.Charset = strCharset
.WriteText strText
.Position = 0
.Type = 1 ' adTypeBinary
arrBytes = .Read
.Close
End With
With CreateObject("MSXML2.DOMDocument").createElement("tmp")
.DataType = "bin.base64"
.nodeTypedValue = arrBytes
TextBase64Encode = Replace(Replace(.Text, vbCr, ""), vbLf, "")
End With
End Function
Function TextBase64Decode(strBase64, strCharset)
Dim arrBinary
With CreateObject("MSXML2.DOMDocument").createElement("tmp")
.DataType = "bin.base64"
.Text = strBase64
arrBinary = .nodeTypedValue
End With
With CreateObject("ADODB.Stream")
.Type = 1 ' adTypeBinary
.Open
.Write arrBinary
.Position = 0
.Type = 2 ' adTypeText
.Charset = strCharset
TextBase64Decode = .ReadText
.Close
End With
End Function
To use it, first, we need to open the Splunk result that we exported earlier.
After that, press Alt-F8 to open the macro editor. Create new macro – you can give any name you want. For example, I named it “Base64“:
It will then open a new window. Paste macro code given above inside the editor:
After that, close the editor window. Just leave the Excel open.
Then, create 2 new column in the Excel sheet; column named “ASCII” and “Decoded Base64“:
We need to fill up column “ASCII” with string “ASCII” until end/bottom of your data. Let’s say you have 300 row of data in your Excel, then fill 300 of “ASCII” strings besides it.
Just press Ctrl + Arrow-Down to quickly go to end/bottom of data column. After that, type in string “ASCII” in one of the row and copy it (Ctrl-C). Then, press Ctrl + Shift + Arrow-Up to select from bottom to top. Then paste/Ctrl + V to fill all column with string “ASCII“.
Your Excel will look something like this:
Next, we going to start decoding the base64 strings.
Again, press Ctrl + Arrow-Down to go end of column, and type the formula as below:
=TextBase64Decode(<column-string>,<column-ASCII>)
Refer example as below:
Then, again, copy column with the formula, Ctrl + Shift + Arrow-Up to select from bottom to top & paste/Ctrl + V the formula into all selected column; under “Decoded Base64“.
That’s it. We have successfully decoded all the base64 strings via Excel.
We can utilize Carbon Black Investigate feature to see if there’s any malicious npm library been installed in our environments. Here’s the query to do that:
Search for effected coa & rc library versions:
(filemod_name:\coa-2.0.3* OR filemod_name:\coa-2.0.4* OR filemod_name:\coa-2.1.1* OR filemod_name:\coa-2.1.3* OR filemod_name:\coa-3.0.1* OR filemod_name:\coa-3.1.3* OR filemod_name:\rc-1.2.9* OR filemod_name:\rc-1.3.9* OR filemod_name:\rc-2.3.9*)
Search for possible C2:
netconn_domain:pastorcryptograph[.]at
IOC:
• pastorcryptograph[.]at
• sdd.dll from coa - SHA256: f53ef1ed12f9ba49831ea33100083c9a92bc8adc6620f8a3b36a2d9ae2eb8591
• sdd.dll from rc - SHA256: 26451f7f6fe297adf6738295b1dcc70f7678434ef21d8b6aad5ec00beb8a72cf
• sdd.dll - SHA256: 687a401007c29ee595004d93c4dd5de6c5c9f86f811f8e1d9f1ad1962507cd65
Carbon Black query that can be use to detect if any MSHTML RCE happened (probably need to be refined more):
((process_cmdline:control.exe AND ((process_cmdline:*.inf AND process_cmdline:AppData) OR (process_cmdline:*.cpl AND process_cmdline:../)) AND -process_cmdline:*\icedrive\*) OR ((hash:6EEDF45CB91F6762DE4E35E36BCB03E5AD60CE9AC5A08CAEB7EDA035CD74762B OR hash:938545f7bbe40738908a95da8cdeabb2a11ce2ca36b0f6a74deda9378d380a52) OR (parent_hash:6EEDF45CB91F6762DE4E35E36BCB03E5AD60CE9AC5A08CAEB7EDA035CD74762B OR parent_hash:938545f7bbe40738908a95da8cdeabb2a11ce2ca36b0f6a74deda9378d380a52) OR (filemod_hash:6EEDF45CB91F6762DE4E35E36BCB03E5AD60CE9AC5A08CAEB7EDA035CD74762B OR filemod_hash:938545f7bbe40738908a95da8cdeabb2a11ce2ca36b0f6a74deda9378d380a52)))
Search if any assets making connections towards IOCs (known IOCs as of 9 Sept):
netconn_domain:joxinu.com OR netconn_domain:pawevi.com OR netconn_domain:macuwuf.com