# CVE-2023-30536: Insecure header validation in slim/psr7

> Attackers can inject newlines into headers causing malformed requests and potential denial of service via WAF bans.

- **Severity:** Medium 6.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 17 Apr 2023
- **Updated:** 5 Feb 2025
- **Also known as:** DEBIAN-CVE-2023-30536, GHSA-q2qj-628g-vhfw

## What is CVE-2023-30536?

CVE-2023-30536 is a medium-severity vulnerability in slimphp Slim-Psr7, published on 17 Apr 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

slim/psr7 is a PSR-7 implementation for use with Slim 4. In versions prior to 1.6.1 an attacker could sneak in a newline (\n) into both the header names and values. While the specification states that \r\n\r\n is used to terminate the header list, many servers in the wild will also accept \n\n. An attacker that is able to control the header names that are passed to Slilm-Psr7 would be able to intentionally craft invalid messages, possibly causing application errors or invalid HTTP requests being sent out with an PSR-18 HTTP client. The latter might present a denial of service vector if a remote service’s web application firewall bans the application due to the receipt of malformed requests. The issue has been patched in version 1.6.1. There are no known workarounds to this issue. Users are advised to upgrade.

Weakness: CWE-436 (Interpretation Conflict)

## Which versions are affected by CVE-2023-30536?

6 open source packages ship an affected version, including slim/psr7. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `slim/psr7` | Packagist | All versions | 1.4.1 |
| `slim/psr7` | Packagist | All versions | 1.4.1 |
| `slim/psr7` | Packagist | From 1.5 | 1.5.1 |
| `slim/psr7` | Packagist | From 1.5 | 1.5.1 |
| `slim/psr7` | Packagist | From 1.6 | 1.6.1 |
| `slim/psr7` | Packagist | From 1.6 | 1.6.1 |

Products: Slimframework Slim Psr-7.

## How do I fix CVE-2023-30536?

Upgrade slim/psr7 to a fixed version for your release line: 1.4.1, 1.5.1 or 1.6.1.

## Is CVE-2023-30536 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-30536 and fix it if it is affected.

What it is: CVE-2023-30536 is a medium-severity vulnerability in slimphp Slim-Psr7, published on 17 Apr 2023. 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-2023-30536 in the wild and no public exploit code.

Affected packages and fixed versions:
- slim/psr7 (Packagist): affected all versions; fixed in 1.4.1
- slim/psr7 (Packagist): affected all versions; fixed in 1.4.1
- slim/psr7 (Packagist): affected from 1.5; fixed in 1.5.1
- slim/psr7 (Packagist): affected from 1.5; fixed in 1.5.1
- slim/psr7 (Packagist): affected from 1.6; fixed in 1.6.1
- slim/psr7 (Packagist): affected from 1.6; fixed in 1.6.1

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

## Sources

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

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