T05 · Unauthorized Access and Privilege Escalation
- Location
hermes.py:106- Finding
Missing Topic Authorization and Session Isolation Allows Cross-Session Message Disclosure and Spoofing
- Content
View full analysis
Vulnerability Details
File Location:
hermes.py:106-112,hermes.py:127-151,hermes_openclaw.py:100-119,hermes_openclaw.py:154-178,hermes_sessions_integration.py:43-89
Vulnerability Type: Missing authorization and tenant/session isolation in the multi-agent message bus
Risk Level: HighVulnerable Code
hermes.py:106-112:python def subscribe(self, topic: str, agent_id: str, handler: Callable[[HermesMessage], None]): """Subscribe to a topic.""" with self._global_lock: if topic not in self._synapses: self._synapses[topic] = HermesSynapse(topic) synapse = self._synapses[topic] synapse.add(agent_id, handler) self.stats["active_subscriptions"] += 1hermes.py:127-151:python def publish(self, topic: str, from_agent: str, session_id: str, payload: Any, trace_id: str = "") -> int: """ Publish a message and deliver it asynchronously. Returns the estimated number of deliveries. """ with self._global_lock: self.stats["total_published"] += 1 if topic not in self._synapses: return 0 synapse = self._synapses[topic] msg = HermesMessage( topic=topic, from_agent=from_agent, session_id=session_id, payload=copy.deepcopy(payload), trace_id=trace_id, sent_at=time.time() ) delivered = synapse.deliver(msg, self._executor) with self._global_lock: self.stats["total_delivered"] += delivered return deliveredhermes_openclaw.py:100-119:python def subscribe_task_type(self, task_type: str, agent_id: str, handler: Callable[[WorkflowTask, HermesMessage], None]): """Agent subscribes to a task type.""" topic = f"workflow:task:{task_type}" def wrapped(msg: HermesMessage): task_data = msg.payload["task ...[truncated 4201 chars]- Remediation
View remediation
Remediation Suggestions
- Bind every registered agent to a trusted, immutable identity and session established by the host runtime rather than accepting caller-supplied identity strings.
- Store the authorized session and permitted topic patterns with each subscription.
- Enforce authorization during both subscription and publication.
- Filter message delivery by
session_idunless an explicitly authorized cross-session channel is used. - Generate unguessable per-task result and progress channels instead of relying only on predictable task-type topics.
- Track task assignment and verify that only an assigned agent may publish progress or completion for that task.
- Reject completion messages whose task type, task identifier, session, or publisher does not match scheduler state.
- Do not remove a task from
_running_tasksuntil publisher authorization and result validity have been verified. - Separate routers by tenant or session where possible, reducing the impact of an access-control failure.
- Add negative tests proving that an agent cannot subscribe to, read, or publish messages for another session.
