Currently, deobfuscation seems to hardcode commands to simplify, which can be completely circumvented with Set-Alias.
This is already used in real malware, see: https://minusone.skyblue.team/script/3f4aab4b-df6c-40fc-845f-0aa9eb4e0e43
Example:
-join ((97, 98, 99) | foreach-object { [Char]$_; })
gets simplified to
"abc"
but
Set-Alias foobar "foreach-object"
-join ((97, 98, 99) | foobar { [Char]$_; })
does not get simplified, but also evaluates to abc in powershell.
It seems like Set-Alias can only point to a single command/executable without arguments, so it isn't a delayed "eval".
Currently, deobfuscation seems to hardcode commands to simplify, which can be completely circumvented with
Set-Alias.This is already used in real malware, see: https://minusone.skyblue.team/script/3f4aab4b-df6c-40fc-845f-0aa9eb4e0e43
Example:
gets simplified to
"abc"but
does not get simplified, but also evaluates to
abcin powershell.It seems like Set-Alias can only point to a single command/executable without arguments, so it isn't a delayed "eval".