# GHSA-wjfc-pgfp-pv9c: Improper Input Validation in nyholm/psr7

> Attackers can inject newlines into HTTP headers via improper input validation in the nyholm/psr7 library, potentially causing request smuggling or header injection.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 21 Apr 2023

## What is GHSA-wjfc-pgfp-pv9c?

GHSA-wjfc-pgfp-pv9c is a vulnerability in nyholm/psr7, published on 21 Apr 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

### Impact

Improper header parsing. 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`.

### Patches

The issue is patched in 1.6.1.

### Workarounds

There are no known workarounds.

### References

* https://www.rfc-editor.org/rfc/rfc7230#section-3.2.4

## Which versions are affected by GHSA-wjfc-pgfp-pv9c?

2 open source packages ship an affected version, including nyholm/psr7.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `nyholm/psr7` | Packagist | All versions | 1.6.1 |
| `nyholm/psr7` | Packagist | All versions | 1.6.1 |

## How do I fix GHSA-wjfc-pgfp-pv9c?

Upgrade nyholm/psr7 to 1.6.1 or later.

## Is GHSA-wjfc-pgfp-pv9c being exploited?

There is no known exploitation of GHSA-wjfc-pgfp-pv9c in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-wjfc-pgfp-pv9c and fix it if it is affected.

What it is: GHSA-wjfc-pgfp-pv9c is a vulnerability in nyholm/psr7, published on 21 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 GHSA-wjfc-pgfp-pv9c in the wild and no public exploit code.

Affected packages and fixed versions:
- nyholm/psr7 (Packagist): affected all versions; fixed in 1.6.1
- nyholm/psr7 (Packagist): affected all versions; 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/GHSA-wjfc-pgfp-pv9c/ (Markdown: https://insights.sbomify.com/GHSA-wjfc-pgfp-pv9c/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-wjfc-pgfp-pv9c

---
From sbomify Insights: https://insights.sbomify.com/GHSA-wjfc-pgfp-pv9c/
Summaries are generated and may contain mistakes; the official description above is the record.
