Lil' HTTP Server — 1 vulnerability check

noctis ships 1 vulnerability check for Lil' HTTP Server, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Lil' HTTP Server CGI form demo reflected cross-site scripting

CVECVE-2002-1009
Severityhigh
Categoryxss — XSS
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/lil-http-server/CVE-2002-1009.yaml

Lil' HTTP Server 2.2 and earlier ship a CGI form demo (cgitest.html, posting to /pbcgi.cgi) that copies the "name" and "email" fields back into its reply without encoding them, so an attacker's page can run script in a visitor's browser. The feed first checks that the server identifies itself as LilHTTP in its Server header, then posts the form to /pbcgi.cgi with a random inert tag (a <noctis...> element, not a script) as the name. The finding fires only when the 200 reply contains that tag unescaped. The demo form stores nothing on the server.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET /
  3. HTTP(S) request POST /pbcgi.cgi with a crafted body
  4. Parses / computes the next value with a Rhai script
  5. Checks proof for reflects name= → finding QoD 75: Lil' HTTP Server CGI form demo reflected cross-site scripting (CVE-2002-1009)

References:

Feed source — tests/vulnerabilities/lil-http-server/CVE-2002-1009.yaml
# Lil' HTTP Server <= 2.2 — reflected cross-site scripting in the CGI form demo
# (cgitest.html -> /pbcgi.cgi, 'name' and 'email' fields), CVE-2002-1009.
#
# Ported from OpenVAS/Greenbone NVT `2011/gb_lilhttp_web_server_cgi_form_xss_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.902437, GPL-2.0-only), backlog issue #1737: the
# NASL requires "Server: LilHTTP" in the headers, POSTs name=<script>alert('VT-XSS-TEST')</script>
# to /pbcgi.cgi and looks for the script unescaped in a 200 reply.
# Differences from the NASL: the reflected value is an inert, random
# <noctis...> tag instead of a script (no script is sent) and the
# encoded request body echoed back verbatim does not count.
# CVSS: NVD carries only a CVSS v2 score (7.5 in the issue is the v2 value; no v3.x
# score exists), so cvss is omitted.
uid: 0e7fdd32-8120-42d3-8db0-7bc1b464d494
name: "Lil' HTTP Server CGI form demo reflected cross-site scripting (CVE-2002-1009)"
description: |
  Lil' HTTP Server 2.2 and earlier ship a CGI form demo (cgitest.html, posting
  to /pbcgi.cgi) that copies the "name" and "email" fields back into its reply
  without encoding them, so an attacker's page can run script in a visitor's
  browser. The feed first checks that the server identifies itself as LilHTTP
  in its Server header, then posts the form to /pbcgi.cgi with a random inert
  tag (a <noctis...> element, not a script) as the name. The finding fires
  only when the 200 reply contains that tag unescaped. The demo form stores
  nothing on the server.
cves: [CVE-2002-1009]
severity: high
category: xss
confidence_base: 0.30
tags: [lilhttp, lil-http-server, cgi, xss]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2002-1009"

steps:
  - id: marker
    action: script
    code: |
      "noctis" + oob_token.sub_string(0, 8) + oob_token.sub_string(9, 4)
    store_as: tok

  - id: init-probe
    action: set_var
    var_name: probe
    var_value: {status: 0, body: "", headers: {}}

  - id: init-post
    action: set_var
    var_name: post
    var_value: {status: 0, body: "", headers: {}}

  - id: banner
    action: http_request
    method: GET
    path: "/"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 8
    store_as: probe

  - id: post-form
    action: http_request
    method: POST
    path: "/pbcgi.cgi"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 8
    condition: 'probe.status > 0 && type_of(probe.headers) == "map" && "server" in probe.headers && type_of(probe.headers["server"]) == "string" && stridx(probe.headers["server"], "LilHTTP") >= 0'
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "name=%3C{{tok}}%3E&email="
    store_as: post

  - id: reflection
    action: script
    condition: "post.status == 200"
    code: |
      let out = "";
      if type_of(post.body) == "string" && stridx(post.body, "<" + tok + ">") >= 0 {
        out = "/pbcgi.cgi reflects name=<" + tok + "> unescaped";
      }
      out
    store_as: proof

  - id: report
    action: match
    source: proof
    pattern: "reflects name="
    condition: 'post.status == 200 && type_of(proof) == "string"'
    on_match:
      finding:
        title: "Lil' HTTP Server CGI form demo reflected cross-site scripting (CVE-2002-1009)"
        description: "The LilHTTP server's CGI form demo (/pbcgi.cgi) copies the posted name field into its reply without encoding it, so a crafted form post can run script in a visitor's browser. An inert random tag was reflected unescaped."
        remediation: "Remove the CGI form demo (cgitest.html and pbcgi.cgi) from the server, or move to a maintained web server: Lil' HTTP Server is no longer developed."
        confidence_delta: 0.45
        qod: 75
        evidence: "{{proof}}"

View these feeds on GitHub