CoreHTTP — 1 vulnerability check
noctis ships 1 vulnerability check for CoreHTTP, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
CoreHTTP <= 0.5.3.1 Request Line Off-by-One Buffer Overflow
| CVE | CVE-2009-3586 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | tcp_connect, script, match · highest QoD 70 |
| Feed | tests/vulnerabilities/corehttp/CVE-2009-3586.yaml |
CoreHTTP, a small single-process HTTP server, parses the request line in `HttpSprockMake()` (`src/http.c`) with `sscanf("%256[A-Za-z] %256s")` into 256-byte buffers, so a request whose method or URL is 256 characters long writes one byte past the end of the stack buffer. A remote unauthenticated attacker can crash the server with a long first request line and possibly run code. Every release up to and including 0.5.3.1 (the last one) is affected.
The test sends one plain `GET / HTTP/1.0` request (over TLS on HTTPS services), reads the `Server:` response header and reports the host when it advertises CoreHTTP 0.5.3.1 or older (`corehttp-0.5.3.1`, `corehttp-0.5.3`, `corehttp-0.3.9.2`, ...). Other servers, and a CoreHTTP string appearing only in the page body, are not reported.
This is a version check, on purpose: the only way to confirm the flaw is to send the overflowing request, which can crash the server, so it is never sent. The test only reads the response headers of the home page.
How noctis detects it
- Raw TCP (TLS on HTTPS), sent verbatim:
GET / HTTP/1.0 - Parses / computes the next value with a Rhai script
- Checks
ver.versionfor^[0-9]→ finding QoD 70: Server header '…': CoreHTTP … is 0.5.3.1 or older (off-by-one overflow on a 256-character request line; not sent, it can crash the server).
References:
- https://nvd.nist.gov/vuln/detail/CVE-2009-3586
- http://www.securityfocus.com/bid/37237
- https://sourceforge.net/projects/corehttp/
Feed source — tests/vulnerabilities/corehttp/CVE-2009-3586.yaml
# Ported from OpenVAS/Greenbone NASL 2009/CoreHTTP_37237.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100377, GPL-2.0-only). In safe-checks mode the NASL
# reports `Server: corehttp-0.5.3.1` exactly; otherwise it sends a 400-byte
# request line and reports the host when the server dies — a denial of service
# that this feed never reproduces.
#
# Better than the NASL: every CoreHTTP release up to 0.5.3.1 is reported, not only
# 0.5.3.1 (NVD: "0.5.3.1 and earlier"; the off-by-one is the incomplete fix of the
# same HttpSprockMake() overflow, CVE-2007-4060, so the older releases are just as
# exposed), the version is compared numerically, only Server: lines of the header
# block are read (a corehttp string in the body is ignored), and HTTPS services
# are covered.
#
# Upstream facts (SourceForge corehttp tarballs 0.3.9.2, 0.5.3, 0.5.3.1):
# src/common.h `#define VERSION "corehttp-0.5.3.1"`, every reply carries
# `Server: " VERSION "`; src/http.c sscanf("%256[A-Za-z] %256s") into
# char req[256]/url[256] writes the 257th NUL byte past the buffer. 0.5.3.1 is
# the last release — there is no fixed version.
uid: 0c32a86f-036c-4b4b-b252-b2f41ed900f2
name: "CoreHTTP <= 0.5.3.1 Request Line Off-by-One Buffer Overflow (CVE-2009-3586)"
description: |
CoreHTTP, a small single-process HTTP server, parses the request line in
`HttpSprockMake()` (`src/http.c`) with `sscanf("%256[A-Za-z] %256s")` into
256-byte buffers, so a request whose method or URL is 256 characters long
writes one byte past the end of the stack buffer. A remote unauthenticated
attacker can crash the server with a long first request line and possibly run
code. Every release up to and including 0.5.3.1 (the last one) is affected.
The test sends one plain `GET / HTTP/1.0` request (over TLS on HTTPS services),
reads the `Server:` response header and reports the host when it advertises
CoreHTTP 0.5.3.1 or older (`corehttp-0.5.3.1`, `corehttp-0.5.3`,
`corehttp-0.3.9.2`, ...). Other servers, and a CoreHTTP string appearing only
in the page body, are not reported.
This is a version check, on purpose: the only way to confirm the flaw is to send
the overflowing request, which can crash the server, so it is never sent. The
test only reads the response headers of the home page.
cves: [CVE-2009-3586]
cvss: 7.5
severity: high
confidence_base: 0.30
category: rce
tags: [corehttp, buffer-overflow, dos, version-check, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2009-3586"
- "http://www.securityfocus.com/bid/37237"
- "https://sourceforge.net/projects/corehttp/"
steps:
# 1 — one plain request; only its response headers are used.
- id: probe
action: tcp_connect
port: "{{port}}"
send: "GET / HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
timeout_secs: 10
store_as: resp
# 2 — check every Server: header of the header block and compare the version
# with the last (still vulnerable) release 0.5.3.1, part by part.
- id: version
action: script
store_as: ver
code: |
let out = #{ vulnerable: false, version: "", server: "" };
if type_of(resp.banner) == "string" {
let head = resp.banner;
let cut = stridx(head, "\r\n\r\n");
if cut < 0 { cut = stridx(head, "\n\n"); }
if cut >= 0 { head = substr(head, 0, cut); }
for raw in split(head, "\n") {
if out.vulnerable { break; }
let line = eregmatch("^server:[ \\t]*([^\\r]*)", raw, true);
if line.len() < 2 { continue; }
let m = eregmatch("(^|[^a-z0-9])corehttp-([0-9]{1,6}(\\.[0-9]{1,6})*)", line[1], true);
if m.len() < 3 { continue; }
let parts = split(m[2], ".");
let last = [0, 5, 3, 1];
let vuln = true;
for i in 0..4 {
let n = if i < parts.len() { int(parts[i]) } else { 0 };
if n < last[i] { break; }
if n > last[i] { vuln = false; break; }
}
if vuln {
out.vulnerable = true;
out.version = m[2];
out.server = line[1];
}
}
}
out
- id: vulnerable_version
action: match
condition: "ver.vulnerable == true"
source: ver.version
pattern: "^[0-9]"
on_match:
stop: true
finding:
confidence_delta: 0.45
qod: 70
evidence: "Server header '{{ver.server}}': CoreHTTP {{ver.version}} is 0.5.3.1 or older (off-by-one overflow on a 256-character request line; not sent, it can crash the server)."
remediation: "CoreHTTP is unmaintained and 0.5.3.1 is its last release, so no fixed version exists: replace it with a maintained web server, or restrict network access to it."