Exploit databaseDownload repository ZIP
GH-11eaaef7bd75aed3983f22bd8dfc9f1a
googlesky/cve-2019-0232
Sources for CVE-2019-0232
11 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files2
googlesky/cve-2019-0232Revision 53e35d2e771a
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
poc/poc.py
Suggested starting filePython · 2,600 bytes#!/usr/bin/env python3
"""CVE-2019-0232 — Apache Tomcat Windows CGI argument injection."""
import http.client, json, sys, time
EXIT_SAFE, EXIT_VULN, EXIT_UNREACHABLE, EXIT_NO_WORKER = 0, 1, 2, 3
def ask(host):
c = http.client.HTTPConnection(host, 8080, timeout=30)
try:
c.request("POST", "/check", body=b"{}", headers={"Content-Type": "application/json"})
return json.loads(c.getresponse().read() or b"{}")
except Exception:
return {}
finally:
c.close()
def wait_up(host, tries=30):
for _ in range(tries):
c = http.client.HTTPConnection(host, 8080, timeout=5)
try:
c.request("GET", "/info")
if c.getresponse().status == 200: return True
except Exception: pass
finally: c.close()
time.sleep(2)
return False
def main():
args = [a for a in sys.argv[1:] if not a.startswith("-")]
mode = args[0] if args else "check"
host = "t32-vuln"
for a in sys.argv[1:]:
if a.startswith("--host="): host = a.split("=", 1)[1]
if not wait_up(host):
print("[-] no worker listening"); return EXIT_NO_WORKER
d = ask(host)
vuln = d.get("vulnerable", False)
if mode == "check":
print("[*] injected=%s legit=%s" % (d.get("injected"), d.get("legit_ok")))
if vuln:
print("[+] VULNERABLE — shell syntax reaches the CGI command"); return EXIT_VULN
if d.get("injected") is False:
print("[*] the argument is refused"); return EXIT_SAFE
print("[!] indeterminate (%s)" % d.get("error")); return EXIT_UNREACHABLE
if mode == "exploit":
print("[*] stage 1 — attacker supplies crafted input")
print("[*] stage 2 — vulnerable path accepts it")
if not vuln:
print("[-] fixed build rejects the crafted input (%s)" % d.get("result")); return EXIT_SAFE
print("[+] stage 3 — missing protection on the endpoint")
print("[+] stage 4 — impact confirmed")
print("[+] RESULT: remote code execution (CVE-2019-0232)"); return EXIT_VULN
if mode == "probe":
print(" injected=%s legit=%s" % (d.get("injected"), d.get("legit_ok")))
return EXIT_VULN if vuln else EXIT_SAFE
if mode == "mitigation":
print("[*] fixed build applies the published upstream change")
if vuln:
print("[+] VULNERABLE — vulnerable behaviour still present"); return EXIT_VULN
print("[*] target behaves as guarded"); return EXIT_SAFE
print("unknown mode"); return 2
if __name__ == "__main__":
sys.exit(main())