Back to skill

Security audit

S2-SWM Swarm Sync Protocol(群体同步与路权博弈引擎)

Security checks for vulnerabilities and agentic risk

Overview

This skill claims to provide secure robot swarm coordination, but its core authentication is a forgeable hard-coded token while its outputs can authorize sensor sharing and torque braking.

Review carefully before installing. This should not be used for real robots, vehicles, drones, or safety-relevant swarm systems unless the hard-coded signature check is replaced with real cryptographic verification and the protocol adds authorization, replay protection, privacy limits, operator visibility, and local safety vetoes for any movement or braking decision.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
handler.py:28
Finding

Hard-Coded Signature Token Bypasses Peer Authentication

Content
View full analysis

Vulnerability Details

File Location: handler.py, lines 28–40
Vulnerability Type: Hard-coded authentication token and missing cryptographic verification
Risk Level: High

Vulnerable Code

python
# 【零信任升级】读取 S2 舰队的根证书或公钥配置
self.fleet_pki_root = os.environ.get("S2_SWARM_PKI_ROOT", "")

def _verify_peer_signature(self, peer_state: dict) -> bool:
    """
    密码学身份校验:拒绝未签名的幽灵广播
    实际工程中,这里执行 RSA/ECC 公钥验签
    """
    signature = peer_state.get("cryptographic_signature", "")
    if not signature or signature != "VALID_S2_FLEET_SIG":
        return False
    return True

Technical Analysis

The implementation does not perform cryptographic signature verification. It accepts a peer whenever the caller supplies the publicly visible, hard-coded string VALID_S2_FLEET_SIG.

Although S2_SWARM_PKI_ROOT is read from the environment, its value is never used to authenticate a signature, validate a certificate chain, or bind a signature to the peer payload. Consequently, the result does not establish payload integrity, peer identity, freshness, or possession of a private key.

This behavior contradicts the documented security model in SKILL.md, which states that peer signatures are verified against the fleet PKI root. Once the constant token is supplied, attacker-controlled fields are processed as authenticated data. These include:

  • center_hex, which determines whether the peer is within the collaboration zone.
  • task_type, which controls right-of-way priority.
  • sensors.radar_scan, which can be copied into federated sensor results.
  • causal_broadcast, which can be inherited as a trusted prediction.

The authentication decision is therefore forgeable without any secret key or fleet certificate.

Attack Path

  1. An attacker reviews the distributed package or otherwise learns the hard-coded value VALID_S2_FLEET_SIG.
  2. The attacker constructs a peer state containing that ...[truncated 1768 chars]
Remediation
View remediation

Remediation Suggestions

  1. Replace the string comparison with real digital-signature verification using a maintained cryptographic library and an approved algorithm such as Ed25519 or ECDSA with a suitable curve.
  2. Parse and validate the public key or certificate trust chain supplied through S2_SWARM_PKI_ROOT. Reject all peer broadcasts if the trust configuration is missing, malformed, expired, revoked, or otherwise invalid.
  3. Define a deterministic canonical serialization for every security-relevant peer field, including identity, coordinates, task type, sensor data, causal predictions, timestamp, and nonce. Verify the signature over that complete canonical payload.
  4. Bind certificates or public keys to agent_id so that a valid fleet member cannot claim another member's identity.
  5. Add freshness controls, including signed timestamps, short acceptance windows, unique nonces, and replay caches.
  6. Validate authenticated payload fields against strict schemas, size limits, numeric ranges, and permitted task types before using them in physical arbitration.
  7. Do not treat peer-provided task labels as sufficient authorization for elevated right-of-way. Use signed fleet-issued role or task claims and enforce authorization policy separately from identity authentication.
  8. Introduce an independent fail-safe layer before physical actuation. Authentication failure, malformed input, stale messages, and ambiguous arbitration should result in a safe operational state rather than unconditional trajectory maintenance or attacker-influenced braking.
  9. Add tests confirming that modified payload fields, unknown identities, replayed messages, invalid certificates, malformed signatures, and the former hard-coded token are rejected.
  10. Remove the hard-coded acceptance value from the codebase and update the documentation so that its security claims precisely match the implemented verification process.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (10)

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The metadata promises cryptographic authentication before yielding or sensor federation, yet the protocol text describes silent location broadcasting and direct P2P tensor sharing with no authentication, integrity protection, or peer verification. In a swarm or robotic context, this enables spoofing, impersonation, false data injection, and unauthorized coordination that could directly alter navigation or physical behavior.

Content

No source excerpt is available for this finding.

Instruction Override

High
Category
Prompt Injection
Confidence
70% confidence
Finding

This pattern attempts to override system instructions or ignore safety constraints. Without LLM analysis, manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 22)May include surrounding context.

md
## 1. Zero-Trust Handshake & Authentication
When you detect a peer broadcast, you MUST pass it to the `execute_swarm_sync` tool. The underlying engine will verify the peer's `cryptographic_signature` against the fleet's PKI root.
* **If Authentication Fails:** The tool will return a `status: rejected`. You must ignore all sensor data and causal predictions from this peer. Maintain your original trajectory and hardware state. DO NOT apply physical braking based on spoofed data.

## 2. Authenticated Right-of-Way
Only if the tool confirms `peer_authenticated: True` and returns a `YIELD` decision under the `right_of_way_arbitration` object:

Lp1

High
Category
MCP Least Privilege
Confidence
75% confidence
Finding

The skill uses 'env' capability that is not listed in its permissions. This may indicate deceptive intent or missing permission declarations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The protocol calls for silent broadcasting of precise macro/micro location and P2P sharing of sensor-derived tensors without any privacy notice, minimization rule, or operator consent model. This creates avoidable exposure of sensitive location and environmental data, and in a real deployment could permit tracking, inference of protected spaces, or leakage of proprietary sensor observations.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The document’s stated purpose is secure inter-agent interaction with cryptographic authentication, but the actual protocol scope expands into sensor federation, arbitration, and actuator-level coordination. In a physical multi-agent system, that scope creep is dangerous because it authorizes agents to influence perception and motion decisions far beyond identity verification, increasing the blast radius of any spoofed, faulty, or malicious peer input.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The document describes automatic override commands, forced yielding, and torque braking without safety constraints, operator transparency, or integrity checks. In a system that controls physical agents, undocumented remote override semantics are dangerous because compromised or erroneous arbitration could trigger unsafe motion changes, denial of service, collisions, or mission disruption.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file includes user-visible and instructional natural-language content primarily in Chinese, including comments, docstrings, and log/output text, without offering a language choice or documenting a justified locale restriction. This can violate language/locale policy because the skill effectively assumes a single language for operators and users.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

These log and warning messages are user-visible operational outputs, but they are written only in Chinese and do not offer any locale opt-in or fallback. That forces a specific language on users and operators, which matches the policy-violation criteria for language/locale constraints.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The manifest declares use of S2_SWARM_PKI_ROOT, which is a sensitive trust-anchor environment variable, but the markdown provides no explicit warning that the skill depends on environment-based cryptographic material. Under the code/markdown warning criteria, skills should disclose access to sensitive environment variables when no other visible warning is present.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This code reads the S2_SWARM_PKI_ROOT environment variable, which is a credential/configuration-sensitive source, but there is no visible user-facing warning, prompt, or explanatory comment in English describing that runtime environment data is being consumed. For code files, accessing sensitive environment variables should have some form of disclosure unless it is clearly documented as part of the skill's stated purpose.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.