GoAhead — 1 vulnerability check
noctis ships 1 vulnerability check for GoAhead, covering 1 CVE; 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
| CVE | CVE-2017-17562 |
|---|---|
| Severity | high · CVSS 8.1 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | http_request, script, tcp_connect, match · highest QoD 75 |
| Feed | tests/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
- HTTP(S) request
GET / - Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
POST {{cgi}}?LD_TRACE_LOADED_OBJECTS=1 HTTP/1.0, for each of 390 values - Checks
trace.bannerfor(?s)^HTTP/1\.[01] 200 .*=> \S+ \(0x[0-9a-fA-F]+\) - Raw TCP (TLS on HTTPS), sent verbatim:
POST {{cgi}}?LD_DEBUG=help HTTP/1.0 - Checks
dbg.bannerfor(?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) - Checks
trace.bannerfor(?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:
- 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
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