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

Payload Execution Guardrails - Environment Variable Checks #248

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

attl4s
Copy link

@attl4s attl4s commented Sep 28, 2020

Why

Adversaries may use execution guardrails to constrain execution or actions based on adversary supplied and environment specific conditions that are expected to be present on the target. Guardrails ensure that a payload only executes against an intended target and reduces collateral damage from an adversary’s campaign (more info).

Additions

This PR adds environment variable checks for the Grunt HTTP Stager before executing any of the stages. The desired environment variables can be specified when creating a new HTTP launcher in the following format:
enVar1=value1;envVar2=value2;envVar3=value3....

Example: USERNAME=ATTL4S;USERDOMAIN=SIMONE;LOGONSERVER=\\DC01

If this form is empty, the Stager will just run without checking anything.

envVar1

Future Work?

The way we implemented this has an obvious caveat: all the logic is hardcoded in the Stager, so anyone will be able to see who is the actual target. In addition, this implementation doesn't protect in any way the final payload, as anyone could bypass this env check and just jump to the stages and actual code.

  • As we are using a Stager, we could leverage one of the stages to perform a server-side check of the variables so their values are not hardcoded in the actual Stager. If this check results in false, the server doesn't continue with further stages.
  • For stageless payloads, we could encrypt the payload using those values (the only data harcoded would be the env var names to check)

Cheers!

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