LP-2026-01: HTTP Digest Realm Confusion Authentication Bypass
The package laminas/laminas-authentication provides an API for authentication and includes adapters for common authentication scenarios.
One of these adapters, Laminas\Authentication\Adapter\Http, implements HTTP Basic and Digest authentication as defined in RFC 2617.
In affected versions, the Digest scheme does not compare the realm value in the client Authorization header with the realm that the adapter is configured with.
The adapter uses the realm that the client sends to look up the credentials in the digest resolver, and to calculate the expected digest response.
The nonce and opaque values do not contain the realm, thus they do not bind a request to a specific realm.
A credentials file for Laminas\Authentication\Adapter\Http\FileResolver can hold entries for more than one realm.
Thus, an application can share one resolver between more than one Http adapter, each configured with a different realm.
In this configuration, an attacker with valid Digest credentials for one realm can authenticate against an endpoint that is configured for a different realm.
To do this, the attacker sends the name of their own realm in the Authorization header.
For example, a user with credentials for a general area can get access to an administrative area.
This is an authentication bypass (CWE-287) with a High severity (CVSS 3.1 base score 8.1: AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N).
Affected versions
- laminas/laminas-authentication versions prior to 2.20
Action Taken
The Http adapter now compares the realm in the client Authorization header with the configured realm.
If the two values are different, authentication fails.
The patch that resolves the vulnerability is available in:
We highly recommend all users of the package to update immediately.
Mitigations
To mitigate this vulnerability without an update of the package, use one of these procedures:
- Give each
Httpadapter its own resolver, with credentials for only the realm of that adapter. - Wrap the resolver in a decorator that rejects each realm other than the configured realm.
This is an example of such a decorator:
use Laminas\Authentication\Adapter\Http\ResolverInterface;
final class SingleRealmResolver implements ResolverInterface
{
public function __construct(
private ResolverInterface $resolver,
private string $realm,
) {
}
public function resolve($username, $realm, $password = null)
{
if ($realm !== $this->realm) {
return false;
}
return $this->resolver->resolve($username, $realm, $password);
}
}
Give the decorator the same realm as the adapter:
$adapter = new Http([
'accept_schemes' => 'digest',
'realm' => 'High Realm',
// ...
]);
$adapter->setDigestResolver(new SingleRealmResolver(new FileResolver($file), 'High Realm'));
References
This patch is also known by the following identifier:
Acknowledgments
The Laminas Project thanks
- EQSTLab for reporting the issue.
- Jurj-Bogdan for developing the patch.
Released 2026-11-23
Have you identified a security vulnerability?
Please report it to us at security@getlaminas.org