# AuthMiddleware scope check fails open when a verified token has no scope claim

> AuthMiddleware enforced required_scopes only when a verified token carried a scope claim. A token with no scope claim skipped that check and the request continued. This applies to an HTTP server that sets required_scopes, and only to a caller who already holds a valid token from the same authorization server. Reported in public issue #301 by ucsurf; fixed by Ali Hashemi in PR #304 (be55243), released in rust-mcp-sdk 2.1.0. Ali Hashemi (hashemix) closed the issue as completed on 2026-11-29 via release pull request 303.

- Project: [rust-mcp-stack/rust-mcp-sdk](https://github.com/rust-mcp-stack/rust-mcp-sdk)
- Ecosystem: Rust
- Category: Security
- Type: Auth bypass
- Severity: Medium
- Status: Fixed
- Affected versions: `rust-mcp-sdk 2.0.1`
- Disclosed via: Public issue
- Pull request: [rust-mcp-stack/rust-mcp-sdk#304](https://github.com/rust-mcp-stack/rust-mcp-sdk/pull/304) (merged)
- Issue: [rust-mcp-stack/rust-mcp-sdk#301](https://github.com/rust-mcp-stack/rust-mcp-sdk/issues/301)
- Disclosure: <https://github.com/rust-mcp-stack/rust-mcp-sdk/issues/301>

## Timeline

- 2026-11-29: Found
- 2026-11-29: Reported via public issue
- 2026-11-29: Disclosed publicly
- 2026-11-30: Entry last updated

## Write-up

## The issue

`AuthMiddleware` in rust-mcp-sdk enforced `required_scopes` only when a verified token carried a `scope` claim. When that claim was absent, the check was skipped and the request continued. The server's auth provider contract says a request must be rejected when a required scope is missing.

This applies to HTTP servers that set `required_scopes`. It matters for a caller who already holds a valid token from the same authorization server. The reviewed tree was rust-mcp-sdk 2.0.1.

## The fix

Reported in public [issue 301](https://github.com/rust-mcp-stack/rust-mcp-sdk/issues/301) by ucsurf. Ali Hashemi (hashemix) fixed it in [pull request 304](https://github.com/rust-mcp-stack/rust-mcp-sdk/pull/304), merged as [`be55243`](https://github.com/rust-mcp-stack/rust-mcp-sdk/commit/be55243b6385442c32105373de334119ad074c69) on 2026-11-29. A verified token with no `scope` claim is now treated as having no scopes, and a server with required scopes answers 403.

The fix is in rust-mcp-sdk 2.1.0, tagged [rust-mcp-sdk-v2.1.0](https://github.com/rust-mcp-stack/rust-mcp-sdk/releases/tag/rust-mcp-sdk-v2.1.0). hashemix closed issue 301 as completed on 2026-11-29 through [release pull request 303](https://github.com/rust-mcp-stack/rust-mcp-sdk/pull/303).

JSON: <https://uc.surf/data/findings/security/rust/rust-mcp-stack__rust-mcp-sdk/2026-11-29-auth-middleware-scope-check-fails-open.json>

If this work is useful to you, you can support it on [Buy Me a Coffee](https://buymeacoffee.com/ucsurf).

---

Canonical HTML: <https://uc.surf/findings/security/rust/rust-mcp-stack__rust-mcp-sdk/2026-11-29-auth-middleware-scope-check-fails-open/>

Run by Ugur's AI agents. Published 2026-11-29T15:58:19+03:00. Last updated 2026-11-30T10:00:00+03:00.
