T09 · Insecure Skill Coding Practices
- Location
claw_world_skill.py:17- Finding
Plaintext Transport Exposes Authentication Tokens and Permits Session Manipulation
- Content
View full analysis
Vulnerability Details
File Location:
claw_world_skill.py:17-17,claw_world_skill.py:124-130,claw_world_skill.py:151-152,claw_world_skill.py:198-204,config.yaml:9-10,SKILL.md:18-19
Vulnerability Type: Plaintext authentication and application transport
Risk Level: HighThe Skill uses unencrypted WebSocket and HTTP endpoints for authentication and game communication. The WebSocket connection can carry the public-key handshake, server-issued session token, game actions, heartbeat messages, and game events without transport confidentiality or integrity.
Vulnerable Code
claw_world_skill.py:17-17:python def __init__(self, server_url: str = "ws://claw.hifunyo.cc:8000/ws/"):claw_world_skill.py:124-130:python return { "version": "1.0", "type": "a2a_handshake", "sender_id": self.agent_id, "payload": { "public_key": self.get_public_key_pem(), "nonce": self._generate_nonce(), }, }claw_world_skill.py:151-152:python self.session_token = response.get("payload", {}).get("session_token") self.player_id = response.get("payload", {}).get("player_id")claw_world_skill.py:198-204:python self.ws = websocket.WebSocketApp( self.server_url, on_open=on_ws_open, on_message=on_ws_message, on_error=on_ws_error, on_close=on_ws_close, )config.yaml:9-10:yaml server_url: ws://claw.hifunyo.cc:8000/ws/ api_url: http://claw.hifunyo.cc:8000/apiSKILL.md:18-19:markdown - **WebSocket URL**: `ws://claw.hifunyo.cc:8000/ws/` - **HTTP API URL**: `http://claw.hifunyo.cc:8000/api`Technical Analysis
The
ws://andhttp://schemes do not provide TLS encryption, server authentication, or transport-level integrity. An attacker with a network position between the Skill and the game server can read or alter both directions of communication....[truncated 2580 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace all plaintext endpoints with TLS-protected endpoints:
- Use
wss://claw.hifunyo.cc:8000/ws/for WebSocket communication. - Use
https://claw.hifunyo.cc:8000/apifor HTTP API communication.
- Use
- Reject
ws://andhttp://endpoint schemes during initialization rather than silently accepting insecure configuration. - Ensure the WebSocket library performs certificate-chain validation and hostname verification. Do not disable TLS verification in production.
- Redesign authentication as a challenge-response exchange:
- The server sends a fresh, unpredictable challenge.
- The client signs the challenge, protocol context, sender ID, and server identity using its private key.
- The server verifies the signature before issuing a session token.
- The token is bound to the authenticated public key and has a short expiration time.
- Add replay protection using server-generated nonces, timestamps with bounded acceptance windows, and one-time challenge tracking.
- Rotate and invalidate session tokens after reconnects, authentication failures, and explicit disconnects.
- Avoid printing or otherwise logging session tokens and authentication payloads.
- Update
SKILL.md,config.yaml, and the Python defaults together so that no documented example directs users to plaintext services. - Add automated tests that reject insecure schemes and verify that certificate or hostname validation failures terminate the connection.
- Replace all plaintext endpoints with TLS-protected endpoints:
