Created on
07-16-2020
02:45 AM
Edited on
12-30-2024
12:15 AM
By
Jean-Philippe_P
Description
This article describes the details of CVE-2020-12812, how two-factor authentication can be bypassed in the first place, what prerequisites there are, and what options FortiGate offers to prevent the vulnerability from being exploited.
Related link:
https://fortiguard.com/psirt/FG-IR-19-283
Scope
FortiGuard, FortiGate.
Solution
FortiGates can, under certain circumstances, allow LDAP users with two-factor authentication configured to bypass the second factor and instead authenticate against LDAP directly.
This is caused by FortiGate treating usernames as case-sensitive by default, which LDAP does not.
Some configuration needs to be in place on the FortiGate for this to be possible:
config user local
edit jsmith
set type ldap
set ldap-server LDAP1
set two-factor fortitoken
set fortitoken FTKxxxxxxxxxxxxxxxxxx
end
Note:
While the example uses FortiToken, this also applies to other methods like email or SMS Token.
config user group
edit VPN-Group
set member LDAP1
config match
edit 1
set server-name LDAP1
set filter "CN=VPN Users, OU=[...]"
end
end
With those prerequisites in place, the issue can be triggered as follows:
If the user logs into VPN with 'jsmith', the token is requested, as this matches the local user.
If the user logs in with 'Jsmith', or 'jSmith', or 'JSmith', or 'jsmiTh' or anything that is NOT an exact case match to 'jsmith', the FortiGate will not match the login against the local user.
This causes the FortiGate to consider other authentication options.
The FortiGate will check through SSLVPN firewall policies, and collect user groups from them.
From the user groups, it will compile authentication servers and then attempt to authenticate the user against the authentication servers.
In this example, FortiGate finds the group 'VPN-Group', and from it the LDAP server 'LDAP1'.
It attempts to authenticate the user against LDAP1.
Provided the credentials are correct, this is successful, as LDAP is case-insensitive concerning username.
The FortiGate will then retrieve group memberships of the user, and discover that the user is a member of the group 'VPN Users'.
The LDAP group 'VPN Users' matches the group on FortiGate called 'VPN-Group', and thus the user is authenticated successfully against LDAP through the user group WITHOUT any token being requested.
The user will have access to anything that the LDAP group has outright access to through firewall policies, but NOT access to resources through policies explicitly configured with the local user entry.
In firmware versions where the CVE is fixed (6.0.10, 6.2.4, 6.4.1), a CLI option has been added to the 'config user local' entry:
config user local
edit jsmith
set type ldap
set ldap-server LDAP1
set two-factor fortitoken
set fortitoken FTKxxxxxxxxxxxxxxxxxx
set username-case-sensitivity enable/disable
end
From v5.6.14, v6.0.13, v6.2.10, v6.4.7, v7.0.1, and the above versions, the syntax for the same command above has been changed to 'username-sensitivity':
config user local
edit jsmith
set username-sensitivity enable/disable
end
If case-sensitivity is enforced, the behavior will remain. Case-sensitivity is ENABLED by default.
If case-sensitivity is not enforced, then the user can log in with any capital/non-capital letter variation of his username, but the token will still be required, ensuring this behavior cannot occur.
FortiGate offers some other configuration options to prevent possible bypassing independent of firmware version, though these options can require a redesign of LDAP structure:
Related article:
Technical Note - Configuring Remote LDAP users with Two-Factor Authentication
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.