Monkey Httpd — 1 vulnerability check

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

← All products · Feeds on GitHub

Monkey HTTP Daemon <= 0.6.1 PostMethod() POST Body Buffer Overflow

CVECVE-2003-0218
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Ports2001
Detectiontcp_connect, script, match · highest QoD 70
Feedtests/vulnerabilities/monkey-httpd/CVE-2003-0218.yaml

Monkey HTTP Daemon (monkeyd) 0.6.1 and earlier copies the body of a POST request into a fixed-size buffer in its PostMethod() function without checking its length. A remote unauthenticated attacker who sends a POST request with a large body (about 10 KB) overflows the buffer, which crashes the web server and may let the attacker run code with the daemon's privileges. Version 0.6.2 fixes the flaw.

The test sends one plain `GET / HTTP/1.0` request (over TLS on HTTPS services), reads the `Server:` lines of the response headers and reports the host when it advertises Monkey 0.6.1 or older (`Monkey/0.0` to `Monkey/0.5.x`, `Monkey/0.6.0`, `Monkey/0.6.1`, with or without the ` (Linux)` suffix). Monkey 0.6.2 and later, a versionless `Server: Monkey` header and other servers are not reported. It also runs on TCP port 2001, the daemon's default port, whatever service name the port scan gave it.

This is a version check, on purpose: the only way to confirm the flaw is to send the oversized POST request itself, which would crash the server, so it is never sent. The test only reads the response headers of the home page.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET / HTTP/1.0
  2. Parses / computes the next value with a Rhai script
  3. Checks ver.version for ^0\. → finding QoD 70: Server header '…': Monkey HTTP Daemon … is 0.6.1 or older (PostMethod() overflow via a large POST body; not sent, it would crash the server…

References:

Feed source — tests/vulnerabilities/monkey-httpd/CVE-2003-0218.yaml
# Ported from OpenVAS/Greenbone NASL pre2008/monkeyweb_too_big_post.nasl
# (OID 1.3.6.1.4.1.25623.1.0.11544, GPL-2.0-only). With safe checks on, the NASL
# reports `Server: Monkey/0\.([0-5]\.|6\.[01])`; with safe checks off it POSTs a
# 10000-byte body and reports the server as vulnerable when it stops answering.
#
# The crash request is never sent: it is the exploit itself (a stack overflow
# in PostMethod() that kills monkeyd, and may run code), and no harmless request
# tells 0.6.1 from 0.6.2 apart. So this is the safe-checks version test, QoD 70.
#
# Better than the NASL:
#   - the version bound follows NVD ("0.6.1 and earlier"): 0.0–0.5 with or
#     without a third component (`Monkey/0.5`), 0.6.0 and 0.6.1; the version is
#     bounded on the right, so a hypothetical 0.6.10 or 0.6.1x is not read as 0.6.1;
#   - only `Server:` lines of the response header block are searched (a Monkey
#     string in the page body or another header is ignored), and the product
#     token needs a boundary before it (`BrassMonkey/0.5` is not Monkey);
#   - raw tcp_connect, so a non-conformant reply is still read, and HTTPS
#     services and the default Monkey port 2001 are covered.
# Real header forms (nmap-service-probes): `Server: Monkey/<ver> (Linux)` and
# `Server: Monkey/<ver>`. The versionless `Server: Monkey` / `Monkey Server`
# forms are not reported (no version to compare).
#
# CVSS: NVD only scores this CVE in CVSS v2 (7.5, AV:N/AC:L/Au:N/C:P/I:P/A:P).
# category: rce classifies the bug (overflow with possible code execution);
# the test itself is passive (one GET /) and not tagged intrusive.
uid: 6c9189a0-4fe1-469f-9fcd-3383aa3edc51
name: "Monkey HTTP Daemon <= 0.6.1 PostMethod() POST Body Buffer Overflow (CVE-2003-0218)"
description: |
  Monkey HTTP Daemon (monkeyd) 0.6.1 and earlier copies the body of a POST
  request into a fixed-size buffer in its PostMethod() function without checking
  its length. A remote unauthenticated attacker who sends a POST request with a
  large body (about 10 KB) overflows the buffer, which crashes the web server and
  may let the attacker run code with the daemon's privileges. Version 0.6.2 fixes
  the flaw.

  The test sends one plain `GET / HTTP/1.0` request (over TLS on HTTPS services),
  reads the `Server:` lines of the response headers and reports the host when it
  advertises Monkey 0.6.1 or older (`Monkey/0.0` to `Monkey/0.5.x`, `Monkey/0.6.0`,
  `Monkey/0.6.1`, with or without the ` (Linux)` suffix). Monkey 0.6.2 and later,
  a versionless `Server: Monkey` header and other servers are not reported. It
  also runs on TCP port 2001, the daemon's default port, whatever service name the
  port scan gave it.

  This is a version check, on purpose: the only way to confirm the flaw is to send
  the oversized POST request itself, which would crash the server, so it is never
  sent. The test only reads the response headers of the home page.
cves: [CVE-2003-0218]
cvss: 7.5
severity: high
confidence_base: 0.30
category: rce
tags: [monkey, monkeyd, buffer-overflow, dos, linux, version-check, unauthenticated]
services: [http, https]
ports: [2001]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2003-0218"
  - "http://www.securityfocus.com/bid/7202"
  - "http://marc.info/?l=bugtraq&m=105094204204166&w=2"
  - "http://archives.neohapsis.com/archives/vulnwatch/2003-q2/0029.html"

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 — look for Monkey/<version> in every Server: line of the header block.
  - 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") {
          let line = eregmatch("^server:[ \\t]*([^\\r]*)", raw, true);
          if line.len() < 2 { continue; }
          let m = eregmatch("(^|[^A-Za-z0-9_])Monkey/(0\\.[0-5](\\.[0-9]+)*|0\\.6\\.[01])([^0-9.]|$)", line[1], true);
          if m.len() < 3 { continue; }
          out.vulnerable = true;
          out.version = m[2];
          out.server = line[1];
          break;
        }
      }
      out

  - id: vulnerable_version
    action: match
    condition: "ver.vulnerable == true"
    source: ver.version
    pattern: "^0\\."
    on_match:
      stop: true
      finding:
        confidence_delta: 0.45
        qod: 70
        evidence: "Server header '{{ver.server}}': Monkey HTTP Daemon {{ver.version}} is 0.6.1 or older (PostMethod() overflow via a large POST body; not sent, it would crash the server)."
        remediation: "Upgrade Monkey HTTP Daemon to 0.6.2 or later (current releases are recommended), and restrict access to the web server until it is upgraded."

View these feeds on GitHub