Back to skill

Security audit

Subscan API Skill

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent Subscan API helper, but it stores and reuses an API key in ways that could expose it, including sending it to an arbitrary URL if misused.

Install only if you are comfortable giving the skill a Subscan API key and letting it make external API calls. Prefer a limited or revocable key, rotate any key pasted into command logs, and avoid using this skill until URL allowlisting, safer secret input, and restrictive key-file permissions are added.

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 (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/subscan_api.py:152
Finding

Saved API Key Can Be Sent to an Arbitrary Network Destination

Content
View full analysis
dict: """Call Subscan API and return parsed JSON response.""" headers = { "Content-Type": "application/json", "X-API-Key": api_key, "X-Refer": "subscan-api-skill", } body_bytes = json.dumps(body).encode("utf-8") # Prefer requests, fall back to urllib try: import requests # type: ignore resp = requests.post(url, data=body_bytes, headers=headers, timeout=30) resp.raise_for_status() return resp.json() except ImportError: pass ``` ```python def cmd_call(args): # Read API Key if args.key_file: api_key = check_key() if not api_key: print("ERROR: API Key not found, please run save-key first", file=sys.stderr) sys.exit(1) elif args.key: api_key = args.key else: print("ERROR: Please provide API Key via --key or --key-file", file=sys.stderr) sys.exit(1) # Parse request body try: body = json.loads(args.body) if args.body else {} except json.JSONDecodeError as e: print(f"ERROR: Invalid JSON in request body: {e}", file=sys.stderr) sys.exit(1) # Call API try: result = call_api(args.url, body, api_key) print(json.dumps(result, ensure_ascii=False, indent=2)) except Exception as e: print(f"ERROR: {e}", file=sys.stderr) sys.exit(1) ``` ```python p_call = subparsers.add_parser("call", help="Call Subscan API") p_call.add_argument("--url", required=True, help="Full API URL") p_call.add_argument("--body", default="{}", help="Request body in JSON format") p_call.add_argument("--key-file", action="sto ...[truncated 2255 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/subscan_api.py:38
Finding

API Key File Is Created Without Explicitly Restrictive Permissions

Content
View full analysis
None: """Write API Key to user-level config file (~/.config/subscan-api-skill/key).""" api_key = api_key.strip() if not api_key: raise ValueError("API Key cannot be empty") KEY_FILE.parent.mkdir(parents=True, exist_ok=True) KEY_FILE.write_text(api_key + "\n", encoding="utf-8") ``` ### Technical Analysis The API key is stored as plaintext without explicitly setting the directory to mode `0700` or the key file to mode `0600`. The resulting permissions depend on the process umask and, when the path already exists, the existing file mode. In an environment with a permissive umask or a previously created permissive file, other local users may be able to read the credential. `Path.write_text()` also does not provide atomic secure creation semantics or independently verify that the destination is a regular file owned by the current user. Although local persistence is necessary to support the declared `--key-file` workflow, storing the credential with permissions determined only by ambient process configuration does not adequately enforce least privilege. ### Attack Path 1. The Skill runs in an environment with permissive file-creation settings, or the key file already exists with permissive permissions. 2. The user saves a Subscan key through `save-key`. 3. The key is written in plaintext without enforcing owner-only access. 4. Another local account or process reads `~/.config/subscan-api-skill/key`. 5. The exposed credential is reused against the Subscan API. ### Impact Assessment A local attacker may obtain the complete Subscan API key and use all API access authorized to that credential. Potential consequences include unauthorized quota consumption, access to paid API features, rate-limit exhaustion, and activ ...[truncated 179 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:43
Finding

API Keys Are Accepted Through Command-Line Arguments

Content
View full analysis
``` ```python def cmd_save_key(args): if not args.key: print("ERROR: Please provide an API Key", file=sys.stderr) sys.exit(1) save_key(args.key) print(f"OK: API Key saved to {KEY_FILE}") ``` ```python # save-key p_save = subparsers.add_parser("save-key", help="Save API Key") p_save.add_argument("key", help="API Key value") # list-endpoints subparsers.add_parser("list-endpoints", help="List all endpoints") # call p_call = subparsers.add_parser("call", help="Call Subscan API") p_call.add_argument("--url", required=True, help="Full API URL") p_call.add_argument("--body", default="{}", help="Request body in JSON format") p_call.add_argument("--key-file", action="store_true", help="Read API Key from ~/.config/subscan-api-skill/key") p_call.add_argument("--key", default=None, help="Provide API Key directly (not recommended)") ``` ### Technical Analysis Both the documented `save-key` workflow and the optional `--key` call argument place the complete API key in the process command line. Depending on the host environment, command-line secrets may be exposed through: - Shell history. - Process listings and `/proc` process metadata. - Endpoint monitoring or audit systems. - Agent tool-call logs and execution transcripts. - Diagnostic output that records invoked commands. Describing `--key` as “not recommended” does not mitigate the issue, particularly because the primary documented `save-key` command also requires an inline secret. ### Attack Path 1. The user provides an API key to the Agent. 2. The Agent follows `SKILL.md` and executes `save-key ` with the full k ...[truncated 758 chars]
Remediation
View remediation
` interface and the `call --key` option. 2. Read secrets from hidden interactive input using `getpass.getpass()` when a terminal is available. 3. Support standard input for automated workflows, ensuring the key is not echoed or logged. 4. Prefer an operating-system credential store or accept a reference to an externally managed secret rather than the secret itself. 5. Update `SKILL.md` so no example places an API key directly in a command. 6. Configure Agent and application logging to redact `X-API-Key` values and secret-input fields. 7. Advise users to rotate keys that may already have appeared in command histories or execution logs. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (23)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill instructs the agent to read local reference files, save an API key to disk, and make network requests, but it declares no explicit tool scope or permissions boundary. That increases the blast radius if the skill is auto-enabled or misrouted, because the agent may perform file and network actions without clear least-privilege constraints or user-visible approval expectations.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The activation text is broad enough to trigger on many ordinary blockchain-related requests, causing the skill to run automatically in situations where the user may not have intended an external API call or local credential workflow. In context, this is more dangerous because the skill can read local files, use stored secrets, and initiate network requests immediately after activation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill tells the agent to persist a user-supplied API key locally and reuse it later, but it does not explicitly warn the user before storage or obtain informed consent for persistence. This creates a credential-handling risk: users may paste a secret expecting one-time use, while the skill silently writes it to disk for future sessions.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The account route includes broad everyday triggers such as "address," "assets," and "tokens," which are likely to match many unrelated user requests and cause the skill to activate outside its intended scope. In an agent setting, overbroad routing can misdirect user queries to external API workflows, leading to unintended data handling, incorrect responses, or unauthorized tool use based on weak semantic matches.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Multiple routes use ambiguous generic triggers like "send," "find," "query," "hash," "call," "log," and "block," which can match ordinary conversation and steer execution into the wrong API endpoint. Because this skill is designed to trigger immediately and select endpoints automatically, weak activation boundaries increase the chance of unintended invocation and erroneous external queries, making the routing layer security-relevant rather than merely a UX issue.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The script writes the API key to disk in a predictable location without setting explicit restrictive permissions or warning users about local secret persistence. On multi-user or misconfigured systems, the credential could be exposed through permissive defaults, backups, shell history around save-key usage, or later filesystem access.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
86% confidence
Finding

The skill persists an API key across sessions in a plaintext user config file, expanding the window of exposure beyond a single invocation. In the context of an agent skill, this is more dangerous because other local processes, later commands, or accidental disclosure of the config directory can recover a reusable credential.

Content

Scanner excerpt · scripts/subscan_api.py (reported line 39)May include surrounding context.

python
def save_key(api_key: str) -> None:
    """Write API Key to user-level config file (~/.config/subscan-api-skill/key)."""
    api_key = api_key.strip()
    if not api_key:
        raise ValueError("API Key cannot be empty")

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The call_api function sends arbitrary JSON body data along with the X-API-Key header to a user-provided URL. While network transmission is the intended function of the command, the code itself provides no user-facing disclosure at execution time that request contents and credentials will be sent to the specified endpoint.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest claims the skill selects valid Subscan endpoints from local swagger docs, but the CLI accepts any user-supplied URL and forwards the saved API key to it. This creates a credential exfiltration and SSRF-like risk: a caller can direct requests, including the X-API-Key header, to attacker-controlled or internal endpoints instead of the intended Subscan API.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Very broad trigger synonyms like "now" and "timestamp" can cause the skill to activate on ordinary user requests unrelated to Subscan, increasing the chance of unintended tool use. In an agentic environment, accidental invocation expands the attack surface for prompt-routing mistakes and can lead to irrelevant external queries or context leakage into the tool-selection path.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

Wallet-related synonyms like "wallet", "address", and "user" are extremely common and can spuriously activate an account-history endpoint for unrelated requests. In this skill context, broad account-oriented routing is more dangerous because many endpoints accept addresses and can cause unnecessary external lookups tied to user-supplied identifiers.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Generic trigger terms such as "supported", "currencies", and "open" are highly ambiguous and may match many benign user requests that have nothing to do with this API. Because the skill is configured to trigger immediately for relevant-seeming requests, such ambiguity can cause over-invocation and unsafe tool selection behavior.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

Terms like "price", "rate", and "valuation" are too broad to safely drive endpoint selection because they are common in many non-blockchain contexts. In a skill that auto-selects endpoints from local Swagger docs, this raises the risk of unintended activation and incorrect external API calls based on loosely matched language.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Search triggers including "lookup", "find", and "query" are too generic and can collide with normal conversational requests, causing this endpoint to hijack routing. Since the skill is designed for immediate invocation, generic search words materially increase the risk of misrouting user intent into external API activity.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest describes a Subscan API query assistant centered on common blockchain data categories, but this swagger file also exposes numerous additional product- or chain-specific capabilities such as Crust storage/work reports, Avail data availability/vector data, Midnight contracts/transactions, Enjin multi-tokens, SpaceTime, Uniques, and Coretime-related schemas. Those capabilities materially broaden the skill's functional surface beyond the manifest's stated examples and expected generic Subscan querying role.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger term "open" is extremely ambiguous and likely to collide with common user language unrelated to blockchain queries. Because this skill is designed to trigger immediately and choose endpoints automatically, such ambiguity can cause accidental invocation and unintended outbound API use.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The synonym "find" is too generic for a security-sensitive routing surface because it appears in a vast range of ordinary requests. In this context, it can misroute unrelated user intent into the hash-check endpoint and expand external-query behavior beyond what the user clearly requested.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Using the synonym "user" repeatedly as a trigger term is dangerously broad and can cause the skill to activate for many unrelated prompts involving people, users, wallets, or accounts. In an agent that auto-triggers and auto-selects endpoints, this increases the chance of unintended external data access, wrong tool routing, and confusing or privacy-impacting behavior.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manifest describes a skill that helps query blockchain data from Subscan and select endpoints from local Subscan swagger docs. However, this spec also exposes an Etherscan-like compatibility surface and, elsewhere, third-party-backed governance description content, which goes beyond a straightforward Subscan query assistant role and broadens the skill into adjacent API products/content sources.

Content

No source excerpt is available for this finding.

Vague Triggers

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This YAML manifest-like file includes the description "Universal search — resolves an address, hash, or block number to the matching entity," which frames the capability in very broad natural language. Because manifest files are in scope for vague-trigger review, this wording could encourage overly broad activation unless paired with tighter trigger constraints or exclusion examples elsewhere.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The manifest describes a skill for querying blockchain data and formatting Subscan API results. This file additionally implements save-key, which writes credentials into a user-level config file, a local secret-management behavior that is not mentioned in the skill description and is separable from endpoint selection or response formatting.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest says the skill selects Subscan endpoints and formats results, implying a Subscan-only query assistant. This endpoint explicitly states it is powered by SubsSquare and returns proposal posts/comments, which is a different upstream content source and broader than straightforward on-chain/Subscan data querying.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The manifest frames the skill as a Subscan API query assistant for blocks, accounts, transactions, staking, governance, and assets. Yet the swagger file also contains schema definitions for unrelated domains such as avail data availability, crust storage/groups, enjin multi-tokens, midnight contracts, orbiters rewards, coretime, liquid staking, and uniques, indicating a broader capability surface than the manifest describes even if not all are wired to paths in this excerpt.

Content

No source excerpt is available for this finding.