# CVE-2025-54874: OpenJPEG allows OOB heap memory write in opj_jp2_read_header

> OpenJPEG library allows out-of-bounds heap memory write during header parsing, potentially enabling code execution or denial of service.

- **Severity:** Medium 6.6 (`CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:P`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 5 Aug 2025
- **Updated:** 26 Feb 2026
- **Also known as:** ALPINE-CVE-2025-54874, ALSA-2025:13944, AZL-66090, AZL-66114, BELL-CVE-2025-54874, DEBIAN-CVE-2025-54874, JLSEC-2026-552, MINI-p7c9-fvp5-2mrj, RHSA-2025:13944, RLSA-2025:13944, SUSE-SU-2026:21995-1, UBUNTU-CVE-2025-54874, openSUSE-SU-2026:20842-1

## What is CVE-2025-54874?

CVE-2025-54874 is a medium-severity memory corruption vulnerability in Uclouvain Openjpeg, published on 5 Aug 2025. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

OpenJPEG is an open-source JPEG 2000 codec. In OpenJPEG from 2.5.1 through 2.5.3, a call to opj_jp2_read_header may lead to OOB heap memory write when the data stream p_stream is too short and p_image is not initialized.

Weakness: CWE-457 (Use of Uninitialized Variable)

## Which versions are affected by CVE-2025-54874?

It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `openjpeg2` | AlmaLinux:10 | All versions | 2.5.2-4.el10_0.1 |
| `openjpeg2-devel` | AlmaLinux:10 | All versions | 2.5.2-4.el10_0.1 |
| `openjpeg2-tools` | AlmaLinux:10 | All versions | 2.5.2-4.el10_0.1 |
| `openjpeg2` | Red Hat:enterprise_linux:10.0 | All versions | 0:2.5.2-4.el10_0.1 |
| `openjpeg2-debuginfo` | Red Hat:enterprise_linux:10.0 | All versions | 0:2.5.2-4.el10_0.1 |
| `openjpeg2-debugsource` | Red Hat:enterprise_linux:10.0 | All versions | 0:2.5.2-4.el10_0.1 |
| `openjpeg2-devel` | Red Hat:enterprise_linux:10.0 | All versions | 0:2.5.2-4.el10_0.1 |
| `openjpeg2-tools` | Red Hat:enterprise_linux:10.0 | All versions | 0:2.5.2-4.el10_0.1 |
| `openjpeg2-tools-debuginfo` | Red Hat:enterprise_linux:10.0 | All versions | 0:2.5.2-4.el10_0.1 |
| `openjpeg2` | Rocky Linux:10 | All versions | 0:2.5.2-4.el10_0.1 |
| `openjpeg2` | SUSE:Linux Enterprise Server 16.0 | All versions | 2.5.3-160000.4.1 |
| `openjpeg2` | SUSE:Linux Enterprise Server for SAP applications 16.0 | All versions | 2.5.3-160000.4.1 |

Products: Uclouvain Openjpeg.

## How do I fix CVE-2025-54874?

Upgrade to a fixed version.

## Is CVE-2025-54874 being exploited?

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

Public exploit code:

- https://github.com/cyhe50/cve-2025-54874-poc (github_poc): https://github.com/cyhe50/cve-2025-54874-poc

## Other vulnerabilities in Uclouvain Openjpeg

- [CVE-2013-4289](https://insights.sbomify.com/CVE-2013-4289/): Integer overflow in n/a (critical 10.0)
- [CVE-2013-4290](https://insights.sbomify.com/CVE-2013-4290/): Memory corruption in n/a (critical 10.0)
- [CVE-2012-3358](https://insights.sbomify.com/CVE-2012-3358/): Memory corruption in n/a (critical 10.0)
- [CVE-2018-7648](https://insights.sbomify.com/CVE-2018-7648/): Memory corruption in n/a (critical 9.8)
- [CVE-2017-17479](https://insights.sbomify.com/CVE-2017-17479/): Memory corruption in n/a (critical 9.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-54874 and fix it if it is affected.

What it is: CVE-2025-54874 is a medium-severity memory corruption vulnerability in Uclouvain Openjpeg, published on 5 Aug 2025. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-54874 exists.

Affected product: Uclouvain Openjpeg. No package-level version data is available, so check the vendor advisory linked from the reference page.

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

## Sources

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

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