Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSocial engineer victim via phishing
-
DeliveryVictim visits malicious site while authenticated
-
ExploitAuto-submit form with hash-colliding CSRF token
-
ExecutionPAC4J validates hash instead of token
-
ImpactExecute unauthorized state change
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V3 - Web Frontend Security Anti-CSRF tokens, SameSite cookies
MITRE ATT&CK
1 technique across 1 tactic: Initial Access The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires the target application to use PAC4J versions 5.0-5.7.9 or 6.0-6.4.0 for CSRF protection. Victim must be authenticated to the target application with an active session at the time of attack. Mandatory user interaction: victim must visit attacker-controlled website while authenticated (typically via social engineering). The target application must implement state-changing operations (POST/PUT/DELETE endpoints) protected solely by PAC4J's CSRF mechanism without additional defenses like SameSite cookies or origin validation. Attack complexity is low (AC:L) as hash collisions are deterministically computable, but the social engineering requirement (UI:A) significantly limits automated exploitation. Effectiveness is reduced if applications implement defense-in-depth CSRF controls beyond PAC4J's default mechanism. |
| Impact | Real-world risk is MODERATE despite the 7.0 CVSS score. The CVSS vector (AV:N/AC:L/UI:A/VI:H) correctly reflects network-accessible attack with low complexity but mandatory user interaction. EPSS probability of 0.02% (5th percentile) indicates extremely low observed exploitation in the wild, aligning with SSVC assessment of 'Exploitation: none'. No CISA KEV listing confirms no known active exploitation. The 'Automatable: no' SSVC designation is accurate - attacks require social engineering to lure victims to attacker-controlled sites. However, Technical Impact is genuinely 'partial' (High Integrity impact in CVSS) as successful exploitation enables unauthorized account modifications. The discrepancy between moderate CVSS and very low EPSS suggests this is theoretically serious but practically unexploited, likely due to: (1) requiring targeted social engineering, (2) PAC4J being a library rather than end-user application (limiting attack surface visibility), and (3) many deployments may use additional CSRF defenses like SameSite cookies. Priority should be MEDIUM - patch during normal maintenance windows, but not emergency-level unless your application handles high-value state changes and lacks defense-in-depth CSRF controls. |
| Exploit ScenarioDerived | Attacker identifies a target using vulnerable PAC4J version and crafts a malicious website hosting an auto-submitting form. The attacker precomputes a string value that produces a hash collision with common CSRF token patterns using Java's String.hashCode() algorithm. When a victim authenticated to the target application visits the malicious site (via phishing email or watering hole attack), the hidden form automatically submits a forged request (e.g., password change, email update) with the colliding token. The vulnerable PAC4J implementation validates only the hash match rather than the actual token value, accepting the forged request and executing unauthorized account modifications. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv2 – Apr 20, 2026
CSRF protection bypass in PAC4J authentication library allows remote attackers to forge state-changing requests without victim consent by exploiting hash collisions in Java's String.hashCode() function. Affects PAC4J 5.x before 5.7.10 and 6.x before 6.4.1, requiring victim interaction (visiting malicious site). EPSS score of 0.02% (5th percentile) indicates very low observed exploitation probability. No active exploitation confirmed (not in CISA KEV). CERT-PL disclosed the vulnerability with vendor patches now available.
Earlier versions of this analysis (1)
CSRF token bypass in PAC4J authentication library (versions 5.0-5.7.9 and 6.0-6.4.0) allows remote attackers to perform unauthorized state-changing operations via hash collision exploitation. Attackers craft tokens that collide with victims' legitimate CSRF tokens by exploiting Java's deterministic String.hashCode() function, reducing effective security from cryptographic strength to 32 bits. This enables account takeover through forced profile updates, password changes, and account linking when victims visit malicious websites (EPSS exploitation probability and KEV status not provided in analysis data). CERT-PL disclosed vulnerability; vendor patches released in versions 5.7.10 and 6.4.1.
RemediationAI
Upgrade to PAC4J version 5.7.10 (for 5.x deployments) or 6.4.1 (for 6.x deployments) immediately. These versions replace the weak hashCode() comparison with cryptographically secure token validation. Patched versions are available from the official PAC4J repository and Maven Central. Refer to vendor security advisory at https://www.pac4j.org/blog/security-advisory-pac4j-core-and-ldap.html for upgrade instructions. If immediate patching is not feasible, implement compensating controls: (1) Enable SameSite=Strict cookie attribute on session cookies to prevent cross-site transmission (may break legitimate cross-site workflows), (2) implement additional server-side origin/referer validation for state-changing operations (can be bypassed by sophisticated attackers), and (3) require re-authentication for sensitive operations like password changes or account linking (adds user friction but significantly raises attack difficulty). Note that compensating controls do not fully mitigate the vulnerability and should only be temporary measures until patching.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 2 packages in maven, euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
PAC4J is a widely-used Java security framework providing authentication and authorization mechanisms for web applications. This vulnerability stems from PAC4J's reliance on Java's deterministic String.hashCode() function for CSRF token validation. The hashCode() method produces only 32-bit output, creating a feasible collision space (~4.3 billion possible values). An attacker can precompute strings that hash to the same value as a victim's legitimate CSRF token without ever observing the actual token. This reduces the effective security from the token's full entropy (typically 128+ bits) to just 32 bits, making brute-force hash collision attacks computationally trivial. The root cause is CWE-352 (Cross-Site Request Forgery), specifically a cryptographic weakness in the token validation mechanism. All applications using PAC4J versions 5.0 through 5.7.9 or 6.0 through 6.4.0 for CSRF protection are vulnerable, particularly those implementing state-changing operations like profile updates, password changes, or account linking.
Know when Pac4J gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N
Primary rating from NVD · only source for this CVE.
CVSS VectorNVD
Lifecycle Timeline
4DescriptionCVE.org
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
Executive ViewAI
CVE-2026-40458 is a CSRF protection bypass in PAC4J authentication library affecting versions 5.x (before 5.7.10) and 6.x (before 6.4.1) that allows attackers to forge authenticated requests if a user visits a malicious website. Organizations using PAC4J for authentication should prioritize patching to eliminate the risk of unauthorized state-changing actions performed on behalf of authenticated users.
Apply vendor patch. If immediate patching is not feasible, implement web application firewall rules to enforce SameSite cookie attributes (SameSite=Strict) on authentication tokens and restrict cross-origin requests to trusted domains only.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Cross-Site Request Forgery exploits the automatic credential inclusion behavior of web browsers.
LDAP injection vulnerabilities in PAC4J authentication library allow low-privileged remote attackers to execute arbitrar
Authentication bypass in pac4j-core before 6.5.6 allows authenticated users holding a weaker profile type to access reso
Privilege escalation in pac4j-oidc before 6.5.6 allows authenticated attackers to forge Keycloak access tokens and claim
Session termination via unsigned SAML LogoutRequest in pac4j-saml before 6.5.6 allows unauthenticated remote attackers t
Authentication bypass in pac4j-oidc before 6.5.6 allows remote unauthenticated attackers to establish authenticated sess
Open redirect in pac4j-core before 6.5.6 allows network-accessible attackers to redirect authenticated users to attacker
The SAML identifier generated within SAML2Utils.java was found to make use of the apache commons-lang3 RandomStringUtils
EUVD-2026-23421
GHSA-xw5c-jc7x-gf75
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB