# CVE-2023-37260: league/oauth2-server key exposed in exception message when passing as string and providing invalid pass phrase

> Attackers can view private keys in exception messages if keys are passed as strings without valid passphrases in this PHP OAuth2 library.

- **Severity:** High 8.2 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 6 Jul 2023
- **Updated:** 6 Nov 2024
- **Also known as:** GHSA-wj7q-gjg8-3cpm

## What is CVE-2023-37260?

CVE-2023-37260 is a high-severity vulnerability in thephpleague oauth2-server, published on 6 Jul 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

league/oauth2-server is an implementation of an OAuth 2.0 authorization server written in PHP. Starting in version 8.3.2 and prior to version 8.5.3, servers that passed their keys to the CryptKey constructor as as string instead of a file path will have had that key included in a LogicException message if they did not provide a valid pass phrase for the key where required. This issue has been patched so that the provided key is no longer exposed in the exception message in the scenario outlined above. Users should upgrade to version 8.5.3 to receive the patch. As a workaround, pass the key as a file instead of a string.

Weakness: CWE-209 (Generation of Error Message Containing Sensitive Information)

## Which versions are affected by CVE-2023-37260?

4 open source packages ship an affected version, including league/oauth2-server. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `league/oauth2-server` | Packagist | From 8.3.2 | 8.4.2 |
| `league/oauth2-server` | Packagist | From 8.3.2 | 8.4.2 |
| `league/oauth2-server` | Packagist | From 8.5.0 | 8.5.3 |
| `league/oauth2-server` | Packagist | From 8.5.0 | 8.5.3 |

Products: Thephpleague Oauth2-Server.

## How do I fix CVE-2023-37260?

Upgrade league/oauth2-server to a fixed version for your release line: 8.4.2 or 8.5.3.

## Is CVE-2023-37260 being exploited?

There is no known exploitation of CVE-2023-37260 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-37260 and fix it if it is affected.

What it is: CVE-2023-37260 is a high-severity vulnerability in thephpleague oauth2-server, published on 6 Jul 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 CVE-2023-37260 in the wild and no public exploit code.

Affected packages and fixed versions:
- league/oauth2-server (Packagist): affected from 8.3.2; fixed in 8.4.2
- league/oauth2-server (Packagist): affected from 8.3.2; fixed in 8.4.2
- league/oauth2-server (Packagist): affected from 8.5.0; fixed in 8.5.3
- league/oauth2-server (Packagist): affected from 8.5.0; fixed in 8.5.3

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

## Sources

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

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