# GHSA-8xhv-gqm4-3w99: ZendFramework1 Potential Insufficient Entropy Vulnerability

> Insufficient entropy in random number generation allows attackers to predict values, potentially leading to information disclosure or security bypasses.

- **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-8xhv-gqm4-3w99?

GHSA-8xhv-gqm4-3w99 is a vulnerability in zendframework/zendframework1, published on 7 Jun 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

We discovered several methods used to generate random numbers in ZF1 that potentially used insufficient entropy. These random number generators are used in the following method calls:
```
Zend_Ldap_Attribute::createPassword
Zend_Form_Element_Hash::_generateHash
Zend_Gdata_HttpClient::filterHttpRequest
Zend_Filter_Encrypt_Mcrypt::_srand
Zend_OpenId::randomBytes
```
In each case, the methods were using rand() or mt_rand(), neither of which can generate cryptographically secure values. This could potentially lead to information disclosure should an attacker be able to brute force the random number generation.

Moreover, we discovered a potential security issue in the usage of the [openssl_random_pseudo_bytes()](http://php.net/manual/en/function.openssl-random-pseudo-bytes.php) function in Zend_Crypt_Math::randBytes, reported in PHP BUG [#70014](https://bugs.php.net/bug.php?id=70014), and the security implications reported in a discussion [on the random_compat library.](https://github.com/paragonie/random_compat/issues/96)

## Which versions are affected by GHSA-8xhv-gqm4-3w99?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `zendframework/zendframework1` | Packagist | From 1.12.0 | 1.12.18 |
| `zendframework/zendframework1` | Packagist | From 1.12.0 | 1.12.18 |

## How do I fix GHSA-8xhv-gqm4-3w99?

Upgrade zendframework/zendframework1 to 1.12.18 or later.

## Is GHSA-8xhv-gqm4-3w99 being exploited?

There is no known exploitation of GHSA-8xhv-gqm4-3w99 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-8xhv-gqm4-3w99 and fix it if it is affected.

What it is: GHSA-8xhv-gqm4-3w99 is a vulnerability in zendframework/zendframework1, 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-8xhv-gqm4-3w99 in the wild and no public exploit code.

Affected packages and fixed versions:
- zendframework/zendframework1 (Packagist): affected from 1.12.0; fixed in 1.12.18
- zendframework/zendframework1 (Packagist): affected from 1.12.0; fixed in 1.12.18

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-8xhv-gqm4-3w99/ (Markdown: https://insights.sbomify.com/GHSA-8xhv-gqm4-3w99/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-8xhv-gqm4-3w99

---
From sbomify Insights: https://insights.sbomify.com/GHSA-8xhv-gqm4-3w99/
Summaries are generated and may contain mistakes; the official description above is the record.
