Docusafe — 1 vulnerability check
noctis ships 1 vulnerability check for Docusafe, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
GateSoft Docusafe ECO.asp SQL injection
| CVE | CVE-2010-4736 |
|---|---|
| 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/docusafe/CVE-2010-4736.yaml |
GateSoft Docusafe, a document management web application written in classic ASP, places the ECO_ID parameter of ECO.asp into its database query without validation, so a remote attacker can run arbitrary SQL against the Docusafe database.
On /docusafe, /DocuSafe and the web root, once main.asp shows the DocuSafe title, this check requests ECO.asp with an ECO_ID made of a number followed by a random word, and with a stray quote and a random word. These values only make the query fail to parse and change nothing. The flaw is confirmed when the reply shows the database syntax error (Access "in query expression", SQL Server "Incorrect syntax near" or "Unclosed quotation mark") quoting the random word.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{v.d}}/main.asp - HTTP(S) request
GET {{v.d}}/ECO.asp?ECO_ID={{v.pre}}{{sc.tok}} - Parses / computes the next value with a Rhai script
- Checks
hitforECO\.asp→ finding QoD 75: GateSoft Docusafe ECO.asp SQL injection (CVE-2010-4736)
References:
Feed source — tests/vulnerabilities/docusafe/CVE-2010-4736.yaml
# GateSoft Docusafe — ECO.asp ECO_ID SQL injection (CVE-2010-4736).
#
# GateSoft Docusafe (classic ASP + database) concatenates the ECO_ID parameter of
# ECO.asp into its SQL query. Affected: Docusafe 4.2.2 and earlier. The product
# sources are not public; the vector follows the advisory (EDB / BID 45393).
#
# Detection (QoD 75), read-only: the install (/docusafe, /DocuSafe, web root) is
# recognised by the <title>DocuSafe</title> of main.asp, then ECO.asp is requested with
# ECO_ID=1 NOCTIS<random> (a stray word after a number)
# ECO_ID=1'NOCTIS<random> (a stray quote)
# Neither value runs anything: the database only fails to parse the query. The flaw is
# confirmed when the reply carries the parser error quoting the injected word
# (Jet/Access "Syntax error ... in query expression", SQL Server "Incorrect syntax
# near" / "Unclosed quotation mark"). A page that merely echoes the URL has no parser
# message before the word and is not reported.
#
# Ported from OpenVAS/Greenbone NVT 2011/gb_gatesoft_docusafe_sql_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801751, GPL-2.0-only); that check sends
# ECO_ID=' or '1'='1 and looks for "Syntax error" without proving the injected input
# reached the parser — this feed requires the random word echoed inside the error.
# CVSS: NVD carries only a CVSS v2 score (7.5).
uid: fc74d2da-d1ae-4bde-b27e-3296cd783402
name: "GateSoft Docusafe ECO.asp SQL injection (CVE-2010-4736)"
description: |
GateSoft Docusafe, a document management web application written in classic
ASP, places the ECO_ID parameter of ECO.asp into its database query without
validation, so a remote attacker can run arbitrary SQL against the Docusafe
database.
On /docusafe, /DocuSafe and the web root, once main.asp shows the DocuSafe
title, this check requests ECO.asp with an ECO_ID made of a number followed by
a random word, and with a stray quote and a random word. These values only make
the query fail to parse and change nothing. The flaw is confirmed when the reply
shows the database syntax error (Access "in query expression", SQL Server
"Incorrect syntax near" or "Unclosed quotation mark") quoting the random word.
cves: [CVE-2010-4736]
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: [docusafe, gatesoft, document-management, asp, sqli]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2010-4736"
- "http://www.securityfocus.com/bid/45393"
steps:
- id: gen-marker
action: script
code: |
let tok = "NOCTIS" + rand_int(10000000, 99999999);
#{ tok: tok,
re: "(?i)(query expression|incorrect syntax near|unclosed quotation mark)[^<\\r\\n]{0,200}" + tok }
store_as: sc
- id: init-hit
action: set_var
var_name: hit
var_value: ""
- id: init-m
action: set_var
var_name: m
var_value: {status: 0, body: ""}
loop:
var: v
over:
- {d: "/docusafe", pre: "1%20"}
- {d: "/docusafe", pre: "1%27"}
- {d: "/DocuSafe", pre: "1%20"}
- {d: "/DocuSafe", pre: "1%27"}
- {d: "", pre: "1%20"}
- {d: "", pre: "1%27"}
# Identify the install by the title of main.asp
- id: ident
action: http_request
method: GET
path: "{{v.d}}/main.asp"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'hit == ""'
store_as: m
- id: init-r
action: set_var
var_name: r
var_value: {status: 0, body: ""}
- id: probe
action: http_request
method: GET
path: "{{v.d}}/ECO.asp?ECO_ID={{v.pre}}{{sc.tok}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'hit == "" && type_of(m.body) == "string" && ereg("(?i)<title>DocuSafe</title>", m.body)'
store_as: r
- id: check
action: script
condition: 'hit == "" && type_of(m.body) == "string" && ereg("(?i)<title>DocuSafe</title>", m.body)'
code: |
let b = if type_of(r.body) == "string" { r.body } else { "" };
let drv = r.status == 500 || ereg("(?i)80040e14|JET Database Engine|ODBC|OLE DB|SQL Server", b);
if r.status != 0 && drv && ereg(sc.re, b) {
let mm = eregmatch("(?i)(Syntax error[^<\\r\\n]{0,40}?in query expression|Syntax error[^<'\\r\\n]{0,40}|Incorrect syntax near|Unclosed quotation mark)", b);
let what = if type_of(mm) == "array" && mm.len() > 0 { mm[0] } else { "SQL syntax error" };
"ECO.asp ECO_ID: HTTP " + r.status + ", \"" + what + "\" quoting " + sc.tok
} else { "" }
store_as: hit
- id: report
action: match
source: hit
pattern: "ECO\\.asp"
condition: 'hit != ""'
on_match:
finding:
title: "GateSoft Docusafe ECO.asp SQL injection (CVE-2010-4736)"
description: "GateSoft Docusafe passed the ECO_ID parameter of ECO.asp into its database query unvalidated: the injected word reached the SQL parser and came back in its syntax error. An attacker can run arbitrary SQL against the Docusafe database."
remediation: "Upgrade GateSoft Docusafe to a release newer than 4.2.2 that validates ECO_ID and uses parameterised queries, or restrict access to the application."
confidence_delta: 0.50
qod: 75
evidence: "{{hit}}"
stop: true