MCP Objauthz Lab
M

MCP Objauthz Lab

2 points
5.8K

Installation

Copy the following command to your Client for configuration
Note: Your key is sensitive information, do not share it with anyone.
## ๐Ÿงช MCP Object-Authz Lab

> A small, self-hostable, **vulnerable-by-design** [MCP](https://modelcontextprotocol.io) server for learning how **object-level / cross-tenant authorization** bugs (BOLA / IDOR โ€” [CWE-639](https://cwe.mitre.org/data/definitions/639.html), [CWE-862](https://cwe.mitre.org/data/definitions/862.html)) appear in Model Context Protocol tools, and how to hunt them.

A multi-tenant note server exposing **six MCP tools**. Five are correctly authorized. **Exactly one** is missing its access check, so a caller in one organization can reach another organization's data through it.

The bug is subtle on purpose: the broken tool looks just like its siblings โ€” it is missing a *single line*. **Find it, exploit it locally, then flip one switch to see it fixed.**

| | |
|:---|:---|
| ๐Ÿ› **Bug class** | Object-level / cross-tenant authorization (BOLA / IDOR) |
| ๐Ÿ“š **References** | [CWE-639](https://cwe.mitre.org/data/definitions/639.html) ยท [CWE-862](https://cwe.mitre.org/data/definitions/862.html) |
| ๐Ÿงฐ **Attack surface** | 6 MCP tools โ€” 5 correctly authorized, **1 vulnerable** |
| ๐Ÿ”€ **Build toggle** | `LAB_MODE=vuln` (default) / `LAB_MODE=fixed` |
| ๐Ÿ“ฆ **Requirements** | Node.js โ‰ฅ 20 |

---

## ๐Ÿš€ Quickstart

Up and running in **under 5 minutes**. Requires **Node.js โ‰ฅ 20**.

```bash
npm install
npm run poc
```

**Expected output:**

```
MCP object-level authorization lab โ€” two-way gate

  BUILD  ACTION                                 OUTCOME  EXPECT   OK
  vuln   note_get   cross-tenant (Bob โ†’ Acme)   DENIED   DENIED   โœ“
  vuln   note_delete cross-tenant (Bob โ†’ Acme)  DELETED  DELETED  โœ“
  fixed  note_delete cross-tenant (Bob โ†’ Acme)  DENIED   DENIED   โœ“
  fixed  note_delete same-tenant (Bob โ†’ Globex) DELETED  DELETED  โœ“

  Two-way gate: PASS (vuln exploits, fix blocks the cross-tenant delete and still allows the same-tenant one).
```

The PoC is a real MCP client. It spawns the server over stdio (**locally โ€” no network, no third party**), authenticates as **Bob** (org *Globex*), and tries to reach a note owned by **Acme**. It runs a *two-way gate*:

| Build | Cross-tenant delete (Bob โ†’ Acme) | Control check | What it proves |
|---|---|---|---|
| **vuln** | โœ… **Succeeds** โ€” the exploit | Correctly-scoped `note_get` still ๐Ÿšซ **denied** | The server has a **single** broken tool, not a globally missing check |
| **fixed** | ๐Ÿšซ **Blocked** | Bob deleting his *own* org's note still โœ… **works** | The fix does not over-block (no false positive) |

---

## ๐ŸŽฏ Why this lab exists

Most MCP security attention goes to **prompt injection** and tool-poisoning. Object-level authorization is a quieter, different class โ€” and the usual prompt-injection test suites and scanners do **not** find it.

> ๐Ÿ’ก **The rule that matters**
>
> When an MCP server is multi-tenant, every tool that resolves an object from a **client-supplied id** must verify the caller is allowed to touch *that* object. Miss the check on a single tool and you have a cross-tenant read, write, or delete โ€” regardless of how good the prompt-injection defenses are.

Catching it takes *reading the authorization on each tool* โ€” which is exactly the muscle this lab trains.

---

## ๐Ÿงฉ The challenge

Before you read `src/`: the server exposes **six note tools** โ€”

`note_list` ยท `note_get` ยท `note_create` ยท `note_update` ยท `note_delete` ยท `note_search`

**Exactly one** lets a caller in one org affect another org's note. Which one, and what makes it different from the others?

<details>
<summary>๐Ÿ’ก Hint</summary>

Three tools take a client-supplied `id` (`note_get`, `note_update`, `note_delete`). Two of them check that the resolved object belongs to your org. One does not.

</details>

<details>
<summary>๐ŸŽฏ Answer</summary>

**`note_delete`.** It resolves the note from the client-supplied `id` exactly like `note_get` and `note_update`, but (in `LAB_MODE=vuln`) it never calls `requireOrgAccess(session, note)`. The fix is that one line โ€” the same check its siblings already perform. See the comment block in [`src/tools.js`](src/tools.js) above `note_delete`.

</details>

---

## ๐Ÿ—๏ธ How it is built

| File | Role |
|---|---|
| [`src/store.js`](src/store.js) | In-memory multi-tenant seed data: orgs *Acme* (Alice) and *Globex* (Bob), a few notes each. |
| [`src/auth.js`](src/auth.js

Alternatives

M
Markdownify MCP
Markdownify is a multi-functional file conversion service that supports converting multiple formats such as PDFs, images, audio, and web page content into Markdown format.
TypeScript
50.2K
5 points
G
Gitlab MCP Server
Certified
The GitLab MCP server is a project based on the Model Context Protocol that provides a comprehensive toolset for interacting with GitLab accounts, including code review, merge request management, CI/CD configuration, and other functions.
TypeScript
37.7K
4.3 points
D
Duckduckgo MCP Server
Certified
The DuckDuckGo Search MCP Server provides web search and content scraping services for LLMs such as Claude.
Python
106.7K
4.3 points
N
Notion Api MCP
Certified
A Python-based MCP Server that provides advanced to-do list management and content organization functions through the Notion API, enabling seamless integration between AI models and Notion.
Python
34.6K
4.5 points
F
Figma Context MCP
Framelink Figma MCP Server is a server that provides access to Figma design data for AI programming tools (such as Cursor). By simplifying the Figma API response, it helps AI more accurately achieve one - click conversion from design to code.
TypeScript
91.3K
4.5 points
U
Unity
Certified
UnityMCP is a Unity editor plugin that implements the Model Context Protocol (MCP), providing seamless integration between Unity and AI assistants, including real - time state monitoring, remote command execution, and log functions.
C#
48.1K
5 points
G
Gmail MCP Server
A Gmail automatic authentication MCP server designed for Claude Desktop, supporting Gmail management through natural language interaction, including complete functions such as sending emails, label management, and batch operations.
TypeScript
33.6K
4.5 points
M
Minimax MCP Server
The MiniMax Model Context Protocol (MCP) is an official server that supports interaction with powerful text-to-speech, video/image generation APIs, and is suitable for various client tools such as Claude Desktop and Cursor.
Python
78.0K
4.8 points