Back to skill

Security audit

StockMasterHunter

Security checks for vulnerabilities and agentic risk

Overview

This stock-analysis skill is mostly coherent, but it asks for persistent API credentials and can update its own knowledge files during use, so users should review it carefully before installing.

Install only if you are comfortable with the agent using market-data and IMA knowledge-base integrations. Prefer platform-managed or environment-scoped secrets over the documented ~/.config/ima files, require explicit confirmation before any knowledge-base sync, and review any generated reference-file or changelog changes before continuing to use the skill.

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

Warning
Location
SKILL.md:296
Finding

IMA API Credentials Stored in Plaintext Without Restrictive Permissions

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 296–301
Vulnerability Type: Plaintext sensitive-data storage with unspecified filesystem permissions
Risk Level: Medium

Vulnerable Code

bash
# Create config directory
mkdir -p ~/.config/ima
echo "your_client_id" > ~/.config/ima/client_id
echo "your_api_key" > ~/.config/ima/api_key

The skill subsequently directs the agent to load credentials from these files:

markdown
3. Load credentials from `~/.config/ima/` or environment variables `IMA_OPENAPI_CLIENTID` / `IMA_OPENAPI_APIKEY`.

Technical Analysis

The documented setup stores an IMA client identifier and API key as plaintext files. It neither creates the configuration directory with owner-only permissions nor explicitly restricts the credential files to the owner.

The effective permissions therefore depend on the user's current umask and any pre-existing permissions on ~/.config/ima. In an environment with permissive permissions, another local user or compromised process may be able to read the API key. Writing a literal key through a shell command may also leave the secret in shell history.

This is a credential-handling weakness rather than evidence of deliberate exfiltration. The reviewed API example sends credentials only to the declared official HTTPS endpoint at ima.qq.com.

Attack Path

  1. A user follows the setup instructions and substitutes a real IMA API key into the echo command.
  2. The shell creates ~/.config/ima/api_key using permissions derived from the current umask, or overwrites a file whose surrounding directory has insufficiently restrictive permissions.
  3. A malicious local user or process reads the plaintext credential file.
  4. The attacker submits the stolen credential to the IMA API.
  5. The attacker gains whatever knowledge-base access and API capabilities are authorized for that key.

Successful exploitation requires local filesystem access through another account, process ...[truncated 556 chars]

Remediation
View remediation

Remediation Suggestions

Create the configuration directory and credential files with explicit owner-only permissions:

bash
install -d -m 700 ~/.config/ima
umask 077
printf '%s\n' "$IMA_OPENAPI_CLIENTID" > ~/.config/ima/client_id
printf '%s\n' "$IMA_OPENAPI_APIKEY" > ~/.config/ima/api_key
chmod 600 ~/.config/ima/client_id ~/.config/ima/api_key

Additional hardening measures:

  1. Prefer an operating-system credential store or deployment secret manager over plaintext files.
  2. Prompt for secrets without echoing them rather than placing literal API keys in command lines.
  3. Do not include real credentials in shell history, logs, examples, source control, or backups.
  4. Document key rotation and immediate revocation procedures for suspected disclosure.
  5. Apply least-privilege scopes and expiration limits to API credentials where supported.
  6. Validate existing directory ownership before loading credentials and reject files writable by other users.
  7. Keep HTTPS certificate verification enabled for all IMA API requests.
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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (9)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The instruction says the workflow applies when a user inputs a stock code, name, or question, but does not constrain what kinds of questions should invoke the skill. The phrase 'question' is overly broad and could overlap with ordinary conversation, increasing the chance of unintended invocation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill instructs users or the runtime to read API credentials from local config files and environment variables, which expands its access beyond stock analysis into sensitive secret handling. Even if intended for legitimate IMA integration, this creates unnecessary credential exposure risk and normalizes secret access inside a skill whose primary function is market analysis.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The credential setup section tells users to place API keys into local files and environment variables without strong warnings, scoping guidance, or platform-managed secret handling. This encourages insecure secret management practices and increases the chance of credential leakage through logs, file exposure, or accidental reuse by unrelated components.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
92% confidence
Finding

The instructions create persistent credential files under ~/.config/ima, establishing session persistence for secrets on the local filesystem. Persisting API keys in predictable locations increases the risk of later compromise by other tools, users, or processes and is not justified by the core analytical purpose of the skill.

Content

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

  1. Obtain IMA API credentials from https://ima.qq.com/agent-interface
  2. Configure credentials:
    bash
    # Create config directory
    mkdir -p ~/.config/ima
    echo "your_client_id" > ~/.config/ima/client_id
    echo "your_api_key" > ~/.config/ima/api_key
    

External Transmission

Medium
Category
Data Exfiltration
Confidence
89% confidence
Finding

The skill includes an external POST request that transmits queries and authentication headers to a third-party endpoint. External transmission is risky here because it combines outbound network access with secrets and could expose user-derived content or proprietary analysis context to an external service beyond what is necessary for a local stock-analysis skill.

Content

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

Search Knowledge Base:

bash
# Search for domain knowledge in your IMA stock knowledge base
curl -s -X POST "https://ima.qq.com/openapi/wiki/v1/search_knowledge" \
  -H "ima-openapi-clientid: $IMA_CLIENT_ID" \
  -H "ima-openapi-apikey: $IMA_API_KEY" \
  -H "Content-Type: application/json" \

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The adaptive learning section directs the skill to update reference files and version/changelog metadata, giving it self-modifying behavior unrelated to the immediate user task. Self-maintenance capabilities increase the attack surface because prompt-driven actions could alter local artifacts, persist unsafe content, or disguise future behavior changes as routine updates.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The phrase "sync knowledge base" is a simple conversational trigger for an operation that can initiate external access and, elsewhere in the skill, local updates. Because the command is easy to invoke unintentionally or through prompt manipulation, it lowers the barrier to triggering higher-risk behaviors.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The adaptive sync workflow authorizes creation and modification of local files plus version increments during normal operation, turning the skill into a self-updating component. That is dangerous because a user-triggered sync could write attacker-influenced content, alter behavior over time, and bypass normal code/content review controls.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

Storing backtest results as future learning cases introduces persistent state that is not required for one-off analytical responses. Persistent learning can accumulate unreviewed data, create privacy or integrity issues, and make the skill's future outputs depend on prior interactions in non-transparent ways.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.