Skip to main content
Mallory
CriticalExploited in the wildCISA KEVPublic exploitVulnerability

CVE-2022-40684: Administrative Authentication Bypass in Fortinet FortiOS, FortiProxy, and FortiSwitchManager

Published Oct 18, 2022 · Updated 8 days ago
Trending this weekNot trendingOutside this week’s top 100
Mention activity · 30 days3 mentions · peak 1 in a dayToday
CVSS9.8Critical · v3.1
EPSS98.9%100th percentile
CISA KEVYesAdded Oct 11, 2022
In the wildActivePer CISA KEV
Vendor
Fortinet
IdentifiersCVE-2022-40684CWE-288

CVE-2022-40684 is an authentication bypass using an alternate path or channel in the HTTP/HTTPS administrative interfaces of Fortinet FortiOS, FortiProxy, and FortiSwitchManager. The administrative REST API incorrectly trusts attacker-controlled request attributes, allowing specially crafted requests to impersonate trusted local management traffic and perform administrative operations without authentication. Affected releases are FortiOS 7.2.0–7.2.1 and 7.0.0–7.0.6; FortiProxy 7.2.0 and 7.0.0–7.0.6; and FortiSwitchManager 7.2.0 and 7.0.0. Exploitation can disclose device configurations, modify administrator accounts and SSH keys, and alter network settings. The vulnerability was disclosed in October 2022 and has been exploited in the wild.

Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Analyst brief

Impact, mitigation & remediation

What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.

Impact

What an attacker gets, and what they’ve been doing with it.

Successful exploitation compromises administrative control and the confidentiality and integrity of affected appliances. Attackers can download configurations containing sensitive network information and credentials, create privileged local accounts, modify administrator SSH keys, reroute traffic through configuration changes, and initiate packet captures. Confirmed exploitation includes configuration downloads and creation of a malicious super-administrator account. Exposed VPN credentials and site-to-site tunnel configurations can facilitate subsequent access to connected networks, depending on configuration and credential validity. Patching does not invalidate previously stolen secrets or remove attacker-created accounts.

Mitigation

If you can’t patch tonight, do this now.

Until patched, disable HTTP/HTTPS administrative access. Alternatively, restrict management reachability to explicitly trusted sources. For FortiOS, use source-address groups and local-in policies that permit trusted sources and deny other HTTP/HTTPS management traffic; configure matching custom service objects for nondefault management ports. HA reserved management interfaces require the vendor-specific local-in policy configuration. For FortiProxy VMs of all versions, or appliances running 7.0.6, Fortinet provides an alternative involving a dedicated management interface and trusted source IP/subnet restrictions. For FortiSwitchManager, the documented workaround is disabling HTTP/HTTPS administrative access. Monitor administrative activity and inspect accounts and SSH keys for unauthorized changes. MFA alone does not remediate this unauthenticated administrative API bypass.

Remediation

Patch, then assume compromise.

Upgrade FortiOS 7.2.0–7.2.1 to 7.2.2 or later, and FortiOS 7.0.0–7.0.6 to 7.0.7 or later. Fortinet specifies a platform exception for FG6000F and 7000E/F series: upgrade to FortiOS 7.0.5 B8001 or later as applicable. Upgrade FortiProxy 7.2.0 to 7.2.1 or later, and FortiProxy 7.0.0–7.0.6 to 7.0.7 or later. Upgrade FortiSwitchManager 7.2.0 to 7.2.1 or later, and 7.0.0 to 7.0.1 or later. Follow the vendor-supported upgrade path. Investigate potentially compromised devices for unauthorized accounts, SSH keys, configuration exports, and configuration changes. Where compromise or configuration disclosure occurred, initiate incident response, remove unauthorized access, restore configuration integrity, and rotate exposed administrator, VPN, and other configuration-held credentials and secrets.

Public exploits

Exploits

13 exploits validated by Mallory's analysis. Hidden: 7 rejected by Mallory's analysis as not a working exploit; 2 not yet analyzed, such as Exploit-DB entries.

View more in app →
fortinet_authentication_bypass_cve_2022_40684.rbThis repository contains a single Metasploit module that exploits CVE-2022-40684, an authentication bypass vulnerability in Fortinet FortiOS, FortiProxy, and FortiSwitchManager. The exploit targets the Fortinet API (typically accessible over HTTPS on port 443) to bypass authentication and add an attacker-controlled SSH public key to the authorized_keys file of a privileged user (such as 'admin'). This enables the attacker to log in via SSH and gain remote shell access as that user. The module includes logic to auto-detect users, generate or use a provided SSH key, and clean up after exploitation. The attack vector is network-based, requiring access to the management interface of a vulnerable Fortinet device. The module is operational and provides a working payload for remote shell access. The code is written in Ruby and is structured as a standard Metasploit exploit module.Disclosed Oct 10, 2022 · Framework: metasploit · ruby · networkWeaponizedCVE-2022-40684-POCThis repository contains a Python proof-of-concept exploit for CVE-2022-40684, an authentication bypass vulnerability affecting Fortinet FortiProxy and FortiOS devices. The main script, 'CVE-2022-40684.py', automates the exploitation process by reading a list of target URLs, usernames, and an attacker's SSH public key from files. For each target and username, it sends a crafted HTTP PUT request to the '/api/v2/cmdb/system/admin/<username>' endpoint, attempting to inject the attacker's SSH public key into the admin account. If successful, this grants the attacker SSH access to the device. The exploit requires network access to the vulnerable device's API and is operational, as it performs the actual key injection. The repository also includes a README with usage instructions and a LICENSE file.kljunowsky · Disclosed Oct 13, 2022 · python · networkOperationalCVE-2022-40684This repository provides a working exploit and detection script for CVE-2022-40684, a critical authentication bypass vulnerability in Fortinet FortiOS, FortiProxy, and FortiSwitchManager appliances. The main exploit (exploit.py) is a Python script that allows an attacker to inject their SSH public key into the admin account (or another specified user) on a vulnerable device by sending a crafted HTTP PUT request to the /api/v2/cmdb/system/admin/{username} endpoint. If successful, the script then attempts to connect via SSH using the injected key, providing an interactive shell to the attacker. The script supports both single-target and mass exploitation modes, with multithreading for efficiency. The repository also includes a Nmap NSE script (cve-2022-40684.nse) for detection, a simple parser for Zoomeye search results, and a requirements.txt for dependencies. The exploit is operational and provides real post-exploitation access if the target is vulnerable. No hardcoded payloads are present; the attacker's own SSH key is used. The main attack vector is network-based, targeting the HTTP management interface of the affected Fortinet products.Chocapikk · Disclosed Oct 15, 2022 · python · lua · networkOperationalCVE-2022-40684This repository is a proof-of-concept exploit for CVE-2022-40684, a critical authentication bypass vulnerability affecting Fortinet FortiOS, FortiProxy, and FortiSwitchManager appliances. The main exploit script (exploit.py) allows an attacker to add their SSH public key to the admin user (or another specified user) on a vulnerable device by abusing an unauthenticated REST API endpoint. The script supports both single-target and mass exploitation (via a list of targets), and can provide an interactive SSH shell if the key is successfully injected. The exploit works by sending a crafted HTTP PUT request to the /api/v2/cmdb/system/admin/{username} endpoint with a JSON payload containing the attacker's SSH key. If successful, the attacker gains SSH access to the device. The repository also includes a parser script (parser_zoomeye.py) for processing Zoomeye search results, and a requirements.txt file listing dependencies (paramiko, requests, rich). The README provides detailed usage instructions, affected product versions, and mitigation advice. The exploit is operational and provides real post-exploitation access, but is not part of a larger framework.HAWA771 · Disclosed Oct 15, 2022 · python · networkOperationalfortipwnThis repository is a Rust-based exploit tool targeting Fortinet FortiOS devices vulnerable to CVE-2022-40684. The exploit works by sending a crafted HTTPS PUT request to the FortiOS management API endpoint (/api/v2/cmdb/system/admin/admin) with custom headers and a JSON body containing the attacker's SSH public key. If the target is vulnerable, the key is added to the admin account's authorized_keys, granting the attacker SSH access as admin. The tool takes a list of target IP addresses and a public key file as input, attempts the exploit in parallel across all targets, and reports which hosts were successfully compromised. The codebase is structured with a main entry point (src/main.rs), the core exploit logic (src/cve.rs), and a test harness (tests/integration_test.rs). No hardcoded credentials or fake payloads are present; the exploit is operational and automates a real-world attack scenario.xtwip · Disclosed Oct 16, 2022 · rust · networkOperationalCVE-2022-40684This repository contains an exploit for CVE-2022-40684, a critical authentication bypass vulnerability affecting Fortinet FortiGate devices. The main file, exp.py, is a Python script that allows an attacker to upload their own SSH public key to the admin account of a vulnerable device by sending a crafted HTTP PUT request to the /api/v2/cmdb/system/admin/admin endpoint. The script supports both single-target and batch exploitation modes, reading targets from a file if specified. After attempting the exploit, it checks if the SSH port (22) is open, indicating successful key upload and potential SSH access. The README provides usage instructions and context for identifying FortiGate devices. The exploit is operational, requiring a valid SSH public key and access to the vulnerable API endpoint.qingsiweisan · Disclosed Oct 26, 2022 · python · networkOperationalCVE-2022-40684-metasploit-scannerThis repository contains a Metasploit auxiliary scanner module (fortinet_product_auth_bypass.py) targeting CVE-2022-40684, an authentication bypass vulnerability in several Fortinet products (FortiOS, FortiProxy, FortiSwitchManager). The exploit is written in Python and designed to be used within the Metasploit framework. It works by sending specially crafted HTTP(S) requests with manipulated headers to administrative API endpoints, bypassing authentication controls. Upon successful exploitation, it enumerates admin users, retrieves product serial and version information, and attempts to leak LDAP configuration from the target device. The module is operational and provides actionable results for penetration testers and defenders. The README provides clear setup and usage instructions, and the code is structured for integration with Metasploit's scanner modules.TaroballzChen · Disclosed Oct 27, 2022 · Framework: metasploit · python · networkOperationalfortigate-cve-2022-40684-toolThis repository is a small standalone Python exploit/assessment tool for CVE-2022-40684 affecting Fortinet FortiGate/FortiOS devices. The repository contains one primary code file (fortigate_tool.py), a README, dependency list, license, and .gitignore. The script is the clear entry point and uses requests, urllib3, argparse, json, os, and prettytable. Core exploit logic: the tool sends HTTPS requests to FortiGate CMDB API endpoints while setting crafted headers (Forwarded and X-Forwarded-For with 127.0.0.1, plus User-Agent: Report Runner). This is consistent with public exploitation patterns for CVE-2022-40684 authentication bypass. TLS verification is disabled. The script first checks likely vulnerability by requesting /api/v2/cmdb/system/admin and treating HTTP 200 with a results field as success. Capabilities implemented: - Vulnerability validation against /api/v2/cmdb/system/admin - Enumeration of admin users, local users, and user groups - Arbitrary endpoint dumping via --dump - Bulk configuration extraction via --dump-all from multiple sensitive CMDB endpoints - Unauthorized privileged account creation via POST to /api/v2/cmdb/system/admin with accprofile set to super_admin The dump-all feature targets numerous high-value configuration areas including system settings, interfaces, zones, local/LDAP/RADIUS users, firewall objects and policies, VPN settings, routes, and logging configuration. Responses are written locally under fortigate_dump/ as JSON or raw text. This is not merely a detector: it includes active post-bypass actions and a write capability (admin creation), making it a real exploit tool rather than a simple scanner. It is operational but not highly modular or framework-based; payloads and behavior are hardcoded and driven by command-line flags.pintukumar-sutradhar · Disclosed Apr 1, 2026 · python · text · network · webOperationalCVE-2022-40684The repository contains README.md (2,460 bytes) and one standalone Python entry point, poc.py (7,166 bytes). It is not associated with an exploit framework. The README documents CVE-2022-40684, affected-version claims, installation, and examples. The Python script implements three actions: check, enablessh, and sshkey. All target requests use HTTPS with certificate verification disabled and the same Report Runner/Forwarded loopback-spoofing headers. Targets are processed sequentially, with optional proxy routing and a configurable 20-second default timeout. The check action reads the administrator API and uses a loose status/body heuristic rather than version detection or a comparison with an ordinary unauthenticated request. The enablessh action enumerates interfaces, appends SSH to allowaccess where absent, and then invokes key injection. Despite its management-interface description, the code does not explicitly filter for management-capable interfaces. The sshkey action reads an operator-provided key and updates an existing administrator account; there is no user creation, reverse shell, automatic SSH login, or arbitrary-command execution implementation. Operational limitations include fragile response checks: interface updates require a JSON http_status of 200, while key injection success relies on the text 'SSH key is good'. Key-file reading occurs outside add_sshkey's exception handler. Global --proxy and --timeout options should precede the subcommand; the README's proxy example places --proxy after it and may be rejected by argparse. The README's FortiProxy 1.x/2.x affected-version claims are not established by the code and should be independently verified. Static review shows no evident fake-exploit behavior, exfiltration, or contacted third-party service. No runtime validation was performed. Repository URL, revision, and archive size were not supplied; their fields use empty or zero placeholders.gotr00t0day · Disclosed Oct 4, 2026 · python · network · webOperationalCVE-2022-40684This repository contains a proof-of-concept (POC) exploit for CVE-2022-40684, an authentication bypass vulnerability affecting Fortinet FortiOS, FortiProxy, and FortiSwitchManager appliances. The main file, CVE-2022-40684.py, is a Python script that allows an attacker to add their own SSH public key to a specified user account on a vulnerable device by sending a crafted HTTP PUT request to the device's API endpoint. The script requires the target's IP address, a valid username, and a path to the attacker's SSH public key file. If successful, the attacker can then SSH into the device as the specified user. The repository also includes a README.md with technical analysis, usage instructions, and mitigation advice. The exploit is network-based, targeting the device's HTTPS API interface, and is a functional POC that demonstrates the vulnerability's impact.horizon3ai · Disclosed Oct 13, 2022 · python · markdown · networkPoCCVE-2022-40684This repository provides a proof-of-concept (PoC) exploit for CVE-2022-40684, a critical authentication bypass vulnerability affecting Fortinet FortiOS, FortiProxy, and FortiSwitchManager. The repository contains three files: a Python exploit script (exploit.py), a Nuclei template (CVE-2022-40684.yaml), and a README.md with usage instructions. The exploit works by sending specially crafted HTTP GET requests with specific headers to the administrative API endpoints of the target device, bypassing authentication and extracting sensitive information such as admin usernames, access levels, device serial and version, and LDAP configuration. The Nuclei template allows for automated detection of the vulnerability. The exploit is read-only and does not modify device state. The main attack vector is network-based, targeting exposed administrative interfaces. No hardcoded IPs or domains are present; the target is user-supplied.carlosevieira · Disclosed Oct 13, 2022 · Framework: nuclei · python · yaml · networkPoCFortinet-PoC-Auth-BypassThis repository contains a Bash proof-of-concept exploit for CVE-2022-40684, an authentication bypass vulnerability affecting Fortinet devices (such as FortiGate). The repository consists of a README.md with usage instructions and a single exploit script, poc.sh. The script takes a target IP and port as arguments, then sends a specially crafted HTTPS GET request to the /api/v2/cmdb/system/admin endpoint on the target device, using specific HTTP headers to exploit the authentication bypass. If successful, it dumps the system admin information to a file named after the target IP. The exploit demonstrates the vulnerability and provides a clear indication of whether the target is affected. The code is a straightforward PoC and does not provide weaponized or post-exploitation capabilities.Filiplain · Disclosed Oct 13, 2022 · bash · networkPoCCVE-2022-40684This repository provides a proof-of-concept (PoC) exploit for CVE-2022-40684, a critical authentication bypass vulnerability affecting Fortinet FortiOS, FortiProxy, and FortiSwitchManager. The repository contains a Python script (exploit.py) that sends specially crafted HTTP GET requests to the target's administrative API endpoints, using specific headers to exploit the authentication bypass. If the target is vulnerable, the script extracts and displays admin usernames, access levels, device serial number, version, and LDAP configuration details. The repository also includes a Nuclei YAML template (CVE-2022-40684.yaml) for automated vulnerability scanning, a README with usage instructions, and some update log files. The exploit is read-only and does not modify the target, focusing on information disclosure. The main attack vector is network-based, targeting the administrative web interface of Fortinet devices.ccordeiro · Disclosed Nov 19, 2025 · python · yaml · networkPoC
Exposure surface

Affected products & vendors

Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.

VendorProductType
FortinetFortiosoperating_system
FortinetFortiproxyapplication
FortinetFortiswitchmanagerapplication
FAQ

Frequently asked questions

Is CVE-2022-40684 exploited in the wild?
Yes. As of Nov 20, 2026, Mallory has reports of exploitation in the wild, and CISA added it to KEV on Oct 11, 2022.
Is there a public exploit for CVE-2022-40684?
Yes. Mallory tracks 13 public exploits or proofs of concept for CVE-2022-40684, the earliest disclosed Oct 10, 2022.
Is there a patch for CVE-2022-40684?
Upgrade FortiOS 7.2.0–7.2.1 to 7.2.2 or later, and FortiOS 7.0.0–7.0.6 to 7.0.7 or later. Fortinet specifies a platform exception for FG6000F and 7000E/F series: upgrade to FortiOS 7.0.5 B8001 or later as applicable.
What products are affected by CVE-2022-40684?
Fortinet Fortios, Fortinet Fortiproxy, and Fortinet Fortiswitchmanager.
How severe is CVE-2022-40684?
CVE-2022-40684 has a CVSS v3.1 score of 9.8 (Critical) and an EPSS score of 98.9% (100th percentile) as of Nov 20, 2026.
Activity feed

Recent activity

54 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.

View more in app →
+34 more in the timeline. Sign up to see them
Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Mallory platform

The version that knows your environment.

This page is what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which adversaries are exploiting it right now, and which detections to deploy tonight.
Exposure mappingQuery your assets running an affected version, and investigate the blast radius.
Threat actor evidence9Every report linking this CVE to a named adversary.
Associated malware16Malware families linked to this CVE, with evidence and IOCs.
Detection signatures7YARA, Sigma, Snort, and vendor rules, auto-deployed to your SIEM.
Vendor-by-vendor mappingCross-references every affected SKU, including bundled OEM variants.
Social activity8Community discussion across Reddit, Mastodon, and other social sources.