Summary
SurrealDB can bind an MCP session to an access-method name rather than the identity of the individual JWT/Bearer user. If an attacker has a valid low-privilege token for that same access method and obtains a victim's mcp-session-id, they may hijack the session and invoke MCP tools with the victim's roles and permissions.
SurrealDB can bind an MCP session to an access-method name rather than the identity of the individual JWT/Bearer user. If an attacker has a valid low-privilege token for that same access method and obtains a victim's mcp-session-id, they may hijack the session and invoke MCP tools with the victim's roles and permissions.
Affected context
The issue affects SurrealDB MCP sessions using JWT/Bearer access methods in versions 3.1.0 before 3.3.0. The risk arises when session binding identifies users by the shared access-method name rather than by a per-user identity, allowing a token belonging to another user of that method to be treated as the session's bound subject.
The issue affects SurrealDB MCP sessions using JWT/Bearer access methods in versions 3.1.0 before 3.3.0. The risk arises when session binding identifies users by the shared access-method name rather than by a per-user identity, allowing a token belonging to another user of that method to be treated as the session's bound subject.
Exploit preconditions
- Attack surface: MCP session handling in SurrealDB
- Required access: A valid low-privilege JWT/Bearer token for the same access method used by the victim
- Additional requirement: Access to the victim's
mcp-session-id - Trigger point: Making MCP requests associated with the victim's session
- Why exploitation is possible: The session fingerprint uses the access-method name instead of a per-user identity, so distinct users of that method may share the same binding.
- Attack surface: MCP session handling in SurrealDB
- Required access: A valid low-privilege JWT/Bearer token for the same access method used by the victim
- Additional requirement: Access to the victim's
mcp-session-id - Trigger point: Making MCP requests associated with the victim's session
- Why exploitation is possible: The session fingerprint uses the access-method name instead of a per-user identity, so distinct users of that method may share the same binding.
Why this happens
The session-binding logic derives a BoundSubject fingerprint from the access-method name rather than the authenticated user's identity. This maps to CWE-269: Improper Privilege Management because authorization context can be associated with the wrong principal, allowing a lower-privilege user to act with the roles and permissions of a victim session.
The session-binding logic derives a BoundSubject fingerprint from the access-method name rather than the authenticated user's identity. This maps to CWE-269: Improper Privilege Management because authorization context can be associated with the wrong principal, allowing a lower-privilege user to act with the roles and permissions of a victim session.
Potential impact
- An attacker may hijack a victim's MCP session.
- MCP tools could be invoked with the victim's roles and permissions.
- Sensitive data may be accessed or modified, depending on the victim's privileges and available tools.
- Actions performed through the session could affect systems or resources available to the victim.
- An attacker may hijack a victim's MCP session.
- MCP tools could be invoked with the victim's roles and permissions.
- Sensitive data may be accessed or modified, depending on the victim's privileges and available tools.
- Actions performed through the session could affect systems or resources available to the victim.
General mitigation guidance
Defensive patterns focus on binding authenticated sessions to unique, verified principals and keeping authentication identity separate from access-method configuration.
- Derive session bindings from a stable per-user identity, not a shared access-method name.
- Verify that each request's authenticated principal matches the principal bound to its session.
- Treat session identifiers as sensitive and limit their exposure and lifetime.
- Apply least-privilege roles and permissions to users and MCP tools.
- Use secure-by-default session handling that rejects ambiguous or mismatched identity bindings.
Defensive patterns focus on binding authenticated sessions to unique, verified principals and keeping authentication identity separate from access-method configuration.
- Derive session bindings from a stable per-user identity, not a shared access-method name.
- Verify that each request's authenticated principal matches the principal bound to its session.
- Treat session identifiers as sensitive and limit their exposure and lifetime.
- Apply least-privilege roles and permissions to users and MCP tools.
- Use secure-by-default session handling that rejects ambiguous or mismatched identity bindings.
How teams detect issues like this
- Review authentication and session-binding code for fingerprints derived from shared configuration identifiers instead of unique principal identities.
- Use static analysis and code review checks to flag session authorization decisions that do not compare the authenticated user with the session owner.
- Monitor for MCP sessions used with inconsistent principals or unexpected changes in the identity associated with a session.
- Enforce policies requiring unique principal-to-session binding and least-privilege authorization for MCP tool access.
- Review authentication and session-binding code for fingerprints derived from shared configuration identifiers instead of unique principal identities.
- Use static analysis and code review checks to flag session authorization decisions that do not compare the authenticated user with the session owner.
- Monitor for MCP sessions used with inconsistent principals or unexpected changes in the identity associated with a session.
- Enforce policies requiring unique principal-to-session binding and least-privilege authorization for MCP tool access.

