FoxWeb — 1 vulnerability check

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

← All products · Feeds on GitHub

FoxWeb foxweb.exe / foxweb.dll PATH_INFO buffer overflow

CVECVE-2003-0762
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 70
Feedtests/vulnerabilities/foxweb/CVE-2003-0762.yaml

Detects the FoxWeb gateway programs foxweb.exe (CGI) and foxweb.dll (ISAPI extension), which run Visual FoxPro applications behind a web server. FoxWeb 2.5 copies an overlong PATH_INFO (over 3000 bytes) into a fixed stack buffer, which lets an unauthenticated remote attacker run code with the rights of the web server (CVE-2003-0762). The test requests foxweb.exe and foxweb.dll under the web root, /cgi-bin and /scripts, and reports one that answers with HTTP 200 with a page (not a file download) while a random name with the same extension in the same directory is refused with a 4xx status (so servers that answer every path are not reported). The long PATH_INFO is never sent; the vendor patch kept the program names, so a patched gateway is reported too and its version must be checked against the vendor's fix.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{loc.dir}}/{{loc.file}}
  3. HTTP(S) request GET {{loc.dir}}/{{ctl}}.{{loc.ext}}
  4. Parses / computes the next value with a Rhai script
  5. Checks verdict for ^FOXWEB_PROGRAM_PRESENT$ → finding QoD 70: FoxWeb … present — CVE-2003-0762

References:

Feed source — tests/vulnerabilities/foxweb/CVE-2003-0762.yaml
# Aksel Software FoxWeb 2.5 — foxweb.exe (CGI) / foxweb.dll (ISAPI) PATH_INFO
# stack buffer overflow (CVE-2003-0762, SCAN Associates advisory 2003-09-05,
# VulnWatch 2003-q3/95, EDB-23102)
#
# Credit: target files adapted from Greenbone's `pre2008/foxweb_dll.nasl`
# (GPL-2.0-only), which reports when /foxweb.dll or /foxweb.exe is installed
# (http_is_cgi_installed_ka) under / and the CGI directories.
#
# Advisory facts: FoxWeb, a gateway that runs Visual FoxPro programs behind a
# web server, ships as a CGI (foxweb.exe) and an ISAPI extension (foxweb.dll).
# In FoxWeb 2.5 both copy an overlong PATH_INFO (over 3000 bytes, e.g.
# /scripts/foxweb.dll/AAAA…) into a fixed stack buffer, so a remote,
# unauthenticated attacker runs code as the web server user. The vendor
# shipped a patch; the advisory names no fixed version and the patched
# gateway keeps the same file names.
#
# Why no exploitation proof: the only trigger is the overflow itself, which
# crashes the web server process (ISAPI runs inside IIS) or runs attacker
# code. No benign request tells 2.5 from a patched gateway and the advisory
# documents no version disclosure, so this is a presence check at QoD 70.
#
# Better than the reference check:
#  - a random sibling name with the same extension in the same directory is
#    requested as a control and must be refused with a 4xx status, so
#    catch-all / soft-404 servers that answer 200 for any name are not
#    reported; a control that gets no reply gives no finding (fail-closed);
#  - a 200 that is a file download (binary content type or a body starting
#    with "MZ") is not reported: an installer mirror, or a directory without
#    execute permission that serves the binary instead of running it;
#  - the long PATH_INFO is never sent.
uid: 9cdf4637-25fb-42bf-a744-ab8bc814b637
name: "FoxWeb foxweb.exe / foxweb.dll PATH_INFO buffer overflow (CVE-2003-0762)"
description: |
  Detects the FoxWeb gateway programs foxweb.exe (CGI) and foxweb.dll (ISAPI
  extension), which run Visual FoxPro applications behind a web server.
  FoxWeb 2.5 copies an overlong PATH_INFO (over 3000 bytes) into a fixed stack
  buffer, which lets an unauthenticated remote attacker run code with the
  rights of the web server (CVE-2003-0762). The test requests foxweb.exe and
  foxweb.dll under the web root, /cgi-bin and /scripts, and reports one that
  answers with HTTP 200 with a page (not a file download) while a random name with the same extension in the
  same directory is refused with a 4xx status (so servers that answer every
  path are not reported). The long PATH_INFO is never sent; the vendor patch
  kept the program names, so a patched gateway is reported too and its
  version must be checked against the vendor's fix.
cves: [CVE-2003-0762]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [foxweb, visual-foxpro, cgi, isapi, buffer-overflow, rce]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2003-0762"
  - "https://seclists.org/vulnwatch/2003/q3/95"
  - "https://www.exploit-db.com/exploits/23102"

steps:
  # Random sibling name for the soft-404 control, shared by every location.
  - id: mint-control
    action: script
    code: '"noctis" + rand_hex(8)'
    store_as: ctl

  # ── Per location: 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: {status: 0}
    loop:
      over:
        - {dir: "", file: "foxweb.dll", ext: "dll"}
        - {dir: "", file: "foxweb.exe", ext: "exe"}
        - {dir: "/cgi-bin", file: "foxweb.dll", ext: "dll"}
        - {dir: "/cgi-bin", file: "foxweb.exe", ext: "exe"}
        - {dir: "/scripts", file: "foxweb.dll", ext: "dll"}
        - {dir: "/scripts", file: "foxweb.exe", ext: "exe"}
      var: loc

  - id: init-control
    action: set_var
    var_name: control
    var_value: {status: 0}

  - id: probe-program
    action: http_request
    method: GET
    path: "{{loc.dir}}/{{loc.file}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: page

  - id: probe-control
    action: http_request
    method: GET
    path: "{{loc.dir}}/{{ctl}}.{{loc.ext}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "page.status == 200"
    store_as: control

  # Fixed verdict string as the match source, so no page content reaches the
  # finding.
  - id: verdict
    action: script
    code: |
      let v = "";
      // A gateway that runs answers with a page; a file the server only hands
      // out (installer mirror, directory without execute permission) is a
      // download: binary content type or the "MZ" header of a Windows binary.
      let download = false;
      if page.status == 200 {
        let ct = "";
        if "content-type" in page.headers { ct = tolower(page.headers["content-type"]); }
        download = ct.contains("octet-stream") || ct.contains("msdownload") || ct.contains("msdos-program") || ct.contains("x-dosexec") || page.body.starts_with("MZ");
      }
      if page.status == 200 && !download && control.status >= 400 && control.status < 500 { v = "FOXWEB_PROGRAM_PRESENT"; }
      v
    store_as: verdict

  - id: program-present
    action: match
    source: verdict
    pattern: '^FOXWEB_PROGRAM_PRESENT$'
    on_match:
      finding:
        title: "FoxWeb {{loc.file}} present — CVE-2003-0762"
        description: "{{loc.dir}}/{{loc.file}} of the FoxWeb gateway answered, while a random .{{loc.ext}} name in the same directory was refused. FoxWeb 2.5 overflows a stack buffer when foxweb.exe or foxweb.dll is called with an overlong PATH_INFO, letting an unauthenticated attacker run code as the web server (CVE-2003-0762). The overflow was not sent, so a gateway carrying the vendor patch cannot be told apart."
        remediation: "Upgrade FoxWeb past 2.5 or apply the vendor's patch for foxweb.exe and foxweb.dll, or remove both programs from the web server. Restrict the URL length the web server accepts (for example IIS URLScan / request filtering MaxUrl) as a stopgap."
        confidence_delta: 0.40
        qod: 70
        evidence: "GET {{loc.dir}}/{{loc.file}} returned HTTP {{page.status}}; control GET {{loc.dir}}/{{ctl}}.{{loc.ext}} returned HTTP {{control.status}}"
      stop: true

View these feeds on GitHub