NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Other MCP servers and tools

CVE-2025-4143: @cloudflare/workers-oauth-provider missing validation of redirect_uri on authorize endpoint

mediumCVSS 4.0 6.0GHSA-4pc9-x2fx-p7vj

`@cloudflare/workers-oauth-provider` before 0.0.5 does not check `redirect_uri` against the client's registered list at the authorize endpoint. On MCP servers that auto-approve returning clients, an attacker can steal a victim's authorization and impersonate them. Fixed in 0.0.5.

Published May 1, 2025 · Updated Jul 28, 2025 · Analysis Nov 1, 2026

What an attacker can do

The library checked redirect_uri only when the authorization code was exchanged for a token, not when the authorization request arrived. The library's author calls the missing check the more important one. An attacker can send a victim to the authorize endpoint with a valid client_id and a redirect_uri the attacker controls.

There is a precondition. The authorization flow belongs to the application built on the library, not to the library. The attack works only if the app's authorize callback auto-approves requests that look like they come from a client the victim already authorized. The advisory says many applications do this. If so, the victim only has to visit a malicious page. The code or token then goes to the attacker's address, and the attacker can use the victim's credentials against the same OAuth server.

The CVSS 4.0 vector reflects that: high attack complexity, a required user interaction, and high confidentiality impact. Cloudflare Workers MCP servers that use this library are the main case.

Who is affected

Affected: @cloudflare/workers-oauth-provider below 0.0.5. Check your project:

npm ls @cloudflare/workers-oauth-provider

Your server is practically exposed if its authorize handler skips the consent screen for clients a user approved before. Servers that always show consent are harder to attack, though the advisory still calls the check missing.

@cloudflare/workers-oauth-provider

Ecosystem
npm
Affected
< 0.0.5
Fixed in
0.0.5
Check
npm ls @cloudflare/workers-oauth-provider

How to fix it

Upgrade to 0.0.5 and redeploy your Worker:

npm install @cloudflare/[email protected]

The fix is in pull request 26. The advisory states there are no workarounds. After upgrading, consider whether users' earlier grants could have been abused, and revoke tokens if you see suspect activity.

How to tell if you were hit

Look in your Worker logs for authorize requests whose redirect_uri is not one of the client's registered values, and for new token grants soon after such requests. Check for tokens used from unexpected addresses. The advisory lists no log line.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

The OAuth implementation failed to check that redirect_uri was among the allowed set for the client_id.

Impact

Under certain circumstances (see below), if a victim had previously authorized with a server built on workers-oath-provider, and an attacker could later trick the victim into visiting a malicious web site, then attacker could potentially steal the victim's credentials to the same OAuth server and subsequently impersonate them.

In order for the attack to be possible, the OAuth server's authorized callback must be designed to auto-approve authorizations that appear to come from an OAuth client that the victim has authorized previously. The authorization flow is not implemented by workers-oauth-provider; it is up to the application built on top to decide whether to implement such automatic re-authorization. However, many applications do implement such logic.

Patches

Fixed in: https://github.com/cloudflare/workers-oauth-provider/pull/26

We patched up the vulnerabilities in the latest version, v 0.0.5 of the Workers OAuth provider (https://www.npmjs.com/package/@cloudflare/workers-oauth-provider). You'll need to update your MCP servers to use that version to resolve the vulnerability.

Workarounds

None

Note

It is a basic, well-known requirement that OAuth servers should verify that the redirect URI is among the allowed list for the client, both during the authorization flow and subsequently when exchanging the authorization code for an access token. workers-oauth-provider implemented only the latter check, not the former. Unfortunately, the former is the much more important check.

Readers who are familiar with OAuth may recognize that failing to check redirect URIs against the allowed list is a well-known, basic mistake, covered extensively in the RFC and elsewhere. The author of this library would like everyone to know that he was, in fact, well-aware of this requirement, thought about it a lot while designing the library, and then, somehow, forgot to actually make sure the check was in the code. That is, it's not that he didn't know what he was doing, it's that he knew what he was doing but flubbed it.

Questions

Does CVE-2025-4143 affect every server built on workers-oauth-provider?

The missing check affects all versions below 0.0.5. A real attack also needs the app to auto-approve returning clients, which is the application's choice, not the library's.

Is there a workaround?

No. The advisory says none. Upgrade to 0.0.5.

Why does it matter that the token exchange already checked redirect_uri?

The check at token exchange is too late. The attacker's address may already have received the authorization code. The check at the authorize endpoint is the one that stops it.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Other MCP servers and tools vulnerabilities

All Other MCP servers and tools entries