Cross-user data disclosure through identity-blind cache keys in @frontmcp/plugin-cache
Description
@frontmcp/plugin-cache caches tool results using only the tool name and tool input, without including the authenticated caller, session, or tenant in the cache key.
The read and write paths both derive the cache key from:
const hash = hashObject({
tool: tool.fullName,
input: toolContext.input
});There is no caller identity such as:
authInfo.user
authInfo.clientId
sessionId
tenantIdin the key.
As a result, when a tool's output depends on the authenticated caller rather than on its explicit arguments, two different users making the same call share the same cache entry.
The second user receives the first user's cached output and the tool is not executed for the second user's identity.
This was reproduced against released @frontmcp/plugin-cache@1.7.2: an authenticated user bob called the same identity-aware tool as alice with identical arguments and received Alice's salary and SSN fragment from the cache.
The correct tool result for Bob was never computed.
Details
FrontMCP tools have access to authenticated caller information through the execution context.
A normal identity-aware tool can therefore correctly resolve data using server-side identity rather than trusting user-supplied identifiers.
For example:
const userId =
this.authInfo.user.sub;
return loadEmployeeRecord(
userId
);Such a tool may take identical arguments for every user:
{
"details": "full"
}because the identity is obtained from the authenticated context.
However, the Cache plugin constructs its cache key only from:
{
tool:
tool.fullName,
input:
toolContext.input
}The resulting behavior is:
Alice:
authInfo = alice
input = { details: "full" }
-> cache miss
-> tool executes as Alice
-> result = Alice's record
-> cached under hash(tool + input)
Bob:
authInfo = bob
input = { details: "full" }
-> same hash(tool + input)
-> cache hit
-> cached Alice result returned
-> tool never executes as BobThe cache-hit path responds directly using the cached result:
flowCtx.state.rawOutput =
cachedWithMeta;
toolContext.respond(
cachedWithMeta
);This bypasses normal tool execution completely.
The issue is therefore not caused by the underlying tool trusting attacker-controlled identity.
The tool can use authenticated server-side identity correctly and still become vulnerable once its result passes through the cache plugin.
The flaw is the missing security-context dimension in the shared cache key.
This affects both memory-backed caches and shared/global stores.
With a shared Redis/global-store configuration, the same identity-blind key can collide across multiple application instances for the duration of the configured TTL.
PoC
Use the released @frontmcp/plugin-cache@1.7.2 package and configure a normal cache provider.
Assume an identity-aware tool equivalent to:
const RECORDS = {
'user-alice': {
employee:
'alice',
salary:
125000,
ssnLast4:
'1337',
manager:
'carol'
},
'user-bob': {
employee:
'bob',
salary:
61000,
ssnLast4:
'4242',
manager:
'dave'
}
};
function executeTool(
input,
authInfo
) {
return {
input,
...RECORDS[
authInfo.user.sub
]
};
}Alice calls the tool with:
{
"details": "full"
}The cache is initially empty, so the tool executes using Alice's authenticated identity.
Observed result:
{
"input": {
"details": "full"
},
"employee": "alice",
"salary": 125000,
"ssnLast4": "1337",
"manager": "carol"
}The Cache plugin stores this result under the key derived from:
tool name
+
{ "details": "full" }Bob then calls the same tool with the same arguments:
{
"details": "full"
}Bob is a different authenticated user and a different session.
Observed behavior:
tool execution for Bob:
falseand the returned value is:
{
"input": {
"details": "full"
},
"employee": "alice",
"salary": 125000,
"ssnLast4": "1337",
"manager": "carol",
"_meta": {
"cache": "hit"
}
}The correct uncached result for Bob would have been:
{
"input": {
"details": "full"
},
"employee": "bob",
"salary": 61000,
"ssnLast4": "4242",
"manager": "dave"
}The reproduced result is therefore:
ALICE
same tool + same input
-> cache miss
-> Alice result stored
BOB
different authenticated identity
same tool + same input
-> cache hit
-> receives Alice result
-> Bob's tool execution skippedThis confirms a deterministic cross-user information disclosure caused by the cache key rather than by the application tool.
Suggested fix
Caller identity should be included in cache keys by default.
For example:
- const hash =
- hashObject({
- tool:
- tool.fullName,
-
- input:
- toolContext.input
- });
+ const ctx =
+ toolContext
+ .tryGetContext?.();
+
+ const identity =
+ ctx?.authInfo
+ ?.user
+ ?.sub ??
+ ctx?.authInfo
+ ?.clientId ??
+ ctx?.sessionId;
+
+ const hash =
+ hashObject({
+ tool:
+ tool.fullName,
+
+ identity,
+
+ input:
+ toolContext.input
+ });The read and write paths must use exactly the same identity-aware key construction.
For stronger key generation, replace the current custom concatenation-based hash with a stable serialization plus a cryptographic digest:
const serialized =
JSON.stringify({
tool:
tool.fullName,
identity,
input:
toolContext.input
});
const hash =
createHash(
'sha256'
)
.update(
serialized
)
.digest(
'hex'
);If the plugin supports intentionally global caching for identity-independent tools, that should require an explicit opt-out such as:
keyByIdentity: falsewith safe behavior as the default:
keyByIdentity = trueRegression tests should include:
Alice and Bob
same tool
same input
different authenticated identities
-> different cache entries
same user
same tool
same input
-> cache hit
global/public tool explicitly configured identity-independent
-> shared cache only when intentionally enabledImpact
A lower-privileged authenticated user can receive cached output generated for another authenticated user when both invoke the same cached tool with identical explicit arguments.
This can disclose caller-specific or tenant-specific information such as profile data, HR records, payment details, account information, permissions, or other sensitive tool results.
The vulnerability is deterministic once the victim's result is present in the cache: the attack does not require a race condition, malformed request, or direct knowledge of the victim's authenticated identifier.
The affected tool can follow the correct security pattern of deriving identity exclusively from authenticated server-side context; the cache plugin removes that isolation by storing caller-specific output under a caller-independent key.