CVE-2023-25581 Deserialization of untrusted data in InternalAttributeHandler in pac4j

Critical 9.2 Published Updated

Remote code execution via unsafe Java deserialization in pac4j-core when processing specially crafted attributes in UserProfile objects.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2023-25581?

CVE-2023-25581 is a critical unsafe deserialization vulnerability in pac4j, published on 10 Oct 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

pac4j is a security framework for Java. `pac4j-core` prior to version 4.0.0 is affected by a Java deserialization vulnerability. The vulnerability affects systems that store externally controlled values in attributes of the `UserProfile` class from pac4j-core. It can be exploited by providing an attribute that contains a serialized Java object with a special prefix `{#sb64}` and Base64 encoding. This issue may lead to Remote Code Execution (RCE) in the worst case. Although a `RestrictedObjectInputStream` is in place, that puts some restriction on what classes can be deserialized, it still allows a broad range of java packages and potentially exploitable with different gadget chains. pac4j versions 4.0.0 and greater are not affected by this issue. Users are advised to upgrade. There are no known workarounds for this vulnerability.

Weakness: CWE-502

Which versions are affected by CVE-2023-25581?

2 open source packages ship an affected version, including org.pac4j:pac4j-core.

PackageAffectedFixed in
org.pac4j:pac4j-core MavenAll versions4.0.0
org.pac4j:pac4j-core MavenAll versions4.0.0

How do I fix CVE-2023-25581?

Upgrade org.pac4j:pac4j-core to 4.0.0 or later.

Upgrade, and only deserialise data from trusted sources or with an allow-list of types. More about Unsafe deserialization.

Is CVE-2023-25581 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-25581 exists.

Public exploit code: 1 proofs of concept on GitHub.

Sources

Also known as GHSA-76mw-6p95-x9x5.

Is CVE-2023-25581 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free