myBloggie — 1 vulnerability check
noctis ships 1 vulnerability check for myBloggie, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
myBloggie search.php keyword SQL Injection
| CVE | CVE-2005-1500 |
|---|---|
| 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/mybloggie/CVE-2005-1500.yaml |
myBloggie 2.1.1 through 2.1.3 strip the backslash that escapes a quote from the keyword of the search page after escaping it, so a single quote in the search keyword reaches the SQL query unescaped and the page prints the database error. An unauthenticated attacker can inject SQL into the posts query (read the user table, including password hashes).
This check looks for the myBloggie footer on the web root and the usual install paths, then searches a random word, a keyword that closes and reopens the quoted string in valid SQL, and a keyword holding one lone quote. The vulnerability is reported when only the lone quote makes the page print an SQL syntax error, so a page that always shows such an error is not flagged. The original 2.1.1, whose post_id parameter is not cast to an integer, is also checked through index.php?mode=viewid&post_id=1'. 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}}/index.php - HTTP(S) request
GET {{dir}}/index.php?{{sc.q_clean}} - HTTP(S) request
GET {{dir}}/index.php?{{sc.q_bal}} - HTTP(S) request
GET {{dir}}/index.php?{{sc.q_inj}} - HTTP(S) request
GET {{dir}}/index.php?mode=viewid&post_id=1 - HTTP(S) request
GET {{dir}}/index.php?mode=viewid&post_id=1' - Parses / computes the next value with a Rhai script
- Checks
hit_dirfor^/→ finding QoD 75: myBloggie SQL Injection (CVE-2005-1500)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2005-1500
- https://sourceforge.net/projects/mybloggie/files/mybloggie/
Feed source — tests/vulnerabilities/mybloggie/CVE-2005-1500.yaml
# myBloggie 2.1.1 - 2.1.3 — search.php keyword SQL injection — CVE-2005-1500
#
# search.php (myBloggie 2.1.1 final / 2.1.2, SourceForge mybloggie) escapes the keyword
# (addslashes, or magic_quotes_gpc on PHP 4) and only then runs
# str_replace(array("+","-","*","~","\"","(",")","<",">","\\"), "", $keyword)
# on the words it builds the query from. The strip list contains the backslash, so it
# removes the very escape that protected a quote and the quote reaches
# ... AND ( subject like '%<kw>%' OR message like '%<kw>%' ) Order by ...
# unescaped. The script prints $db->sql_error(), so a lone quote shows the MySQL syntax
# error. The same code is in 2.1.1, 2.1.2 and 2.1.3 (NVD: "item (1) was discovered to
# affect 2.1.3 as well"); the post_id / cat_id / year / month_no / date_no variants of the
# CVE are intval()'d in the 2.1.1-final and 2.1.2 archives, so only an original 2.1.1
# answers the second probe (index.php?mode=viewid&post_id=1').
#
# Detection (QoD 75), per candidate install dir whose index.php carries the myBloggie
# footer link (mywebland.com">myBloggie):
# 1. control search keyword=<random word> -> no SQL error
# 2. balanced keyword=<w>%'<TAB>OR<TAB>'a'='b -> no SQL error (valid SQL, tabs
# because the script splits keywords on spaces and strips "*", "(", "-")
# 3. inject keyword=<w>' -> "error in your SQL syntax"
# Only a quote that reaches the query unescaped turns 3 on while 1 and 2 stay clean, so a
# page that always prints an SQL error (or echoes every query string) is not flagged.
# Fallback: viewid with post_id=1' vs post_id=1 (the NASL probe) for the original 2.1.1.
# Read-only: no row is read or written.
#
# Better than the source NASL: it needs a single "…error in your SQL syntax" hit on the
# post_id parameter, which is already intval()'d in 2.1.1-final and later (so 2.1.x installs
# that are still injectable through search.php are missed), and has no clean-input control.
# Not covered: CVE-2005-1140 / 1498 (XSS: stored comment / year, cat_id, month_no, post_id
# in error messages) and CVE-2005-1499 (delcomment.php deletes any comment — destructive).
#
# Source: OpenVAS/Greenbone NVT pre2008/mybloggie_sql_injection.nasl
# (OID 1.3.6.1.4.1.25623.1.0.18209, GPL-2.0-only).
uid: 8bab4171-2b21-48cd-b771-11ffb28c00b6
name: "myBloggie search.php keyword SQL Injection (CVE-2005-1500)"
description: |
myBloggie 2.1.1 through 2.1.3 strip the backslash that escapes a quote from the
keyword of the search page after escaping it, so a single quote in the search
keyword reaches the SQL query unescaped and the page prints the database error. An
unauthenticated attacker can inject SQL into the posts query (read the user table,
including password hashes).
This check looks for the myBloggie footer on the web root and the usual install paths,
then searches a random word, a keyword that closes and reopens the quoted string in
valid SQL, and a keyword holding one lone quote. The vulnerability is reported when only
the lone quote makes the page print an SQL syntax error, so a page that always shows
such an error is not flagged. The original 2.1.1, whose post_id parameter is not cast to
an integer, is also checked through index.php?mode=viewid&post_id=1'. No stored data is
read and nothing is written.
cves: [CVE-2005-1500]
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: [mybloggie, sqli, error-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2005-1500"
- "https://sourceforge.net/projects/mybloggie/files/mybloggie/"
# OpenVAS/Greenbone NASL pre2008/mybloggie_sql_injection.nasl (GPL-2.0-only)
steps:
- id: gen
action: script
code: |
let w = "noctis" + rand_hex(6);
#{ w: w,
q_clean: "mode=search&keyword=" + w,
q_bal: "mode=search&keyword=" + w + "%25'%09OR%09'a'%3D'b",
q_inj: "mode=search&keyword=" + w + "'" }
store_as: sc
- id: init-hit
action: set_var
var_name: hit_dir
var_value: ""
- id: init-landing
action: set_var
var_name: landing
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["", "/mybloggie", "/blog", "/myblog"]
- id: init-clean
action: set_var
var_name: clean
var_value: {status: 0, body: ""}
- id: init-bal
action: set_var
var_name: bal
var_value: {status: 0, body: ""}
- id: init-inj
action: set_var
var_name: inj
var_value: {status: 0, body: ""}
- id: init-vctl
action: set_var
var_name: vctl
var_value: {status: 0, body: ""}
- id: init-vinj
action: set_var
var_name: vinj
var_value: {status: 0, body: ""}
- id: fetch-landing
action: http_request
method: GET
path: "{{dir}}/index.php"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit_dir == ""'
store_as: landing
- id: probe-clean
action: http_request
method: GET
path: "{{dir}}/index.php?{{sc.q_clean}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit_dir == "" && landing.status == 200 && type_of(landing.body) == "string" && landing.body.contains("mywebland.com\">myBloggie")'
store_as: clean
- id: probe-bal
action: http_request
method: GET
path: "{{dir}}/index.php?{{sc.q_bal}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit_dir == "" && landing.status == 200 && type_of(landing.body) == "string" && landing.body.contains("mywebland.com\">myBloggie")'
store_as: bal
- id: probe-inj
action: http_request
method: GET
path: "{{dir}}/index.php?{{sc.q_inj}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit_dir == "" && landing.status == 200 && type_of(landing.body) == "string" && landing.body.contains("mywebland.com\">myBloggie")'
store_as: inj
- id: probe-view-ctl
action: http_request
method: GET
path: "{{dir}}/index.php?mode=viewid&post_id=1"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit_dir == "" && landing.status == 200 && type_of(landing.body) == "string" && landing.body.contains("mywebland.com\">myBloggie")'
store_as: vctl
- id: probe-view-inj
action: http_request
method: GET
path: "{{dir}}/index.php?mode=viewid&post_id=1'"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit_dir == "" && landing.status == 200 && type_of(landing.body) == "string" && landing.body.contains("mywebland.com\">myBloggie")'
store_as: vinj
- id: check
action: script
condition: 'hit_dir == "" && landing.status == 200 && type_of(landing.body) == "string" && landing.body.contains("mywebland.com\">myBloggie")'
code: |
let e = "error in your SQL syntax";
let cb = if type_of(clean.body) == "string" { clean.body } else { "" };
let bb = if type_of(bal.body) == "string" { bal.body } else { "" };
let ib = if type_of(inj.body) == "string" { inj.body } else { "" };
let vc = if type_of(vctl.body) == "string" { vctl.body } else { "" };
let vi = if type_of(vinj.body) == "string" { vinj.body } else { "" };
let d = if dir == "" { "/" } else { dir };
if inj.status == 200 && ib.contains(e) && clean.status == 200 && !cb.contains(e) && bal.status == 200 && !bb.contains(e) {
d + "|search"
} else if vinj.status == 200 && vi.contains(e) && vctl.status == 200 && !vc.contains(e) {
d + "|viewid"
} else { "" }
store_as: hit_dir
- id: report
action: match
source: hit_dir
pattern: "^/"
on_match:
finding:
title: "myBloggie SQL Injection (CVE-2005-1500)"
description: "A single quote in the search keyword (or in post_id of the original 2.1.1) reached the SQL query unescaped and the page printed the MySQL syntax error, while a random word and a keyword that closes and reopens the quoted string in valid SQL did not: an unauthenticated attacker can inject SQL into the posts query and read the database, including the user table."
remediation: "Upgrade myBloggie to a release that fixes search.php, or cast and quote every request parameter before it is used in a query (mysql_real_escape_string, without a later strip of the backslash) and stop printing database errors."
confidence_delta: 0.45
qod: 75
evidence: "install {{hit_dir}}: a lone quote in the keyword printed 'error in your SQL syntax'; the random word and the valid-SQL keyword did not"
stop: true