# GHSA-fhp4-pr5j-46m5: Muhammara has a NULL pointer dereference in LZWDecode filter when DecodeParms omits EarlyChange key

> A NULL pointer dereference in the muhammara PDF library allows attackers to cause a denial of service by providing a malicious PDF file.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 26 Jun 2026

## What is GHSA-fhp4-pr5j-46m5?

GHSA-fhp4-pr5j-46m5 is a vulnerability in muhammara, published on 26 Jun 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

## Summary

A NULL pointer dereference vulnerability exists in `PDFParser::CreateFilterForStream()` when processing a PDF stream with `/Filter /LZWDecode` and a `/DecodeParms` dictionary that does not contain the `EarlyChange` key. This causes an access violation (0xC0000005) and crashes the process.

## Affected Version

muhammara <= 6.0.4 (latest)

## Vulnerability Details

**File:** `src/deps/PDFWriter/PDFParser.cpp` line 2107

```cpp
if (inDecodeParams)
{
    PDFObjectCastPtr<PDFInteger> earlyObj(
        QueryDictionaryObject(inDecodeParams, "EarlyChange")
    );
    early = earlyObj->GetValue();  // NULL dereference when EarlyChange key is absent
}
```

When `inDecodeParams` is non-NULL but lacks the `EarlyChange` key:
1. `QueryDictionaryObject()` returns NULL
2. `PDFObjectCastPtr<PDFInteger>(NULL)` wraps NULL
3. `earlyObj->GetValue()` dereferences NULL → crash

## PoC

460-byte malicious PDF triggers crash via `startReadingFromStream()`:

- PDF contains `/Filter /LZWDecode` with `/DecodeParms << >>` (empty, no EarlyChange)
- Exit code: `0xC0000005` (Access Violation)

## Fix

```cpp
if (earlyObj)
    early = earlyObj->GetValue();
```

## Impact

Any application accepting untrusted PDFs and using muhammara to read stream contents is vulnerable to DoS.

Similar to: CVE-2022-41957, CVE-2022-39381

## PoC File
[poc_muhammara_lzw_null.js](https://github.com/user-attachments/files/27186113/poc_muhammara_lzw_null.js)

## Which versions are affected by GHSA-fhp4-pr5j-46m5?

2 open source packages ship an affected version, including muhammara.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `muhammara` | npm | All versions | 6.0.5 |
| `muhammara` | npm | All versions | 6.0.5 |

## How do I fix GHSA-fhp4-pr5j-46m5?

Upgrade muhammara to 6.0.5 or later.

## Is GHSA-fhp4-pr5j-46m5 being exploited?

There is no known exploitation of GHSA-fhp4-pr5j-46m5 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-fhp4-pr5j-46m5 and fix it if it is affected.

What it is: GHSA-fhp4-pr5j-46m5 is a vulnerability in muhammara, published on 26 Jun 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of GHSA-fhp4-pr5j-46m5 in the wild and no public exploit code.

Affected packages and fixed versions:
- muhammara (npm): affected all versions; fixed in 6.0.5
- muhammara (npm): affected all versions; fixed in 6.0.5

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/GHSA-fhp4-pr5j-46m5/ (Markdown: https://insights.sbomify.com/GHSA-fhp4-pr5j-46m5/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-fhp4-pr5j-46m5

---
From sbomify Insights: https://insights.sbomify.com/GHSA-fhp4-pr5j-46m5/
Summaries are generated and may contain mistakes; the official description above is the record.
