Add new doc for writing a command injection exploit module #18277
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds some simple documentation with a working vulnerable service and a working module to exploit it. I believe it does a good job of establishing a baseline before jumping into the cmdstager guide.
Adds
Background
I just wrote a module exploiting a similar vulnerable service and found the command-stager guide confusing.
I think that starting from the ground up is better for explanations than pulling examples from other modules.
This documentation is an attempt to fix that by giving a new module developer only what they need to write a basic module that can be expanded upon later.
Future Improvements
filter_bad_chars
usinggsub!
and then str-formatting the return of this into the payload.gsub!
modifies the string in place, and may just return nil - style of thisfilter_bad_chars
could be modified to match the one in my documentation, which returns regardless of modificationMsf::Exploit::Remote::HttpClient
to use thesend_request_cgi
function. This might have been my error, but I wasn't able to getsend_request_cgi
until adding this import