Milw0rm Clone — 1 vulnerability check
noctis ships 1 vulnerability check for Milw0rm Clone, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Milw0rm Clone Script related.php program SQL injection
| CVE | CVE-2015-4137 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | sqli — SQL injection |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/milw0rm-clone/CVE-2015-4137.yaml |
Milw0rm Clone Script 1.0 passes the program parameter of related.php into an SQL query without sufficient escaping, so an unauthenticated visitor can inject SQL into the application's database.
Under the usual install paths (/milw0rm, /milworm_script and the web root), this check first confirms the script's page marker on the index page, then requests related.php with a random token as a control, then with a single quote appended to the token, and then with two quotes. The vulnerability is reported when only the single-quote request prints a mysql_num_rows() warning, while the control and the balanced two-quote request print none. Nothing is written and no data is read from the database.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{adir}}/ - HTTP(S) request
GET {{adir}}/related.php?{{q.ctl}} - HTTP(S) request
GET {{adir}}/related.php?{{q.one}} - HTTP(S) request
GET {{adir}}/related.php?{{q.two}} - Parses / computes the next value with a Rhai script
- Checks
res.okfor^true$→ finding QoD 75: Milw0rm Clone Script program SQL injection (CVE-2015-4137)
References:
Feed source — tests/vulnerabilities/milw0rm-clone/CVE-2015-4137.yaml
# Milw0rm Clone Script — related.php program SQL injection (CVE-2015-4137)
#
# related.php of Milw0rm Clone Script 1.0 puts the program parameter into an SQL query
# without escaping, so a lone quote breaks the query and PHP prints a mysql_num_rows()
# warning.
#
# Detection (QoD 75), per candidate install dir (/milw0rm, /milworm_script, web root):
# 1. <dir>/ must carry the script's ">iAm[i]nE<" page marker (product gate).
# 2. related.php?program=<random token> (control) prints no mysql_num_rows warning.
# 3. program=<token>' (one quote) prints the warning.
# 4. program=<token>'' (balanced quotes) prints none: the page does not simply print a
# warning for any quote character.
# Read-only: the payloads are quote characters; nothing is written or read from the DB.
#
# Better than the source NASL: it fires on one quote probe alone; here a clean control and
# a balanced-quote probe rule out pages that print an error for any quote.
# CVSS: NVD carries only a CVSS v2 score (7.5) for this CVE.
#
# Source: OpenVAS/Greenbone NVT 2015/gb_Milw0rm_sql_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.805397, GPL-2.0-only).
uid: f284ecae-4678-4b02-8031-5d33ce4958f4
name: "Milw0rm Clone Script related.php program SQL injection (CVE-2015-4137)"
description: |
Milw0rm Clone Script 1.0 passes the program parameter of related.php into an SQL query
without sufficient escaping, so an unauthenticated visitor can inject SQL into the
application's database.
Under the usual install paths (/milw0rm, /milworm_script and the web root), this check
first confirms the script's page marker on the index page, then requests related.php
with a random token as a control, then with a single quote appended to the token, and
then with two quotes. The vulnerability is reported when only the single-quote request
prints a mysql_num_rows() warning, while the control and the balanced two-quote request
print none. Nothing is written and no data is read from the database.
cves: [CVE-2015-4137]
cvss: 7.5 # NVD publishes only a CVSS v2 base score (7.5) for this CVE
severity: high
category: sqli
confidence_base: 0.30
tags: [milw0rm-clone, php, sqli, error-based]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2015-4137"
steps:
- id: gen
action: script
code: |
let t = "nc" + rand_hex(5);
#{ ctl: "program=" + t, one: "program=" + t + "%27", two: "program=" + t + "%27%27" }
store_as: q
# A loop: step runs together with every following non-loop step once per directory, so
# the init steps below reset all stored results at the start of each iteration.
- id: init-home
action: set_var
var_name: home_resp
var_value: {status: 0, body: null}
loop:
over: ["/milw0rm", "/milworm_script", ""]
var: adir
- id: init-ctl
action: set_var
var_name: ctl_resp
var_value: {status: 0, body: null}
- id: init-one
action: set_var
var_name: one_resp
var_value: {status: 0, body: null}
- id: init-two
action: set_var
var_name: two_resp
var_value: {status: 0, body: null}
- id: home
action: http_request
method: GET
port: "{{port}}"
path: "{{adir}}/"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: home_resp
- id: control
action: http_request
method: GET
port: "{{port}}"
path: "{{adir}}/related.php?{{q.ctl}}"
condition: 'home_resp.status == 200 && type_of(home_resp.body) == "string" && stridx(home_resp.body, ">iAm[i]nE<") >= 0'
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: ctl_resp
- id: inject-one
action: http_request
method: GET
port: "{{port}}"
path: "{{adir}}/related.php?{{q.one}}"
condition: 'ctl_resp.status == 200 && type_of(ctl_resp.body) == "string" && !ereg("mysql_num_rows", ctl_resp.body)'
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: one_resp
- id: inject-two
action: http_request
method: GET
port: "{{port}}"
path: "{{adir}}/related.php?{{q.two}}"
condition: 'one_resp.status >= 200 && one_resp.status < 500 && type_of(one_resp.body) == "string" && ereg("mysql_num_rows", one_resp.body)'
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: two_resp
- id: check
action: script
code: |
let o = if type_of(one_resp.body) == "string" { one_resp.body } else { "" };
let t = if type_of(two_resp.body) == "string" { two_resp.body } else { "" };
let ok = two_resp.status == 200
&& ereg("mysql_num_rows", o)
&& !ereg("mysql_num_rows", t);
#{ ok: ok }
store_as: res
- id: report
action: match
source: res.ok
pattern: "^true$"
condition: "res.ok"
on_match:
finding:
title: "Milw0rm Clone Script program SQL injection (CVE-2015-4137)"
description: "A single quote appended to the program parameter of related.php made Milw0rm Clone Script print a mysql_num_rows() warning, while the same request without the quote and with a balanced pair of quotes printed none: the value reaches an SQL statement unescaped, so an unauthenticated attacker can run arbitrary SQL against the application database."
remediation: "Upgrade Milw0rm Clone Script to a release that escapes the program parameter (use prepared statements), or remove related.php; the original product is unmaintained, so consider replacing it."
confidence_delta: 0.45
qod: 75
evidence: "{{adir}}/related.php: program=<token> answers without a database warning, program=<token>' answers with a mysql_num_rows() warning, program=<token>'' answers without one"
stop: true