GHSA-68wm-pfjf-wqp6: Authelia vulnerable to an authentication bypassed with malformed request URI on nginx
ImpactThis 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.PatchesThe 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.WorkaroundsThe most relevant workaround is upgrading. **If you need assistance with an upgrade please contact us on [Matrix](https://riot.im/app/#/room/#authelia:matrix.org) or [Discord](https://discord.authelia.com).** 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.DiscoveryThis issue was discovered by:Siemens Energy
Cybersecurity Red TeamSilas FranciscoRicardo PesqueiraIdentifying active exploitation of the vulnerabilityThe 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 informationIf you have any questions or comments about this advisory:Open a [Discussion](https://github.com/authelia/authelia/discussions)Email us at [security@authelia.com](mailto:security@authelia.com)Edit / AdjustmentThis CVE has been edited adjusting the score to more accurately reflect the guidance in the [official CVSS 3.1 guide](https://www.first.org/cvss/specification-document). 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.
CVSS v3.1: 10