-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate PowerShell Protections Bypass #17
Conversation
@phra I missed this for a bit, but I'd like to test and land this. Can you give specific examples where our current payloads fail, but this succeeds so we can have some testing benchmarks? |
@bwatters-r7 just try any powershell payloads on an updated win 10 machine with AMSI. |
Rex::Powershell has functionality to compose PowerShell code into Script objects using basic lexical parsing to identify functions, variables, etc. This functionality is intended to permit/leverage composition by consumers for maximum entropy. Concurrently, script modifiers are in place to clean up multiline blocks, replace names, and perform other obfuscation. Strip out the built-in uses of the new AMSI and log bypass methods. Remove textual cleanup to allow Rex to handle this as needed.
Passing the :prepend_protections_bypass to cmd_psh_payload will prepend the Ruby blocks for AMSI and log bypass to the payload text. The subsequent compression and encoding passes will perform the same textual substitution stripping out whitespace and may also substitute the hardcoded variable names if requested. This approach keeps string lengths predictable while permitting use of the evasion functionality. Not so much an issue for a full PSH payload, but can be handy when dealing with limited space (HID attacks, manual retyping over GUIs, etc).
Feature cleanup psh bypass pr
as reference: https://iwantmore.pizza/posts/amsi.html |
Very interesting thanks @phra |
I didn't expect the
|
Thanks @phra |
empire includes https://github.com/danielbohannon/Invoke-Obfuscation but depends on PowerShell and that means adding it as optional? dependency or embedding it directly within the project with a ~50mb overhead of stuff. writing a simpler, similar project in ruby may be an overkill. any idea? |
was i don't see the setting available yet with |
@phra apologies I didn't send a PR with that part, I think I tested with this commit: timwr/metasploit-framework@a0d6bcd |
oh ok, i hope it will be merged into master soon! |
any update? i still cannot easily add the amsi bypass to powershell payloads. |
@timwr any update on this? |
@phra did you test the commit I posted above? timwr/metasploit-framework@a0d6bcd |
|
Will fix rapid7/metasploit-framework#11283