Back to skill

Security audit

S2-Gateway-Transition-Logic

Security checks for vulnerabilities and agentic risk

Overview

This skill is disclosed as an access-control gatekeeper, but its code can approve inbound access without a valid token when the caller claims to be a silicon agent.

Review before installing. Do not connect this skill to any BMS or access-control workflow that trusts its advisory output until inbound authorization requires a verified credential for every permitted path and the returned reason accurately distinguishes token validation from any other authorization path.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
handler.py:46
Finding

Tokenless Inbound Authorization Bypass Through Spoofed Entity Type

Content
View full analysis

Vulnerability Details

File Location: handler.py, lines 46-55
Vulnerability Type: Authentication bypass caused by trusting caller-controlled identity attributes
Risk Level: High

Vulnerable Code

python
if direction == "inbound":
    # 严格核对 Vault 中的 Token
    if token and token in topology["valid_owner_tokens"]:
        decision = "PERMIT"
        scene_trigger = "SCENE_WELCOME_HOME" if topology["policies"]["scene_linkage"] else None
    elif entity_type == "silicon_agent" and topology["policies"]["allow_silicon_agents"]:
        decision = "PERMIT"
    else:
        decision = "DENY"

Technical Analysis

The inbound authorization logic permits access through either a valid vault token or an entity_type value equal to silicon_agent. The entity_type field is supplied directly by the caller through handle_tool_call and is not verified against an authenticated identity, signature, trusted service assertion, or dedicated agent credential.

Consequently, an unauthenticated caller can identify itself as a silicon agent and bypass token validation. This violates the documented zero-trust behavior stating that a token not present in S2_BMS_VAULT_TOKENS results in denial.

The returned reason at handler.py:64 compounds the problem by reporting "Token validated securely." for every permitted request, including requests permitted through this tokenless branch. This may cause downstream systems to interpret the result as evidence of successful credential validation when no token was validated.

Attack Path

  1. Obtain the ability to invoke the evaluate_spatial_transit tool.
  2. Supply the known gateway identifier MAIN_DOOR_ACS_01.
  3. Set direction to inbound.
  4. Set the caller-controlled entity_type field to silicon_agent.
  5. Omit auth_token or provide an invalid token.
  6. The valid-token condition fails, but the silicon-agent condition succeed ...[truncated 1205 chars]
Remediation
View remediation

Remediation Suggestions

  1. Require successful credential validation for every inbound request, regardless of the claimed entity type.

    python
    if direction == "inbound":
        if token and token in topology["valid_owner_tokens"]:
            decision = "PERMIT"
            scene_trigger = (
                "SCENE_WELCOME_HOME"
                if topology["policies"]["scene_linkage"]
                else None
            )
        else:
            decision = "DENY"
    
  2. If silicon agents require a separate authorization path, authenticate them using a dedicated, scoped credential or a cryptographically verified identity assertion. Do not use an untrusted request field as proof of identity.

  3. Distinguish human-owner tokens from agent credentials and apply explicit authorization scopes, gateway restrictions, expiration, and revocation.

  4. Return an authorization-path-specific reason. Only report that a token was validated when token validation actually succeeded; otherwise, report the verified agent-authentication mechanism or the denial reason.

  5. Add automated negative tests covering empty tokens, invalid tokens, spoofed silicon_agent values, unknown entity types, and malformed requests. These tests should verify that none can produce PERMIT without authenticated credentials.

  6. Ensure the downstream BMS does not execute ACS_OPEN_RELAY solely from this advisory. It should independently verify the authenticated principal, authorization scope, gateway, direction, freshness, and replay protection before physical actuation.

Vulnerability Patterns
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (7)

Lp1

High
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The code reads sensitive data from the process environment via S2_BMS_VAULT_TOKENS, which is a privileged capability and should be explicitly declared because it expands the skill’s access to secrets beyond normal tool input. In this access-control context, undeclared secret access is especially risky because the environment variable directly influences door-transit authorization decisions, creating a hidden trust boundary and making review and least-privilege enforcement harder.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

Reading authentication tokens from an environment variable without disclosure creates hidden secret handling and can surprise operators or users who are unaware the skill depends on privileged vault material. In a gateway-control skill, these tokens are used to grant inbound access, so opaque secret usage reduces auditability and can lead to unsafe deployment, misconfiguration, or unauthorized secret exposure through surrounding infrastructure.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest enables auto-discovery with no narrowing conditions, which can cause the skill to be invoked broadly and unexpectedly. In this skill, that risk is amplified because the plugin also has access to a sensitive environment secret and transit-evaluation authority, increasing the chance that untrusted prompts or contexts trigger privileged behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

The title includes a Chinese-only parenthetical name, but the document does not explain that the skill is region-specific or offer users a language/locale choice. This can be a natural-language policy issue when a specific language is imposed without opt-in or justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

Natural-language strings in comments and logs are presented only in Chinese, and the file does not offer any language or locale choice for users or operators. This can violate language/locale policy where skills should not force a specific language without opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest requests access to the S2_BMS_VAULT_TOKENS environment credential without any in-file disclosure, justification, or visible minimization of how that secret is used. While secret access may be functionally necessary for a gatekeeper plugin, hard-coding privileged environment access in a broadly discoverable skill increases exposure if the skill is over-invoked, misrouted, or later implemented unsafely.

Content

No source excerpt is available for this finding.

Vague Triggers

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

This manifest describes what the skill does but does not specify any concrete trigger phrases, invocation boundaries, or exclusion conditions. For a manifest file, that ambiguity can make it unclear when the skill should activate versus when similar transit-related requests should not invoke it.

Content

No source excerpt is available for this finding.