Chipmunk Guestbook — 1 vulnerability check
noctis ships 1 vulnerability check for Chipmunk Guestbook, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Chipmunk Guestbook index.php start SQL Injection
| CVE | CVE-2008-6368 |
|---|---|
| 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/chipmunk-guestbook/CVE-2008-6368.yaml |
Chipmunk Guestbook 1.4 puts the start paging parameter of index.php unquoted into the LIMIT clause of an SQL query and prints the database error when the query fails, allowing unauthenticated SQL injection.
This check requests index.php under /guestbook, the web root and /gb and keeps the pages that show the Chipmunk Guestbook footer. It then sends a start value that makes the database evaluate the product of two random numbers inside an EXTRACTVALUE() call; the vulnerability is confirmed when the returned XPATH error carries the product, which never appears in the request. On databases that do not support that construct, it sends a start value with a stray quote and a random marker and reports the flaw when the SQL syntax error quotes the marker while a normal start value shows no error. No table 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 - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/index.php?start={{sc.q97}} - Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/index.php?start={{sc.q75}} - HTTP(S) request
GET {{dir}}/index.php?start=0 - Parses / computes the next value with a Rhai script
- Checks
hit97for^/→ finding QoD 97: Chipmunk Guestbook index.php start SQL Injection (CVE-2008-6368) - Checks
hit75for^/→ finding QoD 75: Chipmunk Guestbook index.php start SQL Injection (CVE-2008-6368)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2008-6368
- https://www.securityfocus.com/bid/18195
- http://packetstorm.linuxsecurity.com/0811-exploits/chipmunkguestbook-sqlxss.txt
Feed source — tests/vulnerabilities/chipmunk-guestbook/CVE-2008-6368.yaml
# Chipmunk Guestbook 1.4 — index.php start SQL injection — CVE-2008-6368
#
# index.php pages through the entries with
# $start = $_GET['start'];
# ... "Select * FROM <entries> order by ID DESC LIMIT " . $start . ", $numentries"
# so start reaches the LIMIT clause unquoted (same concatenation in the same
# author's Chipmunk Blogger guestbook/index.php; the stand-alone Guestbook 1.4
# download is no longer online). The 1.4 advisory and the reference check both
# show the raw MySQL error ("You have an error in your SQL syntax") in the page.
# Every page ends with
# "Powered by (c) <a href='http://www.chipmunk-scripts.com'>Chipmunk Guestbook</a>".
#
# Detection, per install dir whose index.php carries that footer:
# QoD 97 — start = 0,1 PROCEDURE ANALYSE(EXTRACTVALUE(1,CONCAT(0x7e,a*b)),1)-- -
# with random 6-digit a, b. MySQL 5.x / MariaDB evaluate the constant
# argument and fail with "XPATH syntax error: '~<a*b>'" (checked on
# MariaDB 10.11 through PHP mysqli, also on an empty table). The
# product is never in the request. Read-only, no table referenced.
# QoD 75 — servers without PROCEDURE ANALYSE (MySQL 8): start = 0'<marker>
# must give "You have an error in your SQL syntax ... near ''<marker>"
# while the control start=0 shows no SQL error.
#
# Better than the source NASL:
# - a database-computed value instead of a reflected <script> tag, so a page
# that merely echoes start next to an unrelated SQL error cannot match;
# - both payloads start with a digit, so "$start - $numentries" in the paging
# code never chokes on them;
# - also probes the web root and /gb, not only /guestbook and the CGI dirs.
#
# Source: OpenVAS/Greenbone NVT 2009/Chipmunk_guestbook_sql_injection_and_xss.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100039, GPL-2.0-only).
uid: a9378e78-9596-492e-90c7-e4c07b65667d
name: "Chipmunk Guestbook index.php start SQL Injection (CVE-2008-6368)"
description: |
Chipmunk Guestbook 1.4 puts the start paging parameter of index.php unquoted
into the LIMIT clause of an SQL query and prints the database error when the
query fails, allowing unauthenticated SQL injection.
This check requests index.php under /guestbook, the web root and /gb and keeps
the pages that show the Chipmunk Guestbook footer. It then sends a start value
that makes the database evaluate the product of two random numbers inside an
EXTRACTVALUE() call; the vulnerability is confirmed when the returned XPATH
error carries the product, which never appears in the request. On databases
that do not support that construct, it sends a start value with a stray quote
and a random marker and reports the flaw when the SQL syntax error quotes the
marker while a normal start value shows no error. No table data is read and
nothing is written.
cves: [CVE-2008-6368]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [chipmunk-guestbook, sqli, error-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2008-6368"
- "https://www.securityfocus.com/bid/18195"
- "http://packetstorm.linuxsecurity.com/0811-exploits/chipmunkguestbook-sqlxss.txt"
# OpenVAS/Greenbone NASL 2009/Chipmunk_guestbook_sql_injection_and_xss.nasl (GPL-2.0-only)
steps:
# ── Random operands, marker and the two payloads ──────────────────────────
- id: gen-proof
action: script
code: |
let a = rand_int(100000, 999999);
let b = rand_int(100000, 999999);
let m = "NOCTIS" + rand_int(100000000, 999999999);
let q = "(?:'|�?39;|'|')";
#{ prod: "" + (a * b),
expr: a + "*" + b,
mark: m,
xpath_re: "XPATH syntax error: " + q + "?~" + (a * b),
syntax_re: "You have an error in your SQL syntax.{0,300}near " + q + q + m,
q97: "0,1%20PROCEDURE%20ANALYSE(EXTRACTVALUE(1,CONCAT(0x7e," + a + "*" + b + ")),1)--%20-",
q75: "0%27" + m }
store_as: sc
- id: init-hit97
action: set_var
var_name: hit97
var_value: ""
- id: init-hit75
action: set_var
var_name: hit75
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: ["/guestbook", "", "/gb"]
- id: init-is-gb
action: set_var
var_name: is_gb
var_value: false
- id: init-r97
action: set_var
var_name: r97
var_value: {status: 0, body: ""}
- id: init-r75
action: set_var
var_name: r75
var_value: {status: 0, body: ""}
- id: init-ctl
action: set_var
var_name: ctl
var_value: {status: 0, body: ""}
- id: init-try75
action: set_var
var_name: try75
var_value: false
- id: fetch-landing
action: http_request
method: GET
path: "{{dir}}/index.php"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit97 == "" && hit75 == ""'
store_as: landing
- id: gate
action: script
condition: 'hit97 == "" && hit75 == ""'
code: |
let body = if type_of(landing.body) == "string" { landing.body } else { "" };
landing.status == 200 && ereg("Powered by.+>\\s*Chipmunk Guestbook\\s*<", body, true)
store_as: is_gb
- id: probe-extractvalue
action: http_request
method: GET
path: "{{dir}}/index.php?start={{sc.q97}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit97 == "" && hit75 == "" && is_gb == true'
store_as: r97
- id: check-extractvalue
action: script
condition: 'hit97 == "" && hit75 == "" && is_gb == true'
code: |
let body = if type_of(r97.body) == "string" { r97.body } else { "" };
if ereg(sc.xpath_re, body) { if dir == "" { "/" } else { dir } } else { "" }
store_as: hit97
- id: want-fallback
action: script
condition: 'hit97 == "" && hit75 == "" && is_gb == true'
code: |
true
store_as: try75
- id: probe-quote
action: http_request
method: GET
path: "{{dir}}/index.php?start={{sc.q75}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'try75 == true'
store_as: r75
- id: probe-control
action: http_request
method: GET
path: "{{dir}}/index.php?start=0"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'try75 == true'
store_as: ctl
- id: check-quote
action: script
condition: 'try75 == true'
code: |
let body = if type_of(r75.body) == "string" { r75.body } else { "" };
let cbody = if type_of(ctl.body) == "string" { ctl.body } else { "" };
if ctl.status != 0 && ereg(sc.syntax_re, body, true) && !ereg("SQL syntax|XPATH syntax", cbody, true) {
if dir == "" { "/" } else { dir }
} else { "" }
store_as: hit75
# ── Findings ──────────────────────────────────────────────────────────────
- id: report-97
action: match
source: hit97
pattern: "^/"
on_match:
finding:
title: "Chipmunk Guestbook index.php start SQL Injection (CVE-2008-6368)"
description: "An unauthenticated request to index.php with start set to an EXTRACTVALUE() call on the product of two random numbers returned an XPATH error carrying the product computed by the database: start reaches the SQL query unquoted, so an attacker can run arbitrary SQL and read the whole database."
remediation: "Chipmunk Guestbook is no longer maintained: remove it, or cast start with intval() in index.php before it is put in the LIMIT clause, and stop printing mysql_error() to visitors."
confidence_delta: 0.67
qod: 97
evidence: "install dir {{hit97}}: index.php?start=0,1 PROCEDURE ANALYSE(EXTRACTVALUE(1,CONCAT(0x7e,{{sc.expr}})),1)-- - returned the database-computed value ~{{sc.prod}} in an XPATH syntax error"
stop: true
- id: report-75
action: match
source: hit75
pattern: "^/"
on_match:
finding:
title: "Chipmunk Guestbook index.php start SQL Injection (CVE-2008-6368)"
description: "An unauthenticated request to index.php with a start value holding a stray quote and a random marker returned an SQL syntax error quoting the marker, while a normal start value returned no error: start reaches the SQL query unquoted, so an attacker can run arbitrary SQL."
remediation: "Chipmunk Guestbook is no longer maintained: remove it, or cast start with intval() in index.php before it is put in the LIMIT clause, and stop printing mysql_error() to visitors."
confidence_delta: 0.50
qod: 75
evidence: "install dir {{hit75}}: index.php?start=0'{{sc.mark}} returned an SQL syntax error near ''{{sc.mark}}; the control start=0 returned none"
stop: true