Impact
A bug in a mod_auth_openidc results in disclosure of protected content to unauthenticated users.
The conditions for disclosure are:
- OIDCProviderAuthRequestMethod POST.
- Require valid-user
- There mustn't be any application-level gateway (or load balancer etc) protecting the server.
When you request a protected resource, the response includes the HTTP status, the HTTP headers, the intended response (the self-submitting form), and the protected resource (with no headers). This is an example of a request for a protected resource, including all the data returned. (The content-length in the response headers corresponds to the start of the second tag.)
----- Request ----
GET /foo/ HTTP/1.1
Accept: */*
Host: xxxxxxxxxxxxxxxxxxxxxxxx
----- Response ----
HTTP/1.1 200 OK
Date: Wed, 02 Apr 2025 14:54:43 GMT
Server: Apache/2.4.63 (Unix) OpenSSL/3.0.2
Set-Cookie: mod_auth_openidc_state_Zjv-eHqSy08Do6CPJXYD-j_BJFk=eyJhbGciOiAiZGlyIiwgImVuYyI6ICJBMjU2R0NNIn0..DBQVvz1XSoTv7Pw0.d-DFmTTyBeu9nfGm0xaiJLBhsLSZLU4_PgpMwZi0-YmzzARn8sxjxuQc1yPiWMJ8Y0nCkyRP-VIn6VeOFNoHeKzIror1AMW5h1Wop0yky72x-o49Pc4SVKsF1T6p2jw8mZHow9VEC-HIaQilyzEBz5xoXp890KS5ih88NDj2nTulNOmQ56g_51osYx5N0sx-_i-EUsLNlxNgKXax37OckWtCzXCHT-TqYS5PJDoAQ6RAPGvgVnF48Nz9a0EN5aDhZfHQjIH46tjhca748A-Ft1LyMx3m3hkk3fU.fWYAzT6ukboFUu1EBUlKCg; Path=/; Secure; HttpOnly; SameSite=Lax
Content-Length: 1139
Content-Type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Submitting...</title>
</head>
<body onload="document.forms[0].submit()">
<p>Submitting Authentication Request...</p>
<form method="post" action="https://login.windows.net/12345678-bdfa-4b79-ade3-1234567886e9/oauth2/authorize">
<p>
<input type="hidden" name="response_type" value="code">
<input type="hidden" name="scope" value="openid">
<input type="hidden" name="client_id" value="12345678-6ace-4f90-123456784cc1a1903">
<input type="hidden" name="state" value="Zjv-eHqSy08Do6CPJXYD-j_BJFk">
<input type="hidden" name="redirect_uri" value="https://xxxxxxxxxxxxxxxxxxxxxxxx/oidc/replyurl">
<input type="hidden" name="nonce" value="JdBL0iVP-lu_F4rC4PvqVBCVRs0yrt3QVhWeZE5mRc4">
<input type="hidden" name="code_challenge" value="Aj3j4CyhXwBIhGNkAO-fVB0v149dE7YxXNsQ03ROyGc">
<input type="hidden" name="code_challenge_method" value="S256">
</p>
</form>
</body>
</html>
<html><body><h1>Protected page</h1><p>You shouldn't be able to see this.</p></body></html>
---- End of data ----
In the case where mod_auth_openidc returns a form, it has to return OK from check_userid so as not to go down the error path in httpd. This means httpd will try to issue the protected resource. oidc_content_handler
is called early, which has the opportunity to prevent the normal output being issued by httpd. oidc_content_handler
has a number of checks for when it intervenes, but it doesn't check for this case, so the handler returns DECLINED
. Consequently, httpd appends the protected content to the response.
It is hard to notice the error if you're using an http library to do requests - the invalid data will be silently dropped, a new connection will be created, and the end-user remains none the wiser. Constructing a client that shows the raw data on the wire reveals a very different story.
Patches
The issue has been patched in mod_auth_openidc versions >= 2.4.16.11.
Workarounds
If there is an application-level gateway protecting the server, it mitigates the problem by hiding the extra content from the outside world.
Switching to OIDCProviderAuthRequestMethod GET (which is the default) avoids the issue.
Impact
A bug in a mod_auth_openidc results in disclosure of protected content to unauthenticated users.
The conditions for disclosure are:
When you request a protected resource, the response includes the HTTP status, the HTTP headers, the intended response (the self-submitting form), and the protected resource (with no headers). This is an example of a request for a protected resource, including all the data returned. (The content-length in the response headers corresponds to the start of the second tag.)
----- Request ----
----- Response ----
In the case where mod_auth_openidc returns a form, it has to return OK from check_userid so as not to go down the error path in httpd. This means httpd will try to issue the protected resource.
oidc_content_handler
is called early, which has the opportunity to prevent the normal output being issued by httpd.oidc_content_handler
has a number of checks for when it intervenes, but it doesn't check for this case, so the handler returnsDECLINED
. Consequently, httpd appends the protected content to the response.It is hard to notice the error if you're using an http library to do requests - the invalid data will be silently dropped, a new connection will be created, and the end-user remains none the wiser. Constructing a client that shows the raw data on the wire reveals a very different story.
Patches
The issue has been patched in mod_auth_openidc versions >= 2.4.16.11.
Workarounds
If there is an application-level gateway protecting the server, it mitigates the problem by hiding the extra content from the outside world.
Switching to OIDCProviderAuthRequestMethod GET (which is the default) avoids the issue.