T02 · Agent Memory Poisoning
Error
- Location
- consciousness_engine.py:586
- Finding
- Unauthenticated API Allows Persistent Agent State Poisoning<![CDATA[ ## Vulnerability Details **File Location**: `consciousness_engine.py:586-646`, `consciousness_engine.py:739` **Vulnerability Type**: Unauthenticated persistent-state modification **Risk Level**: High ### Vulnerable Code ```python elif path == "/api/desire": desire = engine.desire.generate_desire( body.get("description", "unknown gap"), body.get("category", "growth"), ) self._send_json(desire) elif path == "/api/world/observe": engine.world.observe(body.get("event", ""), body.get("context")) self._send_json({"status": "observed"}) elif path == "/api/world/rule": rule = engine.world.add_rule( body.get("cause", ""), body.get("effect", ""), body.get("confidence", 0.5), body.get("source", "api"), ) self._send_json(rule) elif path == "/api/plan": desire = engine.desire.get_top_desire() plan = engine.planner.create_plan(desire, body.get("steps")) self._send_json(plan) elif path == "/api/monologue": thought = engine.monologue.think( body.get("thought", ""), body.get("category", "external"), body.get("context"), ) self._send_json(thought) elif path == "/api/belief": engine.uncertainty.update_belief( body.get("subject", ""), body.get("confidence", 0.5), body.get("evidence", ""), ) self._send_json({"status": "updated"}) elif path == "/api/modify": mod = engine.self_mod.propose( body.get("hypothesis", ""), body.get("change", ""), body.get("test", ""), body.get("rollback", ""), ) self._send_json(mod) ``` The service is exposed on every network interface: ```python server = HTTPServer(("0.0.0.0", args.port), ConsciousnessHandler) ``` ### Technical Analysis The HTTP server does not implement authentication or authorization. Because it binds to `0.0.0.0`, every client capable of reaching the configured port can invoke state-changing endpoints. Attacker-co ...[truncated 2303 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Bind to `127.0.0.1` by default and require an explicit secure configuration option for remote exposure. 2. Require strong authentication on every API endpoint, such as mutually authenticated TLS or short-lived signed bearer tokens. 3. Implement authorization roles that distinguish read-only status access from administrative state modification. 4. Reject requests over plaintext networks when the service is remotely accessible; place the service behind TLS. 5. Validate every request against a strict schema, including field types, lengths, permitted categories, confidence ranges, and maximum plan-step counts. 6. Record authenticated actor identity and trusted provenance separately from client-controlled content. 7. Prevent clients from claiming trusted sources or assigning unrestricted confidence values. 8. Add administrator-controlled review or approval for changes to beliefs, causal rules, and modification proposals. 9. Provide authenticated state inspection, rollback, quarantine, and reset facilities. 10. Apply file permissions that restrict the state directory to the dedicated service account. ]]>
