# GHSA-62f6-h68r-3jpw: Zendframework session validation vulnerability

> Attackers can bypass session validation checks like IP or User-Agent, potentially hijacking sessions or evading detection in applications using Zend Framework.

- **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-62f6-h68r-3jpw?

GHSA-62f6-h68r-3jpw is an authentication bypass 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

`Zend\Session` session validators do not work as expected if set prior to the start of a session.

For instance, the following test case fails (where `$this->manager` is an instance of `Zend\Session\SessionManager`):
```
$this
    ->manager
    ->getValidatorChain()
    ->attach('session.validate', array(new RemoteAddr(), 'isValid'));

$this->manager->start();

$this->assertSame(
    array(
        'Zend\Session\Validator\RemoteAddr' =3D> '',
    ),
    $_SESSION['__ZF']['_VALID']
);
```
The implication is that subsequent calls to `Zend\Session\SessionManager#start()` (in later requests, assuming a session was created) will not have any validator metadata attached, which causes any validator metadata to be re-built from scratch, thus marking the session as valid.

An attacker is thus able to simply ignore session validators such as RemoteAddr or HttpUserAgent, since the "signature" that these validators check against is not being stored in the session.

## Which versions are affected by GHSA-62f6-h68r-3jpw?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `zendframework/zendframework` | Packagist | From 2.0.0 | 2.2.9 |
| `zendframework/zendframework` | Packagist | From 2.0.0 | 2.2.9 |
| `zendframework/zendframework` | Packagist | From 2.3.0 | 2.3.4 |
| `zendframework/zendframework` | Packagist | From 2.3.0 | 2.3.4 |

## How do I fix GHSA-62f6-h68r-3jpw?

Upgrade zendframework/zendframework to a fixed version for your release line: 2.2.9 or 2.3.4.

## Is GHSA-62f6-h68r-3jpw being exploited?

There is no known exploitation of GHSA-62f6-h68r-3jpw in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-62f6-h68r-3jpw and fix it if it is affected.

What it is: GHSA-62f6-h68r-3jpw is an authentication bypass 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-62f6-h68r-3jpw in the wild and no public exploit code.

Affected packages and fixed versions:
- zendframework/zendframework (Packagist): affected from 2.0.0; fixed in 2.2.9
- zendframework/zendframework (Packagist): affected from 2.0.0; fixed in 2.2.9
- zendframework/zendframework (Packagist): affected from 2.3.0; fixed in 2.3.4
- zendframework/zendframework (Packagist): affected from 2.3.0; fixed in 2.3.4

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-62f6-h68r-3jpw/ (Markdown: https://insights.sbomify.com/GHSA-62f6-h68r-3jpw/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-62f6-h68r-3jpw

---
From sbomify Insights: https://insights.sbomify.com/GHSA-62f6-h68r-3jpw/
Summaries are generated and may contain mistakes; the official description above is the record.
