CVE-2026-40458
Description
PAC4J is vulnerable to Cross-Site Request Forgery (CSRF). A malicious attacker can craft a specially designed website which, when visited by a user, will automatically submit a forged cross-site request with a token whose hash collides with the victim's legitimate CSRF token. Importantly, the attacker does not need to know the victim’s CSRF token or its hash prior to the attack. Collisions in the deterministic String.hashCode() function can be computed directly, reducing the effective token's security space to 32 bits. This bypasses CSRF protection, allowing profile updates, password changes, account linking, and any other state-changing operations to be performed without the victim's consent.
This issue was fixed in PAC4J versions 5.7.10 and 6.4.1
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
PAC4J's CSRF protection is bypassed via hash collisions in String.hashCode(), allowing attackers to forge requests without knowing the victim's token.
Root
Cause PAC4J's CSRF protection relies on tokens whose hash is computed using Java's deterministic String.hashCode() function. An attacker can compute collisions in this 32-bit hash space, reducing the effective security of the token to just 32 bits [1]. This allows the attacker to craft a token whose hash collides with the victim's legitimate token without ever knowing the token itself.
Exploitation
To exploit, an attacker hosts a malicious website that, when visited by a victim, automatically submits a forged cross-site request containing a token with a colliding hash. The attacker does not need to know the victim's actual CSRF token or its hash prior to the attack [2]. The attack requires no special network position or authentication; it is a classic CSRF scenario with a novel hash-collision twist.
Impact
Successful exploitation bypasses CSRF protection entirely, enabling an attacker to perform any state-changing operation on behalf of the victim. This includes profile updates, password changes, account linking, and other sensitive actions without the victim's consent [1].
Mitigation
The vulnerability is fixed in PAC4J versions 5.7.10 and 6.4.1 [1][2]. Users running earlier versions (5.0 through 5.7.10, 6.0 through 6.4.1) should upgrade immediately. No workaround is available.
AI Insight generated on May 18, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
org.pac4j:pac4j-coreMaven | < 5.7.10 | 5.7.10 |
org.pac4j:pac4j-coreMaven | >= 6.0.0-RC1, < 6.4.1 | 6.4.1 |
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
5- cert.pl/en/posts/2026/04/CVE-2026-40458/nvdThird Party Advisory
- github.com/advisories/GHSA-xw5c-jc7x-gf75ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2026-40458ghsaADVISORY
- www.pac4j.org/blog/security-advisory-pac4j-core-and-ldap.htmlnvdVendor AdvisoryWEB
- cert.pl/en/posts/2026/04/CVE-2026-40458ghsaWEB
News mentions
0No linked articles in our index yet.