# CVE-2023-31127: DMTF-2023-0001: SPDM mutual authentication bypass

> Attackers can bypass mutual authentication in SPDM session establishment by mixing DHE and PSK methods, affecting libspdm responders with specific capabilities.

- **Severity:** Critical 9.1 (`CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** No
- **Published:** 8 May 2023
- **Updated:** 28 Jan 2025
- **Also known as:** GHSA-qw76-4v8p-xq9f

## What is CVE-2023-31127?

CVE-2023-31127 is a critical authentication bypass vulnerability in DMTF libspdm, published on 8 May 2023. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

libspdm is a sample implementation that follows the DMTF SPDM specifications. A vulnerability has been identified in SPDM session establishment in libspdm prior to version 2.3.1. If a device supports both DHE session and PSK session with mutual
authentication, the attacker may be able to establish the session with `KEY_EXCHANGE` and `PSK_FINISH` to bypass the mutual authentication. This is most likely to happen when the Requester begins a session using one method (DHE, for example) and then uses the other method's finish (PSK_FINISH in this example) to establish the session. The session hashes would be expected to fail in this case, but the condition was not detected.

This issue only impacts the SPDM responder, which supports `KEY_EX_CAP=1 and `PSK_CAP=10b` at same time with mutual authentication requirement. The SPDM requester is not impacted. The SPDM responder is not impacted if `KEY_EX_CAP=0` or `PSK_CAP=0` or `PSK_CAP=01b`. The SPDM responder is not impacted if mutual authentication is not required.

libspdm 1.0, 2.0, 2.1, 2.2, 2.3 are all impacted. Older branches are not maintained, but users of the 2.3 branch may receive a patch in version 2.3.2. The SPDM specification (DSP0274) does not contain this vulnerability.

Weakness: CWE-372 (Incomplete Internal State Distinction), CWE-287 (Improper Authentication)

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

It affects 1 product.


Products: Dmtf Libspdm.

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

No fix has been published for CVE-2023-31127 yet. Limit exposure of the affected software until one is available.

## Is CVE-2023-31127 being exploited?

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

## Other vulnerabilities in DMTF libspdm

- [CVE-2023-32690](https://insights.sbomify.com/CVE-2023-32690/): Responder can Invoke Undefined Behavior in libspdm Requester (medium 5.7)

## Fix prompt for AI coding agents

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

What it is: CVE-2023-31127 is a critical authentication bypass vulnerability in DMTF libspdm, published on 8 May 2023. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2023-31127 in the wild and no public exploit code.

Affected product: DMTF libspdm. No package-level version data is available, so check the vendor advisory linked from the reference page.

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

## Sources

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

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