AVTECH — 1 vulnerability check

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

← All products · Feeds on GitHub

AVTECH DVR Login CAPTCHA Bypass

CVECVE-2013-4982
Severitycritical · CVSS 9.8
Categoryauth-bypass — Auth bypass
Serviceshttp, https
Detectionset_var, script, http_request, match · highest QoD 75
Feedtests/vulnerabilities/avtech/avtech-dvr-captcha-bypass.yaml

AVTECH DVRs (AVN801 firmware 1017-1003-1009-1003 and earlier, and related models) protect the web login with a CAPTCHA that can be bypassed (CVE-2013-4982): the device picks its CAPTCHA from a small hard-coded set and trusts the token the browser sends back with the answer, so a pair solved once (answer FMUF for token FMUYyLOivRpgc) is accepted on every login, and adding "login=quick" to the request skips the CAPTCHA entirely. Both let an attacker brute-force the administration password at full speed. The check sends /cgi-bin/nobody/VerifyCode.cgi a random, non-existent account with the wrong answer FMUA (the device must reject the CAPTCHA), then the same account with the replayed answer FMUF, and with login=quick. A reply from the credential check (status -35, wrong user name or password) instead of the CAPTCHA error proves the bypass. No real account is logged in to. The same firmware has two buffer overflows (CVE-2013-4980 in the RTSP server, CVE-2013-4981 in Config.cgi) that are not tested because they crash the device.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET /cgi-bin/nobody/VerifyCode.cgi?account={{acct}}&captcha_code=FMUA&verify_code=FMUYyLO…
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET /cgi-bin/nobody/VerifyCode.cgi?account={{acct}}&captcha_code=FMUF&verify_code=FMUYyLO…
  5. Parses / computes the next value with a Rhai script
  6. Checks replay_verdict for ^status → finding QoD 75: AVTECH DVR Login CAPTCHA Bypass — Replayed Hard-Coded CAPTCHA (CVE-2013-4982)
  7. HTTP(S) request GET /cgi-bin/nobody/VerifyCode.cgi?account={{acct}}&login=quick
  8. Parses / computes the next value with a Rhai script
  9. Checks quick_verdict for ^status → finding QoD 75: AVTECH DVR Login CAPTCHA Bypass — login=quick

References:

Feed source — tests/vulnerabilities/avtech/avtech-dvr-captcha-bypass.yaml
# AVTECH DVR (AVN801, firmware 1017-1003-1009-1003 and earlier) — login
# CAPTCHA bypass (CVE-2013-4982). The device draws its CAPTCHA from a small
# hard-coded set and validates the answer (captcha_code) against a token the
# client sends back (verify_code), so a once-solved pair (FMUF /
# FMUYyLOivRpgc, advisory CORE-2013-0726) is accepted forever; the
# "login=quick" parameter skips the CAPTCHA altogether (SEARCH-LAB 2016).
# The same advisory covers two pre-auth buffer overflows, CVE-2013-4980 (RTSP
# SETUP URI) and CVE-2013-4981 (Config.cgi Network.SMTP.Receivers), that are
# not probed here (their only trigger crashes the device), so they are not
# listed in cves: either. Vendor never
# answered: no fixed firmware exists.
#
# Ported from OpenVAS/Greenbone NVT 2013/gb_avtech_dvr_multiple_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.803768, GPL-2.0-only): needs "Server: ...Avtech";
# GET //cgi-bin/nobody/VerifyCode.cgi?account=base64(admin:admin)&
# captcha_code=FMUA&verify_code=FMUYyLOivRpgc must contain "ERROR: Verify Code
# is incorrect", then captcha_code=FMUF must answer "0 OK" + Set-Cookie SSID.
#
# Deviations from the NASL (stronger detection, stated in the PR):
#   * No default-credential login: the NASL only reports a device whose admin
#     password is still admin, so it misses every device with a changed
#     password, and it logs in for real. The feed sends a random, non-existent
#     account instead: the bypass is proven when the replayed CAPTCHA pair gets
#     past the CAPTCHA check to the credential check (status line -35 = bad
#     credentials, or 0 = OK, the only reply codes on record, exploit-db 40500;
#     any other error such as an expired session is not counted), after the wrong answer FMUA was
#     rejected on the same token. No account is logged in to or locked out.
#   * Second bypass: login=quick (CAPTCHA skipped), same control.
#   * No Server-header gate: the wrong-answer control's exact CAPTCHA error is
#     the product fingerprint, so a device behind a header-rewriting proxy is
#     not missed. A login CGI with no CAPTCHA at all never answers the control
#     with that error, so it is not reported.
#
# CVSS: NVD scores CVE-2013-4982 (the flaw proven) at 9.8 (v3.1); the
# issue's 5.0 is the Nuclei template's CVSS v2.
uid: 89cd313b-5b63-48c4-a9ee-9becab0940c4
name: "AVTECH DVR Login CAPTCHA Bypass"
description: |
  AVTECH DVRs (AVN801 firmware 1017-1003-1009-1003 and earlier, and related
  models) protect the web login with a CAPTCHA that can be bypassed
  (CVE-2013-4982): the device picks its CAPTCHA from a small hard-coded set
  and trusts the token the browser sends back with the answer, so a pair
  solved once (answer FMUF for token FMUYyLOivRpgc) is accepted on every
  login, and adding "login=quick" to the request skips the CAPTCHA entirely.
  Both let an attacker brute-force the administration password at full speed.
  The check sends /cgi-bin/nobody/VerifyCode.cgi a random, non-existent
  account with the wrong answer FMUA (the device must reject the CAPTCHA),
  then the same account with the replayed answer FMUF, and with login=quick.
  A reply from the credential check (status -35, wrong user name or password)
  instead of the CAPTCHA error proves the bypass. No real account is logged in to.
  The same firmware has two buffer overflows (CVE-2013-4980 in the RTSP
  server, CVE-2013-4981 in Config.cgi) that are not tested because they crash
  the device.
cves: [CVE-2013-4982]
cvss: 9.8
severity: critical
category: auth-bypass
confidence_base: 0.30
tags: [openvas-migrated, avtech, dvr, iot, captcha, auth-bypass, http]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://www.cve.org/CVERecord?id=CVE-2013-4980"
  - "https://www.cve.org/CVERecord?id=CVE-2013-4981"
  - "https://www.cve.org/CVERecord?id=CVE-2013-4982"
  - "https://seclists.org/fulldisclosure/2013/Aug/284"
  - "https://www.exploit-db.com/exploits/27942"
  - "https://www.exploit-db.com/exploits/40500"
  - "OpenVAS/Greenbone NASL 2013/gb_avtech_dvr_multiple_vuln.nasl (GPL-2.0-only)"

steps:
  # Pre-init everything later conditions/scripts read, so a failed request
  # never leaves an undefined variable behind.
  - id: init-ctrl-ok
    action: set_var
    var_name: ctrl_ok
    var_value: false
  - id: init-ctrl
    action: set_var
    var_name: ctrl
    var_value: {status: 0, body: ""}
  - id: init-replay
    action: set_var
    var_name: replay
    var_value: {status: 0, body: ""}
  - id: init-quick
    action: set_var
    var_name: quick
    var_value: {status: 0, body: ""}
  - id: init-replay-verdict
    action: set_var
    var_name: replay_verdict
    var_value: "none"
  - id: init-quick-verdict
    action: set_var
    var_name: quick_verdict
    var_value: "none"

  # Random account that cannot exist; no padding, '+' or '/' in its base64
  # so it travels unencoded in the query string, as the device expects.
  - id: account
    action: script
    code: |
      let a = "";
      loop {
        a = base64_encode("nx" + rand_hex(5) + ":" + rand_hex(7));
        if stridx(a, "+") < 0 && stridx(a, "/") < 0 { break; }
      }
      a
    store_as: acct

  # 1. Control — wrong answer on the hard-coded token: the CAPTCHA must be
  #    enforced and rejected with the device's own error.
  - id: control
    action: http_request
    method: GET
    port: "{{port}}"
    path: "/cgi-bin/nobody/VerifyCode.cgi?account={{acct}}&captcha_code=FMUA&verify_code=FMUYyLOivRpgc"
    tls_insecure: true
    store_as: ctrl
  - id: control-check
    action: script
    code: 'type_of(ctrl.body) == "string" && stridx(ctrl.body, "Verify Code is incorrect") >= 0'
    store_as: ctrl_ok

  # 2. Replayed hard-coded pair (CORE-2013-0726).
  - id: replay
    action: http_request
    method: GET
    port: "{{port}}"
    path: "/cgi-bin/nobody/VerifyCode.cgi?account={{acct}}&captcha_code=FMUF&verify_code=FMUYyLOivRpgc"
    tls_insecure: true
    store_as: replay
    condition: "ctrl_ok"
  - id: replay-check
    action: script
    code: |
      let b = replay.body;
      if type_of(b) == "string" && replay.status == 200
         && ereg("^(-35|0)\r?\n", b) && stridx(b, "Verify Code") < 0 {
        "status " + chomp(substr(ereg_replace("[\r\n]+", " ", b), 0, 79))
      } else { "none" }
    store_as: replay_verdict
    condition: "ctrl_ok"
  - id: detect-replay
    action: match
    source: replay_verdict
    pattern: '^status '
    condition: "ctrl_ok"
    on_match:
      finding:
        cves: [CVE-2013-4982]
        title: "AVTECH DVR Login CAPTCHA Bypass — Replayed Hard-Coded CAPTCHA (CVE-2013-4982)"
        confidence_delta: 0.50
        qod: 75
        evidence: "GET /cgi-bin/nobody/VerifyCode.cgi with a random account and verify_code=FMUYyLOivRpgc: captcha_code=FMUA was rejected (\"Verify Code is incorrect\"), the replayed captcha_code=FMUF got past the CAPTCHA to the credential check ({{replay_verdict}})"
        remediation: "No fixed firmware exists. Keep the DVR web interface off untrusted networks (VPN or firewall allow-list), use a strong unique admin password, or replace the device."

  # 3. login=quick skips the CAPTCHA (SEARCH-LAB 2016).
  - id: quick
    action: http_request
    method: GET
    port: "{{port}}"
    path: "/cgi-bin/nobody/VerifyCode.cgi?account={{acct}}&login=quick"
    tls_insecure: true
    store_as: quick
    condition: "ctrl_ok"
  - id: quick-check
    action: script
    code: |
      let b = quick.body;
      if type_of(b) == "string" && quick.status == 200
         && ereg("^(-35|0)\r?\n", b) && stridx(b, "Verify Code") < 0 {
        "status " + chomp(substr(ereg_replace("[\r\n]+", " ", b), 0, 79))
      } else { "none" }
    store_as: quick_verdict
    condition: "ctrl_ok"
  - id: detect-quick
    action: match
    source: quick_verdict
    pattern: '^status '
    condition: "ctrl_ok"
    on_match:
      finding:
        cves: [CVE-2013-4982]
        title: "AVTECH DVR Login CAPTCHA Bypass — login=quick"
        confidence_delta: 0.50
        qod: 75
        evidence: "GET /cgi-bin/nobody/VerifyCode.cgi with a random account: a wrong CAPTCHA answer was rejected (\"Verify Code is incorrect\"), the same account with login=quick and no CAPTCHA reached the credential check ({{quick_verdict}})"
        remediation: "No fixed firmware exists. Keep the DVR web interface off untrusted networks (VPN or firewall allow-list), use a strong unique admin password, or replace the device."

View these feeds on GitHub