Skip to content
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

Not really an issue but I can't contact you any other way. #65

Closed
Human505-oatmeal opened this issue Feb 11, 2025 · 1 comment
Closed
Labels
question Further information is requested

Comments

@Human505-oatmeal
Copy link

How does the PrivescCheck/PrivescCheck.ps1 work?

I'm trying to obfuscate a Powershell script the other scripts get detected by the anti-virus whereas this script entirely bypasses it, how did you base64 encode and compress it and then load it? Can I get any more resources to do this kind of obfuscation? Sorry for the issue, thank you!

@itm4n
Copy link
Owner

itm4n commented Feb 11, 2025

The code of PrivescCheck is spread across multiple "source" files (see the src folder). Each of these files is compressed (gzip) and base64-encoded, which yields a list of very long base64 strings in the final script, referenced with a randomly named variable. As for the loader in the output file PrivescCheck.ps1, it simply iterates this list of strings, and does everything in reverse to get the original content and load it.

This is a technique I came up with. Perhaps other tools used a similar technique before that, I don't know. The basic idea is that most AV/EDR seem to detect "malicious" scripts based on multiple signatures, not just one or two. Therefore, if you have a large script, like mine, there is a high chance it will be detected. However, if you split it into smaller chunks and load them separately, the chance of triggering multiple signatures at the same time is lowered. But that's not all, because sometimes that's not enough. In that case, I modify the script manually to bypass a particular signature.

For more information, you should check out the script build/Build.ps1. There is no "magic trick" involved, it's pretty basic, but it is particularly well suited for my purpose.

@itm4n itm4n closed this as completed Feb 18, 2025
@itm4n itm4n added the question Further information is requested label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants