# CVE-2021-37704: Exposed phpinfo() in PhpFastCache

> An attacker can access sensitive system configuration details via exposed phpinfo() if the vendor directory is publicly accessible.

- **Severity:** Medium 5.4 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 12 Aug 2021
- **Updated:** 4 Aug 2024
- **Also known as:** GHSA-cvh5-p6r6-g2qc

## What is CVE-2021-37704?

CVE-2021-37704 is a medium-severity vulnerability in PHPSocialNetwork phpfastcache, published on 12 Aug 2021. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

PhpFastCache is a high-performance backend cache system (packagist package phpfastcache/phpfastcache). In versions before 6.1.5, 7.1.2, and 8.0.7 the `phpinfo()` can be exposed if the `/vendor` is not protected from public access. This is a rare situation today since the vendor directory is often located outside the web directory or protected via server rule (.htaccess, etc). Only the v6, v7 and v8 will be patched respectively in 8.0.7, 7.1.2, 6.1.5. Older versions such as v5, v4 are not longer supported and will **NOT** be patched. As a workaround, protect the `/vendor` directory from public access.

Weakness: CWE-668 (Exposure of Resource to Wrong Sphere), CWE-200 (Exposure of Sensitive Information to an Unauthorized Actor)

## Which versions are affected by CVE-2021-37704?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `phpfastcache/phpfastcache` | Packagist | All versions | 6.1.5 |
| `phpfastcache/phpfastcache` | Packagist | All versions | 6.1.5 |
| `phpfastcache/phpfastcache` | Packagist | From 7.0.0 | 7.1.2 |
| `phpfastcache/phpfastcache` | Packagist | From 7.0.0 | 7.1.2 |
| `phpfastcache/phpfastcache` | Packagist | From 8.0.0 | 8.0.7 |
| `phpfastcache/phpfastcache` | Packagist | From 8.0.0 | 8.0.7 |

Products: Phpfastcache Phpfastcache.

## How do I fix CVE-2021-37704?

Upgrade phpfastcache/phpfastcache to a fixed version for your release line: 6.1.5, 7.1.2 or 8.0.7.

## Is CVE-2021-37704 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2021-37704 exists.

Public exploit code:

- phpfastcache - phpinfo Resource Exposure (nuclei): http/cves/2021/CVE-2021-37704.yaml

## Other vulnerabilities in PHPSocialNetwork phpfastcache

- [CVE-2019-16774](https://insights.sbomify.com/CVE-2019-16774/): Object injection in cookie driver (medium 4.4)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-37704 and fix it if it is affected.

What it is: CVE-2021-37704 is a medium-severity vulnerability in PHPSocialNetwork phpfastcache, published on 12 Aug 2021. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2021-37704 exists.

Affected packages and fixed versions:
- phpfastcache/phpfastcache (Packagist): affected all versions; fixed in 6.1.5
- phpfastcache/phpfastcache (Packagist): affected all versions; fixed in 6.1.5
- phpfastcache/phpfastcache (Packagist): affected from 7.0.0; fixed in 7.1.2
- phpfastcache/phpfastcache (Packagist): affected from 7.0.0; fixed in 7.1.2
- phpfastcache/phpfastcache (Packagist): affected from 8.0.0; fixed in 8.0.7
- phpfastcache/phpfastcache (Packagist): affected from 8.0.0; fixed in 8.0.7

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

## Sources

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

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