Miggo Logo

CVE-2025-9340: Bouncy Castle for Java has Out-of-Bounds Write Vulnerability

N/A

CVSS Score

Basic Information

EPSS Score
0.06348%
Published
8/22/2025
Updated
8/22/2025
KEV Status
No
Technology
TechnologyJava

Technical Details

CVSS Vector
-
Package NameEcosystemVulnerable VersionsFirst Patched Version
org.bouncycastle:bc-fipsmaven= 2.1.02.1.1

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability is an out-of-bounds write in the doFinal method of the BaseCipher class in Bouncy Castle for Java. The analysis started by trying to locate the fixing commit to pinpoint the exact code changes. However, due to non-standard versioning tags and the lack of a public pull request or commit message referencing the CVE, it was not possible to find the specific patch.

Despite the absence of a patch, the vulnerability description is very specific, pointing to the org/bouncycastle/jcajce/provider/BaseCipher class and the doFinal method. By exploring the source code of the bcgit/bc-java repository, the file prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/util/BaseCipherSpi.java was identified as the most likely implementation of the vulnerable class. This file contains the engineDoFinal method, which corresponds to the doFinal method of the javax.crypto.CipherSpi class that it extends.

The vulnerability is triggered when the same byte array is used for both input and output, but with different offsets. This can cause the output of the cipher to overwrite the input prematurely, leading to incorrect results and potentially an out-of-bounds write. Therefore, the engineDoFinal method is identified as the vulnerable function. The confidence is high because the vulnerability description directly points to this function and the scenario described is a well-known cause of such vulnerabilities.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

Out-o*-*oun*s Writ* vuln*r**ility in L**ion o* t** *oun*y **stl* In*. *oun*y **stl* *or J*v* **-*ips on *ll (*PI mo*ul*s). T*is vuln*r**ility is *sso*i*t** wit* pro*r*m *il*s or*/*oun*y**stl*/j**j**/provi**r/**s**ip**r. T*is issu* *****ts *oun*y **s

Reasoning

T** vuln*r**ility is *n out-o*-*oun*s writ* in t** `*o*in*l` m*t*o* o* t** `**s**ip**r` *l*ss in *oun*y **stl* *or J*v*. T** *n*lysis st*rt** *y tryin* to lo**t* t** *ixin* *ommit to pinpoint t** *x**t *o** ***n**s. *ow*v*r, *u* to non-st*n**r* v*rsi