# CVE-2016-1000338: In Bouncy Castle JCE Provider it is possible to inject extra elements in the sequence making up the signature and still have it validate

> Attackers can inject invisible data into signed structures by exploiting insufficient ASN.1 validation in DSA signatures, compromising data integrity.

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 1 Jun 2018
- **Updated:** 6 Aug 2024
- **Also known as:** DEBIAN-CVE-2016-1000338, GHSA-4vhj-98r6-424h, UBUNTU-CVE-2016-1000338

## What is CVE-2016-1000338?

CVE-2016-1000338 is a high-severity vulnerability in Canonical Ubuntu Linux, published on 1 Jun 2018. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

In Bouncy Castle JCE Provider version 1.55 and earlier the DSA does not fully validate ASN.1 encoding of signature on verification. It is possible to inject extra elements in the sequence making up the signature and still have it validate, which in some cases may allow the introduction of 'invisible' data into a signed structure.

Weakness: CWE-347 (Improper Verification of Cryptographic Signature)

## Which versions are affected by CVE-2016-1000338?

6 open source packages ship an affected version, including org.bouncycastle:bcprov-jdk14, org.bouncycastle:bcprov-jdk15 and org.bouncycastle:bcprov-jdk15on. It affects 5 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.bouncycastle:bcprov-jdk14` | Maven | From 1.38 | 1.56 |
| `org.bouncycastle:bcprov-jdk14` | Maven | From 1.38 | 1.56 |
| `org.bouncycastle:bcprov-jdk15` | Maven | From 1.38 | 1.56 |
| `org.bouncycastle:bcprov-jdk15` | Maven | From 1.38 | 1.56 |
| `org.bouncycastle:bcprov-jdk15on` | Maven | From 1.38 | 1.56 |
| `org.bouncycastle:bcprov-jdk15on` | Maven | From 1.38 | 1.56 |

Products: Bouncycastle Legion-of-the-Bouncy-Castle-Java-Crytography-Api, Canonical Ubuntu Linux, Netapp 7-Mode Transition Tool, Redhat Satellite, Redhat Satellite Capsule.

## How do I fix CVE-2016-1000338?

Upgrade org.bouncycastle:bcprov-jdk14 to 1.56 or later.

## Is CVE-2016-1000338 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2016-1000338 and fix it if it is affected.

What it is: CVE-2016-1000338 is a high-severity vulnerability in Canonical Ubuntu Linux, published on 1 Jun 2018. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2016-1000338 in the wild and no public exploit code.

Affected packages and fixed versions:
- org.bouncycastle:bcprov-jdk14 (Maven): affected from 1.38; fixed in 1.56
- org.bouncycastle:bcprov-jdk14 (Maven): affected from 1.38; fixed in 1.56
- org.bouncycastle:bcprov-jdk15 (Maven): affected from 1.38; fixed in 1.56
- org.bouncycastle:bcprov-jdk15 (Maven): affected from 1.38; fixed in 1.56
- org.bouncycastle:bcprov-jdk15on (Maven): affected from 1.38; fixed in 1.56
- org.bouncycastle:bcprov-jdk15on (Maven): affected from 1.38; fixed in 1.56

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-2016-1000338/ (Markdown: https://insights.sbomify.com/CVE-2016-1000338/index.md)
```

## Sources

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

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