# CVE-2026-40458: Cross-Site Request Forgery in PAC4J

> Attackers can bypass CSRF protection via hash collisions to perform unauthorized state-changing actions like password changes.

- **Severity:** High 7.0 (`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`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 17 Apr 2026
- **Updated:** 17 Apr 2026
- **Also known as:** ECHO-1c01-a9c0-c59f, GHSA-xw5c-jc7x-gf75, MINI-mpvc-87fh-fqhw, MINI-p499-66xw-gw5w

## What is CVE-2026-40458?

CVE-2026-40458 is a high-severity vulnerability in PAC4J, published on 17 Apr 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official 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

Weakness: CWE-352 (Cross-Site Request Forgery)

## Which versions are affected by CVE-2026-40458?

4 open source packages ship an affected version, including org.pac4j:pac4j-core. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.pac4j:pac4j-core` | Maven | All versions | 5.7.10 |
| `org.pac4j:pac4j-core` | Maven | All versions | 5.7.10 |
| `org.pac4j:pac4j-core` | Maven | From 6.0.0-RC1 | 6.4.1 |
| `org.pac4j:pac4j-core` | Maven | From 6.0.0-RC1 | 6.4.1 |

Products: Pac4j Pac4j.

## How do I fix CVE-2026-40458?

Upgrade org.pac4j:pac4j-core to a fixed version for your release line: 5.7.10 or 6.4.1.

## Is CVE-2026-40458 being exploited?

There is no known exploitation of CVE-2026-40458 in the wild and no public exploit code.

## Other vulnerabilities in PAC4J

- [CVE-2026-40459](https://insights.sbomify.com/CVE-2026-40459/): LDAP Injection in PAC4J (high 8.7)
- [CVE-2021-44878](https://insights.sbomify.com/CVE-2021-44878/): Pac4j token validation bypass if OpenID Connect provider supports none algorithm (high 7.5)
- [CVE-2019-10755](https://insights.sbomify.com/CVE-2019-10755/): Use of Cryptographically Weak Pseudo-Random Number Generator in org.pac4j:pac4j-saml (medium 4.9)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-40458 and fix it if it is affected.

What it is: CVE-2026-40458 is a high-severity vulnerability in PAC4J, published on 17 Apr 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2026-40458 in the wild and no public exploit code.

Affected packages and fixed versions:
- org.pac4j:pac4j-core (Maven): affected all versions; fixed in 5.7.10
- org.pac4j:pac4j-core (Maven): affected all versions; fixed in 5.7.10
- org.pac4j:pac4j-core (Maven): affected from 6.0.0-RC1; fixed in 6.4.1
- org.pac4j:pac4j-core (Maven): affected from 6.0.0-RC1; fixed in 6.4.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-40458/ (Markdown: https://insights.sbomify.com/CVE-2026-40458/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-40458
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-40458
- OSV: https://osv.dev/vulnerability/CVE-2026-40458

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-40458/
Summaries are generated and may contain mistakes; the official description above is the record.
