Skip to content

Feature cleanup psh bypass pr #1

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

Conversation

sempervictus
Copy link

Thanks for the PR.
These changes are designed to thin out the work again to prevent code reuse and leverage the internal composition functions of Rex::Powershell to perform the same work (but leaving things like multi-line gsubs into ";" separated lines to the generator).
Could you please review these changes and consider merging them to your branch?

RageLtMan added 2 commits April 7, 2019 03:33
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).
@phra phra self-requested a review April 9, 2019 08:41
Copy link
Owner

@phra phra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@phra phra merged commit 2e14657 into phra:feat/psh-protections-bypass Apr 9, 2019
@phra
Copy link
Owner

phra commented Apr 9, 2019

done! @sempervictus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants