Skip to main content

Pac4J CVE-2026-40458

| EUVDEUVD-2026-23421 HIGH
Cross-Site Request Forgery (CSRF) (CWE-352)
2026-04-17 CERT-PL GHSA-xw5c-jc7x-gf75
7.0
CVSS 4.0 · NVD
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Social engineer victim via phishing
  2. Delivery
    Victim visits malicious site while authenticated
  3. Exploit
    Auto-submit form with hash-colliding CSRF token
  4. Execution
    PAC4J validates hash instead of token
  5. Impact
    Execute 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.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv2 – 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)
v1 Apr 17, 2026 - 16:08 CVSS 7.0

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

pac4j 6.0 <6.4.1
pac4j 5.0 <5.7.10

Affected Packages

maven org.pac4j:pac4j-core fix: 5.7.10, 6.4.1
euvd pac4j fix: 5.7.10, 6.4.1

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

NVD PRIMARY 7.0 HIGH
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

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
Active
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
High
Vulnerable system: Availability
Low
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

4
Analysis Updated
Apr 20, 2026 - 14:58 vuln.today
v2 - CVSS changed
Patch released
Apr 20, 2026 - 14:41 nvd
Patch available
Patch available
Apr 17, 2026 - 14:01 EUVD
CVE Published
Apr 17, 2026 - 13:18 nvd
HIGH 7.0

DescriptionCVE.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

Why It Matters

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.

Business Impact: Medium
Compensating Controls

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

EPSS Score
0.0%
Top 95% exploitable
Threat Intel
1
1 source
Social Media
2
Sightings
Data Quality
5 sources
Confidence: Medium

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.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact
Medium
Technical Impact
Partial

Priority Score

35
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +35
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Cross-Site Request Forgery exploits the automatic credential inclusion behavior of web browsers.

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy