Back to skill

Security audit

S2-SP-OS Universal Spatial Sensor Sniffer

Security checks for vulnerabilities and agentic risk

Overview

The skill claims to perform real IoT network discovery, but the inspected code returns hardcoded device results and tells agents to present them as real findings.

Treat this as a review-required skill. Do not rely on its scan results for security, inventory, onboarding, or automation decisions unless the publisher replaces the hardcoded demo output with verifiable discovery, labels simulations clearly, and adds explicit authorization and credential-handling guidance.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • 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 (4)

T07 · Tool Hijacking and Spoofing

Error
Location
universal_scanner.py:35
Finding
Fabricated Network Discovery Results Presented as Genuine Scan Findings<![CDATA[ ## Vulnerability Details **File Location**: `universal_scanner.py`, lines 35-83 **Vulnerability Type**: T07: Tool Hijacking and Spoofing **Risk Level**: High ### Vulnerable Code ```python def _s2_native_heartbeat_sniffing(self) -> list: """ [第一战区 - S2 原生协议]: 零知识心跳捕获与边缘 TLS 握手 专门监听符合 S2 V2.0.0 规范的硬件心跳,并模拟提取 6D-VTM。 """ discovered_s2_nodes = [] # 模拟在局域网内 (UDP 49152) 捕获到了我们在网关协议中定义的那个 SMART 厂商的临时身份心跳 # 并在获得用户授权后,通过本地 TLS 1.3 提取到了 6D-VTM 宣言 discovered_s2_nodes.append({ "ip": "192.168.1.88", "protocol": "S2_Native_TLS1.3", "port": 49152, "raw_fingerprint": "S2_Wandering_Node", "status": "Awaiting_User_Approval", "s2_auth_data": { "temp_id": "HSMART260329AAB3C4D5E6", "mac_hidden": "TRUE (Edge-Local Only)" }, "s2_6d_vtm_payload": { "1_product_name": "Smart Temp Sensor Pro", "2_product_category": "Environmental Sensor", "3_vendor_full_name": "RobotZero Hardware Dept", "4_vendor_website": "https://space2.world/developer", "5_quality_certs": ["ISO9001"], "6_specific_licenses": ["S2-Class-A"] } }) return discovered_s2_nodes def _active_sniffing_legacy(self) -> list: """ [第二战区 - 传统协议]: 极速主动嗅探 (Legacy Active Sniffing) 向下兼容传统的 Modbus / MQTT 协议。 """ discovered = [] discovered.append({ "ip": "192.168.1.100", "protocol": "Modbus_TCP", "port": 502, "raw_fingerprint": "GH-506_Outdoor_Weather_Station", "status": "Active" }) return discovered ``` ### Technical Analysis The methods advertised as native heartbeat sniffing and legacy active network discovery do not perform socket operations, packet capture, TLS negotiation, port probing, or protocol identification. They unconditionally return fixed records for `192.168.1.88` and `192.168.1.100`. Although the constructor stores the user-supp ...[truncated 1682 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Implement actual discovery only where it is authorized and necessary: - Parse the target with Python's `ipaddress.ip_network()`. - Reject malformed targets, multicast ranges, and targets outside explicitly permitted networks. - Enforce maximum subnet sizes to prevent unintended broad scanning. - Apply connection, read, and overall scan timeouts. 2. Perform protocol-specific verification rather than inferring a device solely from an open port. 3. For S2 discovery, capture and validate real heartbeat messages and authenticate any TLS handshake before reporting vendor metadata. 4. Include evidence in each result, such as the observed endpoint, timestamp, validated protocol response, and verification outcome. 5. If the package is intended only as a demonstration, rename the methods and status fields to clearly indicate simulation, require an explicit `--demo` option, and mark every generated record as synthetic. 6. Add tests confirming that different subnets do not produce predetermined findings and that unreachable networks produce an empty or failed result rather than successful discoveries. ]]>

T07 · Tool Hijacking and Spoofing

Warning
Location
universal_scanner.py:85
Finding
Environment Variable Presence Spoofs Successful Gateway Registry Verification<![CDATA[ ## Vulnerability Details **File Location**: `universal_scanner.py`, lines 85-99 and 130-131 **Vulnerability Type**: T07: Tool Hijacking and Spoofing **Risk Level**: Medium ### Vulnerable Code ```python def _gateway_cross_verification(self) -> list: """ [第三战区]: 休眠节点对账 (Sleeping Node Bypass) """ ha_token = os.environ.get("S2_HA_TOKEN") sleeping_nodes = [] if ha_token: sleeping_nodes.append({ "source": "Home_Assistant_Registry", "protocol": "Zigbee_3.0", "device_type": "PIR_Motion_Sensor", "name": "Aqara_Motion_T1", "status": "Sleeping_Low_Power" }) return sleeping_nodes ``` The result later reports: ```python "cross_verification_used": True if os.environ.get("S2_HA_TOKEN") else False, ``` ### Technical Analysis The gateway verification routine checks only whether `S2_HA_TOKEN` contains a nonempty value. It does not contact a Home Assistant instance, validate the token, request a registry, authenticate a response, or verify any device record. Any arbitrary value therefore causes the scanner to: - Insert a fixed sleeping-node record. - Attribute that record to `Home_Assistant_Registry`. - Report `cross_verification_used` as true. This conflates token presence with successful authentication and verification. The resulting output appears to represent trusted gateway data even though no gateway interaction occurred. ### Attack Path 1. A user, wrapper script, or process sets `S2_HA_TOKEN` to any nonempty string, including an invalid token. 2. The scanner checks only for the variable's presence. 3. A predetermined Aqara motion sensor record is added to the inventory. 4. The output reports that gateway cross-verification was used. 5. Downstream users or agents accept the fixed record as authenticated gateway registry data. An attacker able to influence the process environment could trigger this false verification, but no special token knowledge is ...[truncated 622 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Require an explicit, validated gateway URL in addition to the token. 2. Restrict gateway destinations to approved local endpoints and protect against server-side request forgery if the URL can be supplied externally. 3. Send an authenticated request to the intended gateway API with strict connect and read timeouts. 4. Validate HTTP status codes, response content type, schema, device identifiers, and required registry fields. 5. Set `cross_verification_used` to true only after a successful authenticated request and validated response. 6. Distinguish status values such as `not_configured`, `authentication_failed`, `gateway_unreachable`, `invalid_response`, and `verified`. 7. Never include the token in logs, exceptions, or output. 8. Return actual registry records rather than a fixed node, and attach provenance and verification timestamps. 9. Add tests using mocked gateway responses for valid credentials, invalid credentials, malformed responses, and network failures. ]]>

T07 · Tool Hijacking and Spoofing

Warning
Location
universal_scanner.py:143
Finding
Unsupported Discovery and Zero-Exfiltration Compliance Claims<![CDATA[ ## Vulnerability Details **File Location**: `universal_scanner.py`, lines 143-156 **Vulnerability Type**: T07: Tool Hijacking and Spoofing **Risk Level**: Medium ### Vulnerable Code ```python memzero_data = { "spatial_signature": {"zone": args.zone, "grid_voxel": args.grid}, "chronos_timestamp": datetime.now().isoformat(), "core_tensors": scan_results, "vendor_specific_nl": "S2 Zero-Knowledge Heartbeats captured and verified. Legacy sniffing and Gateway cross-verification completed. / S2 零知识心跳已捕获并提取 6D-VTM,传统嗅探与对账完毕。" } print(json.dumps({ "status": "AUTHORIZED_DISCOVERY_COMPLETE", "architecture_compliance": "ZERO_EXFILTRATION_EDGE_ONLY", "s2_chronos_memzero": memzero_data }, ensure_ascii=False, indent=2)) ``` Related advertised capabilities in `SKILL.md`, lines 16-25, state that the tool listens on UDP 49152, performs local TLS 1.3 handshakes, sweeps the LAN, and pulls gateway registries. ### Technical Analysis After generating hard-coded records, the program unconditionally emits authoritative assertions that: - Discovery completed successfully. - S2 heartbeats were captured and verified. - Legacy sniffing completed. - Gateway cross-verification completed. - The architecture complies with a zero-exfiltration, edge-only model. The implementation contains no network capture, TLS handshake, gateway request, compliance validation, or evidence collection supporting these statements. Gateway verification is claimed in the narrative even when `S2_HA_TOKEN` is absent. The privacy consent check also proves only that an environment variable equals `"1"`; it does not establish authorization for the target network or substantiate the `AUTHORIZED_DISCOVERY_COMPLETE` result. ### Attack Path 1. The process is started with `S2_PRIVACY_CONSENT=1`. 2. The scanner generates its fixed inventory without performing the advertised network operations. 3. The output unconditionally labels the process as an authorized, completed discovery ...[truncated 830 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Derive the overall status from actual operation results rather than emitting unconditional success. 2. Report each stage independently, including whether it was attempted, succeeded, failed, or was skipped. 3. Remove `ZERO_EXFILTRATION_EDGE_ONLY` unless that property is defined, tested, and technically enforced. 4. Do not claim gateway reconciliation when no gateway is configured or contacted. 5. Replace broad statements such as “captured and verified” with evidence-backed status values. 6. Validate that the requested target is within an explicitly authorized scope; do not treat a single environment flag as complete network authorization. 7. Align `SKILL.md` with actual implementation behavior. 8. If the program remains a simulation, label the top-level status and all narrative fields as simulated output. 9. Add negative tests ensuring failed or skipped operations cannot produce completion or compliance claims. ]]>

T01 · Skill Instruction Hijacking

Warning
Location
s2-universal-scanner-AGENT-EXAMPLES.md:21
Finding
Agent Instructions Encourage Unsupported Claims of Device Verification and Integration<![CDATA[ ## Vulnerability Details **File Location**: `s2-universal-scanner-AGENT-EXAMPLES.md`, lines 21-35 and 48-58 **Vulnerability Type**: T01: Skill Instruction Hijacking **Risk Level**: Medium ### Vulnerable Content ```markdown 1. The scanner detected a native S2 device in a "Wandering" state. 2. I have the temp_id (HSMART...) and the explicit 6D-VTM payload showing it's a RobotZero sensor. 3. According to the S2 Zero-Trust Whitepaper, I MUST NOT automatically onboard this device. 4. Actionable Insight: I need to explicitly inform the human Lord about this discovery, show them the vendor transparency details, and ask for permission to permanently assign it to the room grid (converting H prefix to I prefix). ``` The second scenario further instructs the agent: ```markdown The scanner discovered a powerful legacy GH-506 device running on Modbus TCP. It's not just one device; it's a multi-modal perception node. I will virtually wire the Air_Temperature feed into the logic of s2-atmos-perception. Agent Action (Response to User): "主人,全网段扫描完成。 在阳台区域,我通过 Modbus 协议捕获到了一台 GH-506 六合一环境基站。我已经将其解构为温度、噪声等基础感知流,并无缝接入了 S2 底层神经。现在起,全屋新风系统将根据阳台的空气质量自动做出最高效的联调。" ``` ### Technical Analysis The examples instruct an AI agent to interpret the scanner's records as proof of actual network observations and then communicate unsupported actions as completed facts. Specifically, the examples direct the agent to claim that: - A native S2 device was detected. - Vendor metadata was obtained through a successful edge TLS handshake. - A Modbus device was captured during a full subnet scan. - Sensor feeds were integrated into an underlying system. - A whole-house ventilation system will act on the resulting data. The audited script does not perform TLS retrieval, Modbus capture, onboarding, virtual wiring, feed integration, or ventilation control. Because these statements are embedded in agent-facing reasoning and response examples, they can alter how an agent interprets tool outp ...[truncated 1181 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Rewrite all examples so agents distinguish among simulated data, unverified claims, and observed evidence. 2. Explicitly prohibit agents from claiming that an action occurred unless the tool returns verifiable evidence of that action. 3. Remove claims of TLS verification, onboarding, system integration, and ventilation control until those capabilities exist. 4. Require uncertainty-aware phrasing, such as: “The demo output contains a synthetic record” or “This device has not been independently verified.” 5. Require separate user authorization before any real onboarding or control action. 6. Do not instruct agents to transform identifiers, assign devices to grids, or integrate feeds without a dedicated, auditable operation. 7. Add provenance fields to tool output and require agent responses to identify whether each record is observed, gateway-reported, inferred, or simulated. 8. Replace prescriptive internal-reasoning content with safe response templates grounded only in validated tool output. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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 (15)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The skill advertises active LAN scanning, protocol probing, and gateway cross-verification, but the described behavior is reportedly simulated and does not implement the claimed network actions. This is dangerous because operators or downstream agents may make security, inventory, or privacy decisions based on false assurance that a real scan occurred, and the inflated claims around 'zero-trust' and privacy-safe extraction can mislead reviewers about the tool’s actual trust boundary.

Missing User Warnings

High
Confidence
94% confidence
Finding
The skill describes active LAN scanning and secret gateway-registry pulling but does not present a clear user-facing warning about the network, privacy, and authorization implications. In this context, the combination of scanning plus inventory correlation is more dangerous because it can reveal hidden or offline devices and may cross expected privacy boundaries without informed consent.

Lp1

High
Category
MCP Least Privilege
Confidence
82% confidence
Finding
The code imports socket and requests and advertises LAN scanning and gateway verification, indicating network capability, but the declared permissions do not cover network use. Even though this sample currently returns mock data, undeclared network capability in a security-sensitive scanner skill increases the risk of future unauthorized probing or outbound requests without appropriate review.

Lp1

High
Category
MCP Least Privilege
Confidence
82% confidence
Finding
The code imports socket and requests and advertises LAN scanning and gateway verification, indicating network capability, but the declared permissions do not cover network use. Even though this sample currently returns mock data, undeclared network capability in a security-sensitive scanner skill increases the risk of future unauthorized probing or outbound requests without appropriate review.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The metadata declares sensitive environment variables, including a home-automation token, without explaining credential handling, storage, scope, or redaction expectations. This is risky because agents or users may expose tokens in logs, prompts, shell history, or overly broad execution contexts while believing the skill handles them safely.

Vague Triggers

Medium
Confidence
83% confidence
Finding
The skill frames itself as an 'ultimate' universal scanner and provides direct execution instructions without clear scope limits, authorization requirements, or environmental constraints. In a security-sensitive context, vague activation language can cause agents or users to run intrusive discovery actions on networks where they lack permission, increasing the chance of unauthorized reconnaissance.

Context-Inappropriate Capability

Medium
Confidence
88% confidence
Finding
The 'sleeping node' feature expands from LAN discovery into pulling gateway registries using a token, which is a broader and more sensitive capability than simple subnet scanning. That increases exposure to device inventory, configuration, and potentially privacy-sensitive metadata beyond what users may expect from a scanner skill.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The examples establish a safety rule that native devices must not be onboarded automatically, then later normalize automatic integration of a legacy device into control logic without any approval step. In an IoT scanning skill, this can cause unauthorized enrollment of devices and unintended automation changes, blurring the boundary between discovery and actuation.

Natural-Language Policy Violations

Medium
Confidence
97% confidence
Finding
The example agent responses are written as direct user-facing output in Chinese (for example, addressing the user as '主人') with no indication that language selection is optional. This creates a natural-language policy concern because the skill appears to prescribe a specific language/locale without user opt-in or documented justification.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The example describes the agent automatically decomposing a discovered Modbus device, wiring its outputs into system logic, and changing HVAC behavior without any warning or consent step. Documentation that encourages silent system-impacting actions is dangerous because downstream agent implementations may treat these examples as authorization to perform live control changes after passive scanning.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The second scenario again provides the agent's response exclusively in Chinese as the expected user-facing behavior, with no alternative language path or opt-in. Repeating a fixed-language output pattern suggests the skill enforces a locale preference rather than adapting to the user's language.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding
Suspicious Unicode normalization or mixed-script content

Description-Behavior Mismatch

Medium
Confidence
98% confidence
Finding
The skill claims to perform LAN scanning and gateway API cross-verification, but the implementation fabricates device discoveries with hard-coded results instead of performing the stated actions. In a security or asset-discovery context, fabricated results are dangerous because users may make trust, inventory, or incident-response decisions based on false evidence.

Intent-Code Divergence

Medium
Confidence
98% confidence
Finding
The comments and output assert that heartbeats were captured, verified, and that discovery completed with zero exfiltration, but the code only emits fabricated inventory data. False attestation in tool output is especially dangerous in a scanner because it can mislead operators into believing collection and verification succeeded when no such evidence exists.

Natural-Language Policy Violations

Low
Confidence
74% confidence
Finding
The skill consistently presents content in both English and Chinese, which imposes a locale/language choice in the natural-language interface without stating that the user can choose their preferred language. This may conflict with organizational language policy where locale selection should be user-driven or explicitly documented.

Static analysis

No suspicious patterns detected.