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

Adds "local" payload type and privesclib #255

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

terrorbyte
Copy link
Collaborator

This adds the "local" package for use with exploit specific use cases that have appeared multiple times. The first payload in this contains a shared object library for linux that clocks in at 204 bytes and handles privilege escalation when run as root. This has come up a few times and could be potentially useful elsewhere.

A note, this uses both "embed" to get the binary into the payload variable directly and "go:generate" on the local/privesclib_amd64.asm file in order to allow for dynamic generation.

I also did a quick clarification on the reverse payload godoc because it was a little confusing.

This adds the "local" package for use with exploit specific use cases
that have appeared multiple times. The first payload in this contains a
shared object library for linux that clocks in at 204 bytes and handles
privilege escalation when run as root. This has come up a few times and
could be potentially useful elsewhere.

A note, this uses both "embed" to get the binary into the payload
variable directly and "go:generate" on the local/privesclib_amd64.asm
file in order to allow for dynamic generation.
@terrorbyte terrorbyte added the enhancement New feature or request label Oct 10, 2024
@terrorbyte terrorbyte self-assigned this Oct 10, 2024

// Defines default structures and payload functions.
type (
PrivEscLibraryPayload struct{}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think my complaint is that PrivEscLib (and privesclib_amd64) are really generic names. Is that... ok? Like I can see a world where we want to do more of these right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was also quite torn on these, but that part is supposed to be generic. Since that's the type that gets functions defined from: ie the actual payload call in this is local.PrivEscLibrary.AMD64(). I think that keeping the top level struct type as broad is fine, but maybe the function signature should be something like LinuxSharedObjectAMD64() vs AMD64() or even have another type for OS and then keep the architecture?

I'm not sold on any of these as the best way to do it (I'm not even positive embedding binaries is a good idea period), so if you have any thoughts I'm happy to rearrange.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I do think that having something with the final signature of local.PrivEscLibrary.Linux.AMD64() would probably be fine and cover most the use cases while being specific enough to prevent confusion.... but I also hate all the dots lol. We could even do a local.PrivEscLibrary.LinuxSharedObjectAMD64(), but I fear the protocol signature explosion.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sold on any of these as the best way to do it (I'm not even positive embedding binaries is a good idea period), so if you have any thoughts I'm happy to rearrange.

🤣

I am also not positive. However, it's an interesting step forward and code can always be removed from the library. I'm not afraid to bump the major version :) I think maybe more experience using this part will inform us on how it should be improved. That's fine by me. Go ahead and merge when you are ready.

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

Successfully merging this pull request may close these issues.

2 participants