Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2026-40458

CVE-2026-40458: Pac4j CSRF Token Collision Vulnerability

CVE-2026-40458 is a CSRF vulnerability in Pac4j that exploits hash collisions in String.hashCode() to bypass token protection. Attackers can forge requests for password changes and account updates. This article covers technical details, affected versions, impact, and mitigation.

Published: April 23, 2026

CVE-2026-40458 Overview

PAC4J is vulnerable to Cross-Site Request Forgery (CSRF) due to a fundamental weakness in how CSRF tokens are validated. 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. The vulnerability exploits collisions in the deterministic String.hashCode() function, which can be computed directly, effectively reducing the token's security space to just 32 bits.

Critical Impact

This vulnerability bypasses CSRF protection entirely, allowing attackers to perform profile updates, password changes, account linking, and any other state-changing operations without the victim's consent.

Affected Products

  • PAC4J versions prior to 5.7.10
  • PAC4J versions prior to 6.4.1
  • All applications using vulnerable PAC4J CSRF protection mechanisms

Discovery Timeline

  • 2026-04-17 - CVE-2026-40458 published to NVD
  • 2026-04-20 - Last updated in NVD database

Technical Details for CVE-2026-40458

Vulnerability Analysis

This Cross-Site Request Forgery vulnerability stems from a cryptographic weakness in PAC4J's CSRF token validation mechanism. The security library relies on Java's String.hashCode() method to compare CSRF tokens, which is a deterministic 32-bit hash function. This design decision dramatically reduces the effective entropy of the CSRF protection from potentially hundreds of bits (depending on token length) to merely 32 bits.

The attack is particularly dangerous because it does not require the attacker to know the victim's actual CSRF token or its hash value prior to launching the attack. Instead, attackers can precompute hash collisions offline and embed malicious tokens that will match any legitimate user's CSRF token hash when the comparison is performed server-side.

Root Cause

The root cause lies in the use of String.hashCode() for CSRF token validation rather than a secure constant-time comparison of the actual token values. Java's String.hashCode() produces a 32-bit integer hash, which has a limited output space of approximately 4.3 billion possible values. For CSRF tokens, this creates a collision-prone validation mechanism where two completely different strings can produce the same hash value.

Attackers can precompute strings that hash to any desired 32-bit value, allowing them to generate forged CSRF tokens that will pass the hash-based validation check despite being entirely different from the victim's legitimate token.

Attack Vector

The attack is network-based and requires user interaction—specifically, the victim must visit an attacker-controlled website while authenticated to the vulnerable application. The attack flow involves:

  1. The attacker identifies an application using a vulnerable PAC4J version for CSRF protection
  2. The attacker precomputes a set of CSRF token values that produce hash collisions covering the entire 32-bit hash space
  3. The attacker creates a malicious website containing hidden forms that submit forged requests to the target application
  4. When the victim visits the malicious site, JavaScript automatically submits the form with the collision-generating CSRF token
  5. The PAC4J validation compares hashes rather than actual token values, allowing the forged request to pass validation
  6. The state-changing operation (password change, profile update, account linking) executes with the victim's authenticated session

Detection Methods for CVE-2026-40458

Indicators of Compromise

  • Unexpected profile modifications or password changes reported by users who visited external websites
  • Unusual patterns of account linking or OAuth authorization requests
  • CSRF validation logs showing successful validations with tokens that don't match stored session tokens
  • Multiple state-changing operations originating from unusual referrer domains
  • User complaints of unauthorized actions being performed on their accounts

Detection Strategies

  • Review application logs for CSRF token validation events and cross-reference with session token storage to identify hash collision attacks
  • Implement referrer header validation as an additional layer to detect requests originating from suspicious external domains
  • Monitor for abnormal patterns of state-changing requests that occur immediately after users navigate from external sites
  • Deploy web application firewall rules to flag requests with CSRF tokens that appear in known collision lists

Monitoring Recommendations

  • Enable detailed logging on all CSRF-protected endpoints to capture token values and validation outcomes
  • Set up alerts for authentication-related state changes (password resets, email changes) that correlate with external referrer domains
  • Monitor PAC4J library versions across your application portfolio to ensure vulnerable versions are identified
  • Implement user activity notifications for sensitive account changes to enable rapid detection of unauthorized modifications

How to Mitigate CVE-2026-40458

Immediate Actions Required

  • Upgrade PAC4J to version 5.7.10 or later for the 5.x branch
  • Upgrade PAC4J to version 6.4.1 or later for the 6.x branch
  • Review application logs for any suspicious CSRF-related activity that may indicate prior exploitation
  • Consider implementing additional CSRF protections such as SameSite cookie attributes and origin header validation
  • Notify users to review recent account changes and reset passwords if unauthorized modifications are suspected

Patch Information

The PAC4J development team has released security patches that address this vulnerability. Version 5.7.10 and 6.4.1 implement proper constant-time comparison of CSRF token values instead of relying on String.hashCode() comparisons. Organizations should update to these patched versions as soon as possible.

For detailed patch information, refer to the Pac4j Security Advisory and the CERT Polska advisory.

Workarounds

  • Implement additional CSRF defenses at the application layer, such as requiring re-authentication for sensitive operations
  • Enable SameSite cookie attributes set to Strict or Lax to prevent cookies from being sent in cross-origin requests
  • Add custom validation logic that performs byte-by-byte token comparison rather than relying solely on PAC4J's built-in validation
  • Deploy web application firewall rules to block requests with known collision-generating token patterns
  • Implement origin and referrer header validation as supplementary CSRF protection
bash
# Maven dependency update example for PAC4J 6.x
# Update pom.xml to specify the patched version
# <dependency>
#   <groupId>org.pac4j</groupId>
#   <artifactId>pac4j-core</artifactId>
#   <version>6.4.1</version>
# </dependency>

# For Gradle users (build.gradle)
# implementation 'org.pac4j:pac4j-core:6.4.1'

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeCSRF

  • Vendor/TechPac4j

  • SeverityHIGH

  • CVSS Score7.0

  • EPSS Probability0.02%

  • Known ExploitedNo
  • CVSS Vector
  • 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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityHigh
  • AvailabilityLow
  • CWE References
  • CWE-352
  • Technical References
  • CERT Polska CVE-2026-40458
  • Vendor Resources
  • Pac4j Security Advisory
  • Related CVEs
  • CVE-2026-40459: Pac4j LDAP Injection Vulnerability

  • CVE-2026-29000: pac4j-jwt Authentication Bypass Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English