-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
New Function: Wildcard / Parameter Injection #169
Comments
Hmm, I'd say that pretty much all the binaries suffer from that, and that
Take for example
In the case it is executed in the above conditions as:
It can be exploited like:
So basically any binary that does not require user interaction would fall in this category, right? |
I'm still not very sure if it makes sense to collect such commands. Yes, only binaries which do not require user interaction. It does however also not make sense if the command in the end is not realistic. When would someone just call The exploitation of such a wrong usage is very specific and I think it's difficult to provide a "general" exploit command. The technique behind the execution is already available in GTFOBins and the rest could usually be figured out I guess. |
I agree about the realistic part but I don't think it is something we want to take into account here. But again, it really applies to pretty much every command, with the above limitations and a variable degree of ease of implementation. Here's
Having said that, I don't think this is something that justifies adding a new function. But, we're playing with the idea of a complete rework of the structure of the data files, where sudo, SUID, etc. stop being functions and become features of a given example/procedure (possibly with a different code example, if needed). This is very WIP, but I think that |
OK, this new feature structure sounds interesting. In scp, there might be a solution using the -o ProxyCommand option from SSH but I could not create a working example within some minutes. |
Nice! Here you are:
|
Yeah, THX. Ah, I did not use the
I think because this is treated as one argument:
So this makes sense. Using multiple files:
Then it works:
Strace shows now the correct invocation:
But your solution is more elegant anyways 😄 👍 |
Hi all, |
@MegaManSec I honestly don't see how that's focusing of argument injection, by looking at the examples I just see the usual stuff... I see value in this @emanuelduss's suggestion, and I can see adding such new function in the upcoming release (which is mostly done, I only wish I had time and energy to finalize it...), but I don't really understand how your clone relates to that. |
@cyrus-and: Hey, thanks for the reply and merging #373. In this example, we cannot set the filename to equal something like The asterisk expansion in the OP of this issue is just one form of argument injection, and is only related to creating files with the arguments; but creating files which will be included in asterisk expansion is only one use-case. Argument injection is seen in many languages which don't allow for calling The value I see is that when you see some code that calls system() or something equivalent, you can check whether there are any known values which can abuse the arguments provided by the program. It's a much broader topic than just "create a file with the arguments, which will be expanded by the shell (dependent on the shell)". |
👋 I've been aware of this GitHub issue for some time before starting to work on the first version of a list of argument injection vectors, but I was not expecting a similar project to be released the same week! On my side, I chose to focus on arguments leading to RCE when exploiting web bugs (i.e. not sudo misconfigurations) and I require links to advisories and write-ups so all vectors stay realistic. I also don't think they belong to GTFOBins, as these vectors won't help to "to bypass local security restrictions in misconfigured systems". Maybe we can clarify our respective goals and see how we can make these projects merge or co-exist? |
Seems similar to mine indeed!:) Feel free to email me: joshua x joshua.hu |
@MegaManSec IMHO this is not possible, and that
Hence your system("dos2unix '-f < /etc/passwd'") And:
What am I missing here? |
Bad example indeed:) Another example: class_files = list_files(folder, allowed_ext=".java")
subprocess.run(["/usr/bin/javac", "-d", "/tmp/rand"]+class_files) The attacker must create two files: exploit.java and Anyways, AFAICT, basically parameter injections (not talking about wildcards) are a subset of what GTFOBins provides, and as Thomas has mentioned, are not about exploiting programs what they are usable with sudo, but rather just their general usage anywhere. |
Hi
Before submitting a PR I would like to hear your opinion.
Would it make sense to create a new function for wildcard / parameter injection possibilities?
This function would address all binaries which could be used to execute a function via a command line argument.
A well-known example is the tar command and the arguments
--checkpoint-action=exec="chmod +s `which dash`" --checkpoint=1
as e.g. documented here: https://materials.rangeforce.com/tutorial/2019/11/08/Linux-PrivEsc-Wildcard/I'm aware that this command execution method is already documented in GTFOBins, but it cannot be identified as wildcard or parameter injection. A new category would make sense for me to quickly identify binaries which can be abused for privesc if one or more parameters can be controlled.
What do you think?
THX
The text was updated successfully, but these errors were encountered: