
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
PowerShell obfuscation through stacked junk logic, dead code, and variable chaos.
Built to execute, not to be understood...
Project on Github: https://github.com/bobby-tablez/Invoke-Junkpile
Invoke-Junkpile is a Python-based tool that takes clean PowerShell scripts and transforms them into an entropic mess of stacked polymorphic variables, junk code, and obfuscated logic through randomization. The generated code is designed to be obfuscated while not appearing obfuscated. Designed for stealth, this tool aims to evade static detection signatures, confuse reverse engineers, and wreak havoc on basic string-matching defenses and entropy checks. In the end, it outputs fully functional, heavily obfuscated PowerShell code.
This was tested on a wide range of PowerShell scripts which worked in 99% of cases (see limitations below). This includes very large and complex scripts and scripts containing assemblies.
python Invoke-Junkpile.py -f ./input.ps1 -o ./output_obfuscated.ps1
Or using an inline command:
python Invoke-Junkpile.py -c "Get-Process | Where-Object { $_.CPU -gt 100 }"
With debug output:
python Invoke-Junkpile.py -f ./input.ps1 -o ./obf.ps1 --debug
$test01 = 6
${Read-Host -ArgumentList -Path \\Backups && ($gstknk)} = "ZSgk";${Compress-Archive -InputFormat -ComputerName $server_ip_09 && ($amicpk)} = "0LCRu";
for ($i = 0; $i -lt 9; $i++) { $nextvar = $i }
$Win32_count = 4
$randIndex = Get-Random -Minimum 2 -Maximum 17
${Expand-Archive -Force -Uri office365.com/?auth=1 && ($kiings)} = "sKSA=";
while ($null) { $run = 9; Start-Sleep -Seconds 6 }
$backupcount = 6
try { $void = Get-Random -Minimum 7 -Maximum 11 } catch { $void = $null }
${Get-ChildItem -ErrorAction SilentlyContinue -LogName Windows PowerShell && ($calran)} = @()
${Get-ChildItem -ErrorAction SilentlyContinue -LogName Windows PowerShell && ($calran)} += @(${Remove-Item -ErrorAction SilentlyContinue -ComputerName $dc_08 && ($eknrb)}, ${Invoke-WebRequest -OutputFormat -LogName Setup && ($egbe)}, ${Write-Output -Force -Name CcmExec && ($bsle)}, ${Write-Host -InputFormat -LogName Application && ($npnpfb)}, ${Restart-Service -Debug -Seconds 10 && ($enfmh)}, ${Read-Host -Debug -Seconds 14 && ($fclclb)}, ${Import-Module -ErrorAction SilentlyContinue -Name powershell && ($gblslr)})
$randIndex = Get-Random -Minimum 0 -Maximum 11
for ($j = 0; $j -lt 0; $j++) { $final += $j }
Flag | Description |
---|---|
-f , --file | Path to the input PowerShell script |
-c , --command | Inline PowerShell command to obfuscate |
-o , --output | Path to save the obfuscated output |
--debug | Enables debug output for development |
Obfuscation Phase:
#
comments are removed.[Text.Encoding]::UTF8.GetString()
expression, which is piped into IEX
.Execution Phase:
IEX
.This creates a layered illusion of complexity while keeping the actual behavior intact.
The power of obfuscation—visualized. The sample used was the "Using Reflection" script found over at https://github.com/S3cur3Th1sSh1t/Amsi-Bypass-Powershell
Original Script (Unobfuscated AMSI Bypass)
This sample was detected by numerous engines: c65416981ba34fbb9638e263585a4ad908705126da79bb8fc353fea90a6824a9
Invoke-Junkpile Obfuscated Script
After running the same script through Invoke-Junkpile: 3b5602182826d17beeac8ebb204950f6fe4a85809c91e38bd5dff7e46e684167
✅ 0 / 63 detections
Heavily obfuscated, yet still fully functional.
If you know what to look for, it shouldn't be too bad if you allow the PowerShell interpreter to do most of the work for you.
More randomly generated obfuscation around the Base64 execution and invoke expression. More to come!
This tool is intended for educational and research purposes only. Use responsibly and ethically.
FAQs
PowerShell obfuscation through stacked junk logic, dead code, and variable chaos.
We found that invoke-junkpile demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.