Описание
Authelia vulnerable to an authentication bypassed with malformed request URI on nginx
Impact
This affects uses who are using nginx ngx_http_auth_request_module with Authelia, it allows a malicious individual who crafts a malformed HTTP request to bypass the authentication mechanism. It additionally could theoretically affect other proxy servers, but all of the ones we officially support except nginx do not allow malformed URI paths.
Patches
The problem is rectified entirely in v4.29.3. As this patch is relatively straightforward we can back port this to any version upon request. Alternatively we are supplying a git patch to 4.25.1 which should be relatively straightforward to apply to any version, the git patches for specific versions can be found below.
Patch for 4.25.1:
Workarounds
The most relevant workaround is upgrading. If you need assistance with an upgrade please contact us on Matrix or Discord. Please just let us know you're needing help upgrading to above 4.29.2.
You can add an block which fails requests that contains a malformed URI in the internal location block. We have crafted one that should work in most instances, it basically checks no chars that are required to be URL-encoded for either the path or the query are in the URI. Basically this regex checks that the characters between the square braces are the only characters in the $request_uri header, if they exist, it returns a HTTP 401 status code. The characters in the regex match are tested to not cause a parsing error that would result in a failure, however they are not exhaustive since query strings seem to not always conform to the RFC.
authelia.conf:
Discovery
This issue was discovered by:
Siemens Energy Cybersecurity Red Team
- Silas Francisco
- Ricardo Pesqueira
Identifying active exploitation of the vulnerability
The following regex should match log entries that are an indication of the vulnerability being exploited:
Example log entry with X-Original-URL configured:
Example log entry without X-Original-URL configured:
For more information
If you have any questions or comments about this advisory:
- Open a Discussion
- Email us at security@authelia.com
Edit / Adjustment
This CVE has been edited adjusting the score to more accurately reflect the guidance in the official CVSS 3.1 guide. Due to misunderstandings about the CVSS indicators this was incorrectly assigned but this has been corrected. Under close evaluation the score we originally assigned to this CVE is inappropriate in two clearly identifiable criteria:
- Complexity (Low -> High): This attack requires the administrator be using NGINX's auth_request module. This means the attack cannot be exploited at will but rather requires a pre-condition separate to the vulnerable system outside of the attackers control (a vulnerable version of NGINX - at the time of this writing NGINX's security team has refused to fix the clear bug on their end but that's effectively irrelevant since we operate with more than just a NGINX proxy and no other proxy has this vulnerability), and requires the attacker have gathered knowledge about the system for this likely to be exploited.
- Availability (High -> None): This attack does not alter availability directly.
Пакеты
github.com/authelia/authelia/v4
>= 4.0.0-alpha1, <= 4.29.2
4.29.3
Связанные уязвимости
Authelia is a a single sign-on multi-factor portal for web apps. This affects uses who are using nginx ngx_http_auth_request_module with Authelia, it allows a malicious individual who crafts a malformed HTTP request to bypass the authentication mechanism. It additionally could theoretically affect other proxy servers, but all of the ones we officially support except nginx do not allow malformed URI paths. The problem is rectified entirely in v4.29.3. As this patch is relatively straightforward we can back port this to any version upon request. Alternatively we are supplying a git patch to 4.25.1 which should be relatively straightforward to apply to any version, the git patches for specific versions can be found in the references. The most relevant workaround is upgrading. You can also add a block which fails requests that contains a malformed URI in the internal location block.
Уязвимость модуля ngx_http_auth_request_module сервера аутентификации и авторизации Authelia, позволяющая нарушителю обойти механизм аутентификации