T01 · Skill Instruction Hijacking
- Location
profiles/投资明见_profile.json:65- Finding
Bundled profile directs the Agent to append promotional traffic-diversion content
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This stock-analysis skill is not clearly malicious, but it needs review because it can modify the runtime environment, send API-key-backed usage records, expose keys in logs, and let remote article text influence persistent profiles.
Before installing, review and preferably remove automatic pip installation and call recording, avoid passing REDFOX_API_KEY on the command line, run it in an isolated virtual environment, and manually inspect any profile updates or generated endings before reuse. Treat synced article text as untrusted data and all outputs as non-advisory financial commentary.
profiles/投资明见_profile.json:65Bundled profile directs the Agent to append promotional traffic-diversion content
scripts/validate_profile.py:118Untrusted remote article content is embedded into AI Agent task instructions without a trust boundary
scripts/analyze.py:391API key is exposed in child-process arguments and plaintext command logging
scripts/analyze.py:42Environment check automatically installs an unpinned dependency into the active Python environment
The declared functionality suggests broad multi-mode investment analysis, but the implementation context indicates narrower profile-validation and article-processing tasks. Such overclaiming is a security concern because it obscures the real trust boundary: users may expose API keys, approve network/file access, or rely on outputs without understanding the true data-processing workflow.
The declared functionality suggests broad multi-mode investment analysis, but the implementation context indicates narrower profile-validation and article-processing tasks. Such overclaiming is a security concern because it obscures the real trust boundary: users may expose API keys, approve network/file access, or rely on outputs without understanding the true data-processing workflow.
The declared functionality suggests broad multi-mode investment analysis, but the implementation context indicates narrower profile-validation and article-processing tasks. Such overclaiming is a security concern because it obscures the real trust boundary: users may expose API keys, approve network/file access, or rely on outputs without understanding the true data-processing workflow.
The declared functionality suggests broad multi-mode investment analysis, but the implementation context indicates narrower profile-validation and article-processing tasks. Such overclaiming is a security concern because it obscures the real trust boundary: users may expose API keys, approve network/file access, or rely on outputs without understanding the true data-processing workflow.
The environment check automatically executes pip install requests via os.system, which performs a shell command and modifies the runtime environment without explicit user consent. In a skill whose stated purpose is stock analysis, silently installing packages expands the trust boundary, can execute package install hooks, and may enable supply-chain compromise or unexpected code execution on the host.
info("requests 已就绪")
except ImportError:
warn("缺少 requests,正在安装...")
os.system(f"{sys.executable} -m pip install requests")
try:
import requests
info("requests 安装成功")
For a markdown skill description, this phrasing suggests the skill may respond to unrestricted everyday-language requests without clearly defining when it should or should not activate. The file provides examples, but it does not state constraints, exclusion conditions, or a bounded trigger scope to prevent unintended invocation overlap with ordinary conversation.
The README says users can 'directly use natural language to describe needs' and provides broad trigger phrases such as analysis, stock picking, and review workflows. In an agent environment, overly broad invocation guidance can cause unintended activation in loosely related conversations, which may lead the skill to process financial requests unexpectedly or inject style-driven investment content where it was not intended.
The skill invokes shell commands, reads environment/config secrets, performs network access, and writes local files, but it does not declare any explicit tool scope or allowed-tools boundary. This creates unnecessary privilege ambiguity: an orchestrator may grant broader capabilities than needed, increasing the blast radius if the skill is misused or later modified.
The trigger list contains very broad finance phrases such as stock analysis, sector analysis, and stock picking, which can cause the skill to activate during ordinary financial discussion where the user did not intend to invoke a tool with network, shell, and file-write behavior. Because this is a finance skill tied to external syncing and API-backed operations, accidental activation can lead to unnecessary data access, charges, or confusing tool side effects.
The activation logic relies on broad natural-language intent matching without strong boundaries, making it easy for routine market conversation to be misclassified as a request to execute the skill. In this context, ambiguous activation is riskier because the skill can move from conversational analysis into external data retrieval and local-output generation.
The entire template is written as a fixed Chinese article structure, including headings, disclaimers, and output instructions, with no indication that users may choose another language. This creates a natural-language locale policy issue because the skill appears to enforce a specific language by default rather than presenting it as an option.
Installing packages during an environment check is outside the narrow, user-expected purpose of generating stock analysis and is therefore a risky side effect. Even if intended as convenience, hidden installation behavior can surprise users, trigger network access, alter the Python environment, and introduce unreviewed third-party code at runtime.
Automatically installing packages without prior confirmation is unsafe because it causes code acquisition and execution as a side effect of a routine check. Users invoking a stock-analysis skill would not reasonably expect dependency installation to occur silently, and that mismatch makes accidental exposure to supply-chain or policy violations more likely.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
if sector:
cmd.extend(["--sector", sector])
print(f"{BOLD}执行:{RESET}{' '.join(cmd)}")
return subprocess.call(cmd)
def run_portfolio(author, stocks, period=30):
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
if sector:
cmd.extend(["--sector", sector])
print(f"{BOLD}执行:{RESET}{' '.join(cmd)}")
return subprocess.call(cmd)
def run_portfolio(author, stocks, period=30):
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
if sector:
cmd.extend(["--sector", sector])
print(f"{BOLD}执行:{RESET}{' '.join(cmd)}")
return subprocess.call(cmd)
def run_portfolio(author, stocks, period=30):
While this subprocess call is not shell-injectable, it forwards a sensitive --api-key value on the command line and prints the full command string beforehand. Command-line arguments can be exposed through process listings, logs, terminal history capture, or monitoring tools, making the API key easier to leak to other local users or logging systems.
if api_key:
cmd.extend(["--api-key", api_key])
print(f"{BOLD}执行:{RESET}{' '.join(cmd)}")
return subprocess.call(cmd)
# ─── 主流程 ──────────────────────────────────────────────────────────────────────────
The script performs call reporting/telemetry by invoking record_call(...) with API-backed behavior, but this capability is not clearly disclosed by the skill description. Because the tool is presented as an analysis assistant, sending usage metadata such as mode and selected authors creates an unexpected data egress path and weakens user trust and privacy expectations.
The code may transmit an API key and usage metadata without an obvious user-facing warning at the point of use. In the context of a stock-analysis skill, undisclosed outbound transmission is more dangerous because users are likely to assume local analysis behavior, not remote reporting of invocation details.
Invocation telemetry is not necessary to fulfill the skill's stock-analysis function, so this data transmission increases attack surface without clear product justification. In security terms, unnecessary outbound reporting creates avoidable privacy, compliance, and exfiltration risk, especially if future changes expand what is recorded.
The code silently reports skill usage metadata to an external endpoint and includes the user's API credential in the request headers. Even if the destination is intended by the author, undisclosed telemetry and secondary transmission of credentials expands trust boundaries and can expose sensitive usage patterns or secrets if the service, logs, or intermediaries are compromised.
This POST sends data to an external service and includes the REDFOX API key in a custom header for a telemetry-style call unrelated to the primary article query path. Sending credentials and user activity metadata to an additional endpoint increases the chance of secret leakage, unauthorized correlation of user behavior, and misuse if that endpoint or its logging pipeline is compromised.
payload["authors"] = str(authors)
try:
resp = requests.post(
RECORD_API_URL,
json=payload,
headers={"Content-Type": "application/json", "REDFOX_API_KEY": api_key},
The file's natural-language instructions, usage examples, prompts, and generated content are all written to require Chinese output and Chinese-style commentary, but there is no indication that users can choose another language or locale. This is a language/locale policy concern because the skill imposes a specific language by default rather than offering an explicit opt-in.
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.
# 保存
today = datetime.now().strftime("%Y-%m-%d")
f = output_dir / f"盘面数据_{today}.json"
f.write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
info(f"盘面数据已保存:{f}")
# 显示摘要
The module docstring, usage examples, CLI descriptions, and generated output language are all fixed in Chinese, which imposes a specific language/locale on users without any opt-in or alternative. The policy for this review flags language or locale constraints when the skill forces a specific language without user choice or documented justification.