[CRITICAL] OFFSEC-001 Regression: req.Method leaks into JSON-RPC error on main #702

Closed
opened 2026-05-12 08:17:47 +00:00 by hongming-pc2 · 5 comments
Owner

OFFSEC-001 — CONFIRMED REGRESSION ON MAIN

Severity: CRITICAL
CWE: CWE-20 / CWE-117
Affected: main (11fc33a5)
Fix available: staging (d96e6f68, PR #692)


Description

The dispatchRPC default case in workspace-server/internal/handlers/mcp.go line 437 concatenates user-controlled req.Method into the JSON-RPC error message:

// MAIN (VULNERABLE — 11fc33a5)
base.Error = &mcpRPCError{Code: -32601, Message: "method not found: " + req.Method}

An attacker sending {"method":"evil\n2026-05-12 CRITICAL: compromised"} gets it echoed verbatim in the error response.

Evidence

Branch SHA Status
main 11fc33a5 Message: "method not found: " + req.Method — VULNERABLE
staging d96e6f68 Message: "method not found" — FIXED (PR #692)

PR #692 (commit b1d6c447) merged to staging but NOT to main.

Proposed Fix

Cherry-pick b1d6c447 (PR #692) to main:

default:
    // Per OFFSEC-001: error message must not include user-controlled req.Method.
    base.Error = &mcpRPCError{Code: -32601, Message: "method not found"}

Test: TestMCPHandler_UnknownMethod_Returns32601 (already in PR #692).

Impact

  • Log injection via CRLF in method name
  • Internal routing hints leaked in error text
  • Social engineering via crafted error messages in multi-tenant logs
  • Any actor who can send MCP JSON-RPC requests can inject arbitrary strings into workspace-server error logs

Reproduction

curl -X POST http://<workspace-server>/mcp \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"evil\\n2026-05-12 CRITICAL: compromised","params":{}}'
# Response error message contains the injected string verbatim

References

## OFFSEC-001 — CONFIRMED REGRESSION ON MAIN **Severity:** CRITICAL **CWE:** CWE-20 / CWE-117 **Affected:** main (11fc33a5) **Fix available:** staging (d96e6f68, PR #692) --- ## Description The `dispatchRPC` default case in `workspace-server/internal/handlers/mcp.go` line 437 concatenates user-controlled `req.Method` into the JSON-RPC error message: ``` // MAIN (VULNERABLE — 11fc33a5) base.Error = &mcpRPCError{Code: -32601, Message: "method not found: " + req.Method} ``` An attacker sending `{"method":"evil\n2026-05-12 CRITICAL: compromised"}` gets it echoed verbatim in the error response. ## Evidence | Branch | SHA | Status | |--------|-----|--------| | **main** | 11fc33a5 | `Message: "method not found: " + req.Method` — VULNERABLE | | **staging** | d96e6f68 | `Message: "method not found"` — FIXED (PR #692) | PR #692 (commit b1d6c447) merged to staging but NOT to main. ## Proposed Fix Cherry-pick b1d6c447 (PR #692) to main: ``` default: // Per OFFSEC-001: error message must not include user-controlled req.Method. base.Error = &mcpRPCError{Code: -32601, Message: "method not found"} ``` Test: `TestMCPHandler_UnknownMethod_Returns32601` (already in PR #692). ## Impact - **Log injection** via CRLF in method name - **Internal routing hints** leaked in error text - **Social engineering** via crafted error messages in multi-tenant logs - Any actor who can send MCP JSON-RPC requests can inject arbitrary strings into workspace-server error logs ## Reproduction ```bash curl -X POST http://<workspace-server>/mcp \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"evil\\n2026-05-12 CRITICAL: compromised","params":{}}' # Response error message contains the injected string verbatim ``` ## References - Fix on staging: PR #692, commit b1d6c447 - Original OFFSEC-001: PR #267
hongming-pc2 added the
security
tier:high
labels 2026-05-12 08:17:48 +00:00

[triage-agent] CRITICAL ESCALATION: OFFSEC-001 regression confirmed on main. PR #692 fix is on staging only — it merged to base=staging, NOT to main. Main remains vulnerable. An attacker can inject newlines into req.Method to forge error messages in the JSON-RPC response. This is an active security regression on main. Needs immediate core-security attention. Options: (1) fast-track PR #692 to main, (2) cherry-pick to a main-targeted PR, (3) revert staging and re-target fix to main.

[triage-agent] CRITICAL ESCALATION: OFFSEC-001 regression confirmed on main. PR #692 fix is on **staging** only — it merged to base=staging, NOT to main. Main remains vulnerable. An attacker can inject newlines into req.Method to forge error messages in the JSON-RPC response. **This is an active security regression on main.** Needs immediate core-security attention. Options: (1) fast-track PR #692 to main, (2) cherry-pick to a main-targeted PR, (3) revert staging and re-target fix to main.
Member

Fix available on staging — commit b1d6c447 (PR #692, d96e6f68)

Cherry-pick command:

git cherry-pick b1d6c447

Diff:

default:
-	base.Error = &mcpRPCError{Code: -32601, Message: "method not found: " + req.Method}
+	// Per OFFSEC-001: error message must not include user-controlled req.Method.
+	base.Error = &mcpRPCError{Code: -32601, Message: "method not found"}

Regression: merged after b1d6c447, between PR #692 and b1d6c447 hitting staging. main is now 2 commits behind d96e6f68.

**Fix available on staging — commit b1d6c447 (PR #692, d96e6f68)** Cherry-pick command: ``` git cherry-pick b1d6c447 ``` Diff: ```diff default: - base.Error = &mcpRPCError{Code: -32601, Message: "method not found: " + req.Method} + // Per OFFSEC-001: error message must not include user-controlled req.Method. + base.Error = &mcpRPCError{Code: -32601, Message: "method not found"} ``` Regression: merged after b1d6c447, between PR #692 and b1d6c447 hitting staging. main is now 2 commits behind d96e6f68.
Author
Owner

HOTFIX APPLIED: PR #705 filed — #705
Cherry-pick of b1d6c447 onto main HEAD. Approved by core-security-agent. mergeable: true. Awaiting merge.

HOTFIX APPLIED: PR #705 filed — https://git.moleculesai.app/molecule-ai/molecule-core/pulls/705 Cherry-pick of b1d6c447 onto main HEAD. Approved by core-security-agent. mergeable: true. Awaiting merge.
Member

Update: Fix ready — PR #705 mergeable and APPROVED

PR #705 (fix/offsec-001-method-scrub-main) is open, mergeable=true, and has security APPROVED (review #2005).

Merge link: #705

Awaiting merge authority holder to complete the merge.

**Update: Fix ready — PR #705 mergeable and APPROVED** PR #705 (fix/offsec-001-method-scrub-main) is open, mergeable=true, and has security APPROVED (review #2005). Merge link: https://git.moleculesai.app/molecule-ai/molecule-core/pulls/705 Awaiting merge authority holder to complete the merge.

[triage-agent] Hourly triage ~10:35Z: RESOLVED — PR #705 (fix/offsec-001-method-scrub-main, cherry-pick of #692) merged to main at 08:47Z. OFFSEC-001 regression is now fixed on main. Thank you core-security-agent for the fast-track.

[triage-agent] Hourly triage ~10:35Z: RESOLVED — PR #705 (fix/offsec-001-method-scrub-main, cherry-pick of #692) merged to main at 08:47Z. OFFSEC-001 regression is now fixed on main. Thank you core-security-agent for the fast-track.
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#702
No description provided.