
Threat Actors Abuse IronPython to Deliver CastleLoader/CastleRAT
A threat-hunting blog post (#415 in a recurring series) analyzes how attackers abused IronPython to deliver CastleLoader and subsequently CastleRAT, based on Zscaler's SloppyRAT report. It documents the attack chain — a renamed curl.exe downloading IronPython from GitHub, then IronPython executing a base64-decoded, zlib-compressed Python payload — and provides concrete hunting queries (process creation events filtering on curl.exe with "ironpython" in the command line, and IronPython processes invoking base64.b64decode) to detect this technique, mapped to MITRE ATT&CK T1059.006.
What it is
Detection guidance for a technique from Zscaler's SloppyRAT report: attackers use IronPython (a .NET Python implementation) as the interpreter to stage CastleLoader → CastleRAT, exploiting the fact that IronPython is rare on normal hosts. Mapped to MITRE ATT&CK T1059.006 (Python).
How it works
The chain uses evasive naming at each step:
- A renamed copy of curl.exe (dropped as
9342371634011778.cominAppData\Local) downloadsIronPython.3.4.2.zipfrom the officialgithub.com/IronLanguages/ironpython3releases — but saves it with a.pdfextension (IronPython.3.4.2.pdf), using--ssl-no-revoketo skip revocation checks. - The extracted interpreter (
net462\31706105999761.exe) is invoked with-cto run an inline loader thatbase64.b64decodes azlib-compressed payload and.decode('utf-32')s it, then re-launchessys.executableviasubprocess.Popento run the decoded stage. This delivers CastleLoader, then CastleRAT.
What to do
The post gives three concrete hunts. The field names matter — reproduce them:
Renamed-curl downloading IronPython:
event_type: "processcreatewin"
AND proc_file_originalfilename: "curl.exe"
AND cmdline: *ironpython*Note proc_file_originalfilename, not the on-disk name — this catches the renamed .com binary.
IronPython performing Base64 decode:
event_type: "processcreatewin"
AND proc_file_productname: "ironpython"
AND cmdline: "base64.b64decode"Third and broadest: treat the mere presence of an IronPython interpreter on a host as suspicious. The post argues the average user never runs IronPython, so its existence is a valid investigation starting point regardless of command line — a hunt the summary's query-specific framing doesn't convey.
Caveats
These are hunting hypotheses derived from one incident's artifacts, not validated broad-coverage rules. The cmdline: "base64.b64decode" filter keys on the specific loader pattern seen here; a payload using a different decode path would evade it, which is why the interpreter-presence heuristic is offered as the durable fallback.
Organisations named here
- T1059.006
Technologies named here
- IronPython
- curl.exe
- Zscaler report
- curl
- Python
- Windows
- MITRE ATT&CK
- Zscaler
Techniques named here
- Command and Scripting Interpreter
- Renamed system utility
- Base64/zlib encoded payload execution
Threat actors named here
- SloppyRAT
- CastleLoader
- CastleRAT
Related in Blue Team & Detection
AI-Coded Malware | Analyzing Vibe-Coded AD Enumeration | Huntress
