Seagull — 1 vulnerability check
noctis ships 1 vulnerability check for Seagull, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Seagull PHP Framework Password Retrieval frmQuestion SQL Injection
| CVE | CVE-2010-3212 |
|---|---|
| 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/seagull/CVE-2010-3212.yaml |
Seagull PHP Framework 0.6.7 and earlier insert the frmQuestion parameter of the password retrieval action (index.php/user/password/?action=retrieve), unquoted and unescaped, into an SQL query, allowing unauthenticated SQL injection.
Under the web root, /seagull/www, /Seagull and /seagull, this check first requires Seagull's "Retrieve password" form, then submits it for a random, non-existent e-mail address with a security question that carries a MySQL SLEEP expression inside a version comment. The finding is confirmed when two SLEEP delays of different random lengths each delay the reply by the requested time over the same request with SLEEP(0). The injected expression does not make the query fail and matches no account, and no data is read; databases other than MySQL/MariaDB read it as a comment. The delays are short (2-3 s, then 5-7 s) because Seagull resets the administrator's password whenever this query fails: a database configured to abort statements after less than 7 seconds would turn one of the delays into such a failure (the second delay is not sent after a failed first one).
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/index.php/user/password/ - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/index.php/user/password/?action=retrieve&frmEmail={{sc.email}}&frmQuestion=1%… - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/index.php/user/password/?action=retrieve&frmEmail={{sc.email}}&frmQuestion=1%… - HTTP(S) request
GET {{dir}}/index.php/user/password/?action=retrieve&frmEmail={{sc.email}}&frmQuestion=1%… - Parses / computes the next value with a Rhai script
- Checks
tb.foundfor^SLEEP$→ finding QoD 75: Seagull PHP Framework Password Retrieval frmQuestion SQL Injection (CVE-2010-3212)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2010-3212
- https://www.exploit-db.com/exploits/14838
- http://packetstormsecurity.org/1008-exploits/seagull-sql.txt
Feed source — tests/vulnerabilities/seagull/CVE-2010-3212.yaml
# Seagull PHP Framework <= 0.6.7 — PasswordMgr "retrieve" frmQuestion SQL injection (CVE-2010-3212)
#
# modules/user/classes/PasswordMgr.php (0.6.7, the last release) builds, for
# index.php/user/password/?action=retrieve&submitted=…:
#
# SELECT * FROM usr WHERE email = <quoteSmart(frmEmail)>
# AND security_question = <frmQuestion> ← raw, unquoted
# AND security_answer = <quoteSmart(frmAnswer)>
# $userId = $this->dbh->getOne($query);
# if ($userId) { _resetPassword($userId); sendPassword(...); }
#
# Request input only goes through trim() + strip_tags().
#
# Why this feed does NOT reuse the source check's probe: the source check sends
# frmQuestion=1'[SQLI] and looks for "this->whereAdd" + "Object of class DB_".
# A failing query makes getOne() return a DB_Error OBJECT, which is truthy, so
# _resetPassword(DB_Error) runs: DB_DataObject::get() stores it as usr_id,
# _build_condition() does intval($this->usr_id) → PHP notice "Object of class
# DB_Error could not be converted to int" (the matched text, printed with its
# source line only in development mode) and the value 1 — user 1 is the
# administrator, whose password is then reset and mailed. So every SQL error
# on this endpoint resets the admin password, and the source check only sees it
# on development-mode installs. This feed does not make the query fail:
#
# frmQuestion=1 /*!50012 AND (SELECT 1 FROM (SELECT SLEEP(n))noctis)*/
# frmEmail=noctis<random>@example.invalid (no account → no row, no reset)
#
# * MySQL/MariaDB >= 5.0.12 execute the versioned comment: the derived table
# sleeps n seconds once, SLEEP() returns 0, no row matches, getOne() returns
# null → "email not in system" + the usual 302 redirect.
# * Older MySQL, PostgreSQL, Oracle read it as a comment: the query is plain
# "security_question = 1" — valid, no row (only a miss, never an error).
# Checked on MariaDB 10.11 and PostgreSQL with the real query shape.
#
# Detection, per candidate install directory (/, /seagull/www, /Seagull, /seagull):
# 1. The "Retrieve password" form (forgotPasswd, frmQuestion, frmAnswer) must
# be served at index.php/user/password/.
# 2. Baseline: the same payload with SLEEP(0) — same code path, must answer
# (< 500) in < 4 s without the DB_Error notice.
# 3. QoD 75 — two random delays, shorter first: the longer one is only sent
# when the shorter one came back with the baseline's status inside its
# window. Each delay must land in [-1 s, +2.5 s] of its SLEEP over the
# baseline, with a >= 2.5 s gap between them (a tarpit delaying every
# SLEEP request alike gives ~0).
# Residual risk: a database statement time limit shorter than the delay
# (MariaDB max_statement_time, MySQL >= 5.7.8 max_execution_time, a query
# killer) aborts the query with an error, which takes the reset path above.
# Delays are kept short (2-3 s, then 5-7 s) and the shorter one goes first,
# so at most one request can hit that path (the second is not sent after an
# error reply), and only under a limit shorter than 7 s.
# Limit: http_request's duration_ms stops at the response headers; Seagull
# sends them (302) only after the query.
#
# CVE-2010-3209 (listed with this one by the source check): the four "RFI"
# files are PEAR libraries under lib/pear/ (outside the www/ document root) whose
# include variables are locals or class registries, not request input — not
# reachable over HTTP on a standard install, so it is not tested here.
#
# CVSS: NVD v2 7.5 (no v3 score published).
#
# Source: OpenVAS/Greenbone NASL 2010/gb_seagull_sql_injection_n_mult_rfi_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801513, GPL-2.0-only)
uid: 1d49cd40-9e57-43c5-8713-7da60ea51666
name: "Seagull PHP Framework Password Retrieval frmQuestion SQL Injection (CVE-2010-3212)"
description: |
Seagull PHP Framework 0.6.7 and earlier insert the frmQuestion parameter of
the password retrieval action (index.php/user/password/?action=retrieve),
unquoted and unescaped, into an SQL query, allowing unauthenticated SQL
injection.
Under the web root, /seagull/www, /Seagull and /seagull, this check first
requires Seagull's "Retrieve password" form, then submits it for a random,
non-existent e-mail address with a security question that carries a MySQL
SLEEP expression inside a version comment. The finding is confirmed when two
SLEEP delays of different random lengths each delay the reply by the
requested time over the same request with SLEEP(0). The injected
expression does not make the query fail and matches no account, and no data
is read; databases other than MySQL/MariaDB read it as a comment. The
delays are short (2-3 s, then 5-7 s) because Seagull resets the
administrator's password whenever this query fails: a database configured
to abort statements after less than 7 seconds would turn one of the delays
into such a failure (the second delay is not sent after a failed first one).
cves: [CVE-2010-3212]
cvss: 7.5
severity: high
confidence_base: 0.30
category: sqli
tags: [seagull, php, framework, sqli, time-based]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2010-3212"
- "https://www.exploit-db.com/exploits/14838"
- "http://packetstormsecurity.org/1008-exploits/seagull-sql.txt"
steps:
# ── Random account, answer and sleep delays ───────────────────────────────
- id: gen
action: script
code: |
let s1 = rand_int(2, 3);
#{ email: "noctis" + rand_int(10000000, 99999999) + "%40example.invalid",
answer: "noctis" + rand_int(10000000, 99999999),
s1: s1, s2: s1 + rand_int(3, 4) }
store_as: sc
# ── Per candidate install directory (loop group) ──────────────────────────
# Pre-initialise every stored result a script reads: a failed request leaves
# store_as unset and an undefined var would abort the whole test.
- id: init-form-resp
action: set_var
var_name: form_resp
var_value: {status: 0, body: null}
loop:
over: ["", "/seagull/www", "/Seagull", "/seagull"]
var: dir
- id: init-base-resp
action: set_var
var_name: base_resp
var_value: {status: 0, body: null, duration_ms: 0}
- id: init-sleep1-resp
action: set_var
var_name: sleep1_resp
var_value: {status: 0, body: null, duration_ms: 0}
- id: init-sleep2-resp
action: set_var
var_name: sleep2_resp
var_value: {status: 0, body: null, duration_ms: 0}
# ── Seagull's password retrieval form ─────────────────────────────────────
- id: form
action: http_request
method: GET
port: "{{port}}"
path: "{{dir}}/index.php/user/password/"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: form_resp
- id: check-form
action: script
code: |
let body = if type_of(form_resp.body) == "string" { form_resp.body } else { "" };
#{ ok: form_resp.status == 200 && body.contains("forgotPasswd")
&& body.contains("name=\"frmQuestion\"") && body.contains("name=\"frmAnswer\"") }
store_as: fm
# ── Baseline: the same payload with SLEEP(0) ──────────────────────────────
- id: baseline
action: http_request
method: GET
port: "{{port}}"
path: "{{dir}}/index.php/user/password/?action=retrieve&frmEmail={{sc.email}}&frmQuestion=1%20%2F%2A%2150012%20AND%20%28SELECT%201%20FROM%20%28SELECT%20SLEEP%280%29%29noctis%29%2A%2F&frmAnswer={{sc.answer}}&submitted=retrieve"
condition: "fm.ok"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: base_resp
- id: check-baseline
action: script
code: |
let body = if type_of(base_resp.body) == "string" { base_resp.body } else { "" };
#{ ok: fm.ok && base_resp.status >= 200 && base_resp.status < 500
&& !body.contains("Object of class DB_") && base_resp.duration_ms < 4000 }
store_as: bl
# Shorter delay first (statement-timeout risk, see the header); the longer
# one only when the shorter one answered normally inside its window.
- id: sleep-probe-1
action: http_request
method: GET
port: "{{port}}"
path: "{{dir}}/index.php/user/password/?action=retrieve&frmEmail={{sc.email}}&frmQuestion=1%20%2F%2A%2150012%20AND%20%28SELECT%201%20FROM%20%28SELECT%20SLEEP%28{{sc.s1}}%29%29noctis%29%2A%2F&frmAnswer={{sc.answer}}&submitted=retrieve"
condition: "bl.ok"
tls_insecure: true
follow_redirects: false
timeout_secs: 35
store_as: sleep1_resp
- id: sleep-probe-2
action: http_request
method: GET
port: "{{port}}"
path: "{{dir}}/index.php/user/password/?action=retrieve&frmEmail={{sc.email}}&frmQuestion=1%20%2F%2A%2150012%20AND%20%28SELECT%201%20FROM%20%28SELECT%20SLEEP%28{{sc.s2}}%29%29noctis%29%2A%2F&frmAnswer={{sc.answer}}&submitted=retrieve"
condition: "bl.ok && sleep1_resp.status == base_resp.status && sleep1_resp.duration_ms >= base_resp.duration_ms + sc.s1 * 1000 - 1000 && sleep1_resp.duration_ms <= base_resp.duration_ms + sc.s1 * 1000 + 2500"
tls_insecure: true
follow_redirects: false
timeout_secs: 35
store_as: sleep2_resp
# The query runs once per request: each delay must match its SLEEP within
# [-1 s, +2.5 s] over the baseline, with the same status as the baseline,
# and the longer SLEEP must take at least 2.5 s more than the shorter one.
- id: check-timing
action: script
code: |
let base = base_resp.duration_ms;
let d1 = sleep1_resp.duration_ms - base;
let d2 = sleep2_resp.duration_ms - base;
let ok = bl.ok && sleep1_resp.status == base_resp.status && sleep2_resp.status == base_resp.status
&& d1 >= sc.s1 * 1000 - 1000 && d1 <= sc.s1 * 1000 + 2500
&& d2 >= sc.s2 * 1000 - 1000 && d2 <= sc.s2 * 1000 + 2500
&& (d2 - d1) >= 2500;
#{ blind: ok, found: if ok { "SLEEP" } else { "" } }
store_as: tb
- id: report-time
action: match
source: tb.found
pattern: "^SLEEP$"
condition: "tb.blind"
on_match:
finding:
title: "Seagull PHP Framework Password Retrieval frmQuestion SQL Injection (CVE-2010-3212)"
description: "A SLEEP expression injected through the frmQuestion parameter of Seagull's password retrieval action delayed the reply by the requested time, for two different random delays, while the same request with SLEEP(0) answered at once. The database runs SQL taken from the parameter, so an unauthenticated attacker can read the application's database; any query error on this action also makes Seagull reset and e-mail the administrator's password."
remediation: "No fixed Seagull release exists (0.6.7 is the last). Restrict access to the application, or patch modules/user/classes/PasswordMgr.php to cast frmQuestion to an integer (or pass it through quoteSmart()) before it reaches the query, and stop _cmd_retrieve() from resetting a password when getOne() returns an error."
confidence_delta: 0.55
qod: 75
evidence: "Time-based SQLi confirmed: frmQuestion=1 /*!50012 AND (SELECT 1 FROM (SELECT SLEEP(n))noctis)*/ on {{dir}}/index.php/user/password/?action=retrieve delayed the reply by the injected n — baseline {{base_resp.duration_ms}} ms, SLEEP({{sc.s1}}) {{sleep1_resp.duration_ms}} ms, SLEEP({{sc.s2}}) {{sleep2_resp.duration_ms}} ms (HTTP {{base_resp.status}})"
stop: true