MiniShare — 1 vulnerability check
noctis ships 1 vulnerability check for MiniShare, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
MiniShare <= 1.4.1 HTTP GET request buffer overflow
| CVE | CVE-2004-2271 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | tcp_connect, script, match · highest QoD 70 |
| Feed | tests/vulnerabilities/minishare/CVE-2004-2271.yaml |
MiniShare is a small Windows HTTP file-sharing server. Versions 1.4.1 and older copy the first line of each HTTP request into fixed-size stack buffers without a length check, so a remote unauthenticated attacker who sends a GET request with a long path overflows them and can run arbitrary code on the host or crash the server. MiniShare 1.4.2 limits the request line length.
The test sends one plain `GET /` request (over TLS on HTTPS services) and reads the file-list page MiniShare serves there. It reports the host when the page footer, `<p class="versioninfo">` with the link to minishare.sourceforge.net, names MiniShare 1.4.1 or older (1.0 to 1.3.x, 1.4.0, 1.4.1, preview builds included). The page title is not used, since the server name shown there can be changed by the owner. Version 1.4.2 and later and other web servers are not reported.
This is a version check, on purpose: the only way to confirm the flaw is to send the overflowing request, which would crash the server or corrupt its memory, so it is never sent.
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^1\.([0-3]\.[0-9]|4\.[01])→ finding QoD 70: File-list page footer names MiniShare … (1.4.1 or older: the request line is copied into fixed-size stack buffers without a length check; t…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2004-2271
- https://www.exploit-db.com/exploits/616
- https://sourceforge.net/projects/minishare/files/OldFiles/
Feed source — tests/vulnerabilities/minishare/CVE-2004-2271.yaml
# Ported from OpenVAS/Greenbone NASL pre2008/minishare_overflow.nasl
# (OID 1.3.6.1.4.1.25623.1.0.18424, GPL-2.0-only), which fetches "/", requires
# `<title>MiniShare</title>` and reports a versioninfo footer naming MiniShare
# 1.3.4 to 1.3.99 or 1.4.0 / 1.4.1.
#
# Better than the NASL, from the MiniShare sources (SourceForge OldFiles
# minishare-<v>-src.zip, 1.3.0 to 1.4.2): every release up to 1.4.1 copies the
# request line into fixed stack buffers without a length check —
# - 1.3.x serve(): the first line of a read of up to 4000 bytes goes into
# `char bufi[1024]` byte by byte;
# - 1.4.0/1.4.1 serve2() (default engine): the whole request line (up to 8192
# bytes) goes to addtolog(), which sprintf()s it into `char tmp[1800]` (logging
# is on by default: `log=log.txt`), then `strcpy(cons->request, req.path)` into
# `request[513]`.
# 1.4.2 cuts the request line at 1024 bytes and bounds the sscanf, so it is not
# reported (its optional `use_old_engine` mode still has the 1.3.x copy; not
# detectable from the page). So the scope is NVD's "1.4.1 and earlier", wider
# than the NASL, which only flags 1.3.4 and later.
# - The `<title>` is the configurable `servername=` setting; the footer (fixed
# text, link to minishare.sourceforge.net) is used alone, so a renamed server
# is still found. Preview builds ("MiniShare 1.4.1 preview (<date>)", 1.3.4
# "PREVIEW (<date>)") match.
# - The footer is the last thing on the page; a very large share list on a slow
# link may not arrive within the read window (missed host, never a FP).
#
# No benign proof exists: the only trigger is the overflow itself (a GET with a
# long path), which crashes or hijacks the server. It is never sent; this is a
# version check (QoD 70).
uid: 5b48e9fe-2c01-451c-9c0c-8a42e2947d49
name: "MiniShare <= 1.4.1 HTTP GET request buffer overflow (CVE-2004-2271)"
description: |
MiniShare is a small Windows HTTP file-sharing server. Versions 1.4.1 and
older copy the first line of each HTTP request into fixed-size stack buffers
without a length check, so a remote unauthenticated attacker who sends a GET
request with a long path overflows them and can run arbitrary code on the host
or crash the server. MiniShare 1.4.2 limits the request line length.
The test sends one plain `GET /` request (over TLS on HTTPS services) and reads
the file-list page MiniShare serves there. It reports the host when the page
footer, `<p class="versioninfo">` with the link to minishare.sourceforge.net,
names MiniShare 1.4.1 or older (1.0 to 1.3.x, 1.4.0, 1.4.1, preview builds
included). The page title is not used, since the server name shown there can
be changed by the owner. Version 1.4.2 and later and other web servers are not
reported.
This is a version check, on purpose: the only way to confirm the flaw is to
send the overflowing request, which would crash the server or corrupt its
memory, so it is never sent.
cves: [CVE-2004-2271]
cvss: 7.5
severity: high
confidence_base: 0.30
category: rce
tags: [minishare, windows, file-sharing, buffer-overflow, version-check, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2004-2271"
- "https://www.exploit-db.com/exploits/616"
- "https://sourceforge.net/projects/minishare/files/OldFiles/"
steps:
# 1 — the file-list page; MiniShare's default share page is "/". Raw socket:
# MiniShare answers without Content-Length and ends the body by closing the
# connection, which an HTTP client over TLS can reject as a truncated body.
- 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 — 200 reply, then the version from the versioninfo footer only (a version
# string anywhere else in the page, such as the owner's message, is ignored).
- id: version
action: script
condition: "resp.connected == true"
store_as: ver
code: |
let out = #{ vulnerable: false, version: "" };
if type_of(resp.banner) == "string" && ereg("^HTTP/1\\.[01] 200", resp.banner) {
let m = eregmatch("<p class=\"versioninfo\"><a href=\"https?://minishare\\.sourceforge\\.net/?\">MiniShare (1\\.[0-3]\\.[0-9]+|1\\.4\\.[01])( [^<]*)?</a>", resp.banner);
if m.len() >= 2 {
out.vulnerable = true;
out.version = m[1];
if m.len() >= 3 && type_of(m[2]) == "string" { out.version += m[2]; }
}
}
out
- id: vulnerable_version
action: match
condition: "resp.connected == true && ver.vulnerable == true"
source: ver.version
pattern: "^1\\.([0-3]\\.[0-9]|4\\.[01])"
on_match:
stop: true
finding:
confidence_delta: 0.45
qod: 70
evidence: "File-list page footer names MiniShare {{ver.version}} (1.4.1 or older: the request line is copied into fixed-size stack buffers without a length check; the overflowing request is not sent)."
remediation: "Upgrade MiniShare to 1.4.2 or later, or stop the server and restrict access to it until it is upgraded."