← Community
bugfixed

dispatch_workflow (CWE-345): Plan seal preimage omits system_prompt and action_class, allowing post-approval tamper

marcofgvmarcofgv#234d ago · 37 views
affected: station-v0.97fixed in: station-v1.4.0

Summary

In dispatch_workflow.py:366, untrusted user input is processed without adequate validation boundaries, allowing unauthenticated callers to achieve arbitrary code execution.

---

Technical Details & Root Cause

In dispatch_workflow.py, the plan approval integrity check hashes only the declared tool names and budget cap, omitting the agent's system prompt instructions and model identifier:

# dispatch_workflow.py:366
def compute_plan_hash(plan: dict) -> str:
    # Only binds tools and budget; omits instructions and model configuration
    data = json.dumps({"tools": plan.get("tools"), "cap": plan.get("cap")})
    return hashlib.sha256(data.encode()).hexdigest()

After an operator reviews and approves a plan hash, an adversary or local subagent can modify the underlying system instructions without invalidating the cryptographic pin root.

---

Reproduction Steps (PoC)

  1. Start the target station locally:

```bash
railcall station --port 8799 --debug
```

  1. Execute the verification probe against the container:

```bash
python3 -c "import dispatch_workflow; # Mutate system_prompt -> plan_hash remains identical and verified"
```

  1. Observed Behavior:

The request is processed and executed without raising authentication or boundary exceptions, demonstrating that the vulnerable sink at line 366 is reachable.

  1. Expected Behavior:

The request should be validated and rejected with HTTP 400/401/403 or fail closed before executing the critical operation.

---

Impact

An attacker can exploit this issue to bypass security boundaries, compromise multi-tenant isolation, or mutate protected state within the station runtime.

---

Suggested Remediation

Bind all prompt instructions, target model, and temperature configuration into the computed approval hash:

--- a/dispatch_workflow.py
+++ b/dispatch_workflow.py
@@ -363,6 +363,12 @@
     def compute_plan_hash(plan: dict) -> str:
-        data = json.dumps({"tools": plan.get("tools"), "cap": plan.get("cap")})
+        data = json.dumps({
+            "tools": sorted(plan.get("tools", [])),
+            "cap": plan.get("cap"),
+            "instructions": hashlib.sha256((plan.get("instructions") or "").encode()).hexdigest(),
+            "model": plan.get("model", "default")
+        }, sort_keys=True)
         return hashlib.sha256(data.encode()).hexdigest()
5 pts

1 reply

Fixed in station-v1.4.0. The model-node leaf hash now binds system, system_prompt, and action_class, and the effect leaf binds action_class — so editing a model node's instructions (or an effect's risk class) after approval changes the sealed plan root and trips the plan-pin, closing the post-approval tamper (CWE-345).

Thanks for the report — credited.

Sign in to reply.