-
Notifications
You must be signed in to change notification settings - Fork 42
Add payload support definition & support for custom user payloads #459
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
ba81611 to
c1c00eb
Compare
47a44c9 to
3f707e1
Compare
|
I'd like some comments on the effects strings formats as those feel very wrong. Something I considered was even turning them directly into JSON, which is nasty but a known format. |
|
I don't like nested JSON documents, but I think I've decided that that format is more reasonable than me reinventing one. |
|
This is a bit more reasonable: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a comprehensive payload support system that enables exploits to define supported payload types, architectures, and effects. It establishes a "Bring Your Own Payload" (BYOP) capability allowing users to provide custom commands or binary payloads through new command-line flags.
Key changes include:
- New
payloadpackage defining types, architectures, and effects for payload metadata - Automatic generation of
-commandand-payloadflags based on supported payload types - Integration of payload selection logic into the framework's command-line parsing
- Enhanced details output showing supported payloads and their effects
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| payload/payload.go | Core payload type system defining Type, Arch, Effect enums and conversion functions |
| payload/payload_test.go | Test coverage for payload type and architecture string conversions |
| config/config.go | Config struct extensions for payload support and AddPayload/HasCustomPayload methods |
| cli/commandline.go | Command-line flag generation logic for payload types and architectures |
| framework.go | Payload metadata processing from command-line flags |
| c2/channel/channel.go | Documentation formatting fixes |
| dotnet/dotnetgadget.go | Documentation formatting fix |
| payload/dropper/unix.go | Documentation formatting fix |
| payload/reverse/bash.go | Whitespace formatting |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This adds support for adding explicit payload support to an exploit. This provides a few things:
BYOP
Now when a payload adds support via
config.AddPayloaddepending on the supported payloads. The file based (ELF, SO, .exe, .dll, webshell) types will add a-payloadoption that will automatically read a file from disk and add it toconfig.CustomPayloadif the user uses the flag.If the user uses one of the new
payload.*Commandtypes then-commandflag will be available andconfig.CustomPayloadwill contain the value provided by that flag (or it can be accessed directly from the normal flag handling for the string type).An example of how to define the code for this:
Now when the exploit is run the following options can be seen:
If a payload is defined with only one architecture
-payload-archwill not show up and if only one payload type is defined-payload-typewill also disappear. For example:will yield the following flags with none of the others:
The developer can then handle the specific cases:
Or if there is a complex case where more specificity is required:
Payload and Exploit Effects
You can now define payload effects. The above example adds a list of payload effects if the default payload is used. An example of how this is now available in the details listing from the above example:
This is part of #434
Undraft requirements: