# GHSA-xffp-6w68-4775: Zendframework Remote Address Spoofing Vector in `Zend\Http\PhpEnvironment\RemoteAddress`

> Attackers can spoof IP addresses by bypassing trusted proxy checks in Zend Framework, potentially evading IP-based security controls.

- **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:** 7 Jun 2024

## What is GHSA-xffp-6w68-4775?

GHSA-xffp-6w68-4775 is a vulnerability in zendframework/zendframework, published on 7 Jun 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

The `Zend\Http\PhpEnvironment\RemoteAddress` class provides features around detecting the internet protocol (IP) address for an incoming proxied request via the X-Forwarded-For header, taking into account a provided list of trusted proxy server IPs. Prior to 2.2.5, the class was not taking into account whether or not the IP address contained in PHP's `$_SERVER['REMOTE_ADDR']` was in the trusted proxy server list.

The IETF draft specification indicates that if `$_SERVER['REMOTE_ADDR']` is not a trusted proxy, it must be considered the originating IP address, and the value of X-Forwarded-For must be disregarded.

## Which versions are affected by GHSA-xffp-6w68-4775?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `zendframework/zendframework` | Packagist | From 2.2.0 | 2.2.5 |
| `zendframework/zendframework` | Packagist | From 2.2.0 | 2.2.5 |

## How do I fix GHSA-xffp-6w68-4775?

Upgrade zendframework/zendframework to 2.2.5 or later.

## Is GHSA-xffp-6w68-4775 being exploited?

There is no known exploitation of GHSA-xffp-6w68-4775 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-xffp-6w68-4775 and fix it if it is affected.

What it is: GHSA-xffp-6w68-4775 is a vulnerability in zendframework/zendframework, published on 7 Jun 2024. 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-xffp-6w68-4775 in the wild and no public exploit code.

Affected packages and fixed versions:
- zendframework/zendframework (Packagist): affected from 2.2.0; fixed in 2.2.5
- zendframework/zendframework (Packagist): affected from 2.2.0; fixed in 2.2.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-xffp-6w68-4775/ (Markdown: https://insights.sbomify.com/GHSA-xffp-6w68-4775/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-xffp-6w68-4775

---
From sbomify Insights: https://insights.sbomify.com/GHSA-xffp-6w68-4775/
Summaries are generated and may contain mistakes; the official description above is the record.
