CVE-2025-9340 native encrypt/decrypt operations in JCE may corrupt data if same byte array used for input and output.

None 0.0 Published Updated

Bouncy Castle for Java may corrupt data or crash when encrypting/decrypting using the same byte array for input and output.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2025-9340?

CVE-2025-9340 is a memory corruption vulnerability in Legion of the Bouncy Castle Inc. Bouncy Castle for Java, published on 22 Aug 2025. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

Official description

Out-of-bounds Write vulnerability in Legion of the Bouncy Castle Inc. Bouncy Castle for Java bc-fips on All (API modules). This vulnerability is associated with program files org/bouncycastle/jcajce/provider/BaseCipher.

This issue affects Bouncy Castle for Java: from BC-FJA 2.1.0 through 2.1.0.

Weakness: CWE-787

Which versions are affected by CVE-2025-9340?

2 open source packages ship an affected version, including org.bouncycastle:bc-fips.

PackageAffectedFixed in
org.bouncycastle:bc-fips MavenFrom 2.1.02.1.1
org.bouncycastle:bc-fips MavenFrom 2.1.02.1.1

How do I fix CVE-2025-9340?

Upgrade org.bouncycastle:bc-fips to 2.1.1 or later.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is CVE-2025-9340 being exploited?

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

Sources

Also known as GHSA-g6rx-6wfx-gj74.

Is CVE-2025-9340 in your software?

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

Check your SBOMs for free