
Invoke-ArgFuscator is an open-source, cross-platform PowerShell module that helps generate obfuscated command-lines for common system-native executables.
░█░█▄░█░█▒█░▄▀▄░█▄▀▒██▀░▒░ ▄▀▄▒█▀▄░▄▀▒▒█▀░█▒█░▄▀▀░▄▀▀▒▄▀▄░▀█▀░▄▀▄▒█▀▄░ ░█░█▒▀█░▀▄▀░▀▄▀░█▒█░█▄▄░▀▀░█▀█░█▀▄░▀▄█░█▀░▀▄█▒▄██░▀▄▄░█▀█░▒█▒░▀▄▀░█▀▄░
Invoke-ArgFuscator 是一个开源、跨平台的 PowerShell 模块,可帮助为 Windows、Linux 和 macOS 上的常见系统原生可执行文件生成混淆的命令行。
👉 在此处使用 ArgFuscator 的交互式版本:ArgFuscator.net 🚀
命令行混淆(T1027.010)是指通过操纵进程的命令行来伪装命令真实意图的行为。在 Windows、Linux 和 macOS 中,许多应用程序会以意想不到的方式解析传入的命令行参数,从而导致在某些情况下插入、删除和/或替换某些字符并不会改变程序的执行流程。成功的命令行混淆很可能使 AV 和 EDR 软件等防御措施受挫,在某些情况下甚至能完全绕过检测。
尽管先前的研究已经强调了命令行混淆的风险,但大多只是针对易受攻击的(系统原生)应用程序的轶事性示例,围绕这一技术仍存在知识空白。本项目旨在通过提供一个集中式资源来弥补这一空白,该资源记录并演示各种命令行混淆技术,并记录流行应用程序对每种技术的受影响程度。
该模块适用于任何支持 PowerShell/pwsh 的操作系统,包括 Windows、macOS 和 Linux。
brew,请运行 brew install powershell/tap/powershell 安装最新版本的 PowerShell。如需其他安装选项,请参阅 Microsoft 的文档。安装此模块最简单的方式是通过以下 PowerShell 命令:
Install-Module -Name Invoke-ArgFuscator
要使用该模块,请在 PowerShell 中调用 Invoke-ArgFuscator 函数,例如:
a. 将你想要混淆的命令行作为命令行参数传入(前提是该命令受 ArgFuscator.net 支持):
# Windows
powershell /c "Invoke-ArgFuscator -Command 'certutil /f /urlcache https://www.example.org/ homepage.txt'"
# macOS and Linux
pwsh -c "Invoke-ArgFuscator -Command 'certutil /f /urlcache https://www.example.org/ homepage.txt'"
b. 使用你自己的模型文件[^1]:
# Windows
powershell /c "Invoke-ArgFuscator -InputFile path\to\file.json"
# macOS and Linux
pwsh -c "Invoke-ArgFuscator -InputFile path/to/file.json"
将此存储库克隆到你的设备。
通过 PowerShell 调用 Invoke-ArgFuscator.ps1,例如:
a. 要以交互方式运行,请通过标准输入(stdin)传入模型文件[^1]的路径:
# Windows
powershell .\Invoke-ArgFuscator.ps1
# macOS and Linux
pwsh ./Invoke-ArgFuscator.ps1
b. 将模型文件[^1]的路径作为命令行参数传入:
# Windows
powershell .\Invoke-ArgFuscator.ps1 -InputFile "path\to\file.json"
# macOS and Linux
pwsh ./Invoke-ArgFuscator.ps1 -InputFile "path/to/file.json"
c. 将你想要混淆的命令行作为命令行参数传入:
请注意,这要求 models/ 文件夹与 Invoke-ArgFuscator.ps1 位于同一文件夹中。
# Windows
powershell .\Invoke-ArgFuscator.ps1 -Command "certutil /f /urlcache https://www.example.org/ homepage.txt"
# macOS and Linux
pwsh ./Invoke-ArgFuscator.ps1 -Command "certutil /f /urlcache https://www.example.org/ homepage.txt"
由于 Invoke-ArgFuscator 是一个 PowerShell 模块,你可以将此项目的功能添加到自己的 PowerShell 项目中。
要利用 Invoke-ArgFuscator,请在 PowerShell 文件中添加
Import-Module Invoke-ArgFuscator
然后按以下任一方式调用它:
Invoke-ArgFuscator -InputFile $InputFile -n $n
Invoke-ArgFuscator -Command $Command -Platform $Platform -n $n
其中
$InputFile 一个 string,包含指向模型文件的(相对/绝对)文件路径;$Profile 一个大于或等于 0 的 integer,表示给定文件路径中应针对的配置文件索引(可选);$n 一个大于 0 的 integer,表示应生成的混淆命令行等效项的数量(可选);或,$Command 一个 string,包含你想要混淆的命令行;$Platform 一个 string,包含相关平台(例如 windows,可选);$n 一个大于 0 的 integer,表示应生成的混淆命令行等效项的数量(可选)。[^1]:这些文件可以通过 ArgFuscator.net 的“下载”选项生成,或从 GitHub 下载。