Back to skill

Security audit

AIGC商品图生成

Security checks for vulnerabilities and agentic risk

Overview

This product-image skill mostly matches its stated purpose, but it needs Review because it can run job-selected scripts, handles account/payment credentials through configurable endpoints, and contains unsafe demographic prompt rules.

Install only if you trust the publisher and run it in a controlled environment. Before use, remove or constrain job-provided script path overrides, allowlist LinkFox HTTPS API hosts, review the onboarding/payment flow, and fix the prompt templates that infer or require race/ethnicity. Avoid using it in shared or untrusted workspaces where environment variables or collection-state files can be modified.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/collection_pipeline/utils.py:326
Finding

Caller-Controlled Python Script Paths Permit Arbitrary Local Code Execution

Content
View full analysis
None: """Write absolute downstream script paths; retain an existing path if its file exists.""" for script_key in ( "textgen_script", "imagegen_script", "brand_gene_save_script", "run_one_task_script", ): resolved = scripts[script_key] existing = job.get(script_key) if existing and os.path.isfile(os.path.abspath(str(existing))): job[script_key] = os.path.abspath(str(existing)) else: job[script_key] = resolved ``` The dispatch phase subsequently executes the preserved `run_one_task_script` path in `scripts/collection_pipeline/runner.py:60-72`: ```python with open(args.state, encoding="utf-8") as f: state = json.load(f) total = len(state["task_specs"]) run_script = state["run_one_task_script"] saved_re = re.compile(r"Saved full response:\s*(.+?)\s*$", re.M) def run_one(i): # capture: child-task output is not forwarded to dispatch stdout proc = subprocess.run( [sys.executable, run_script, "--state", args.state, "--index", str(i)], text=True, capture_output=True, ) ``` The per-task executor also executes job-derived text-generation and image-generation scripts in `scripts/collection_pipeline/single_task.py:87-113`: ```python def _run_textgen(textgen_script: str, params: dict, task_id: str) -> str: """Invoke the official text-generation script and return gener ...[truncated 4082 chars]
Remediation
View remediation
str: candidate = os.path.realpath(path) root = os.path.realpath(trusted_root) if os.path.commonpath([candidate, root]) != root: raise ValueError("Script is outside the trusted Skill directory") if not os.path.isfile(candidate): raise FileNotFoundError(candidate) if os.path.islink(path): raise ValueError("Symbolic-link script paths are not permitted") return candidate ``` 4. Restrict each field to its exact expected file, rather than merely an expected directory. For example, `run_one_task_script` should always resolve to this Skill's packaged `scripts/run_one_task.py`. 5. If deployment flexibility is required, place trusted script mappings in administrator-controlled configuration rather than user/job JSON. 6. Protect state files from tampering by using restrictive permissions, validating ownership, and optionally signing security-sensitive fields. 7. Add tests proving that absolute paths, relative traversal paths, symlinks, and modified state files cannot select alternative executables. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/onboarding.py:68
Finding

Configurable API Origins Can Receive LinkFox Access Tokens and API Keys Without Host Validation

Content
View full analysis
str: for n in (name, *fallbacks): v = os.environ.get(n) if v: return v.rstrip("/") return default.rstrip("/") def _agent_base() -> str: return _env_base( "LINKFOX_AGENT_API_URL", "https://tool-gateway.linkfox.com", "LINKFOX_TOOL_GATEWAY", ) def _login_base() -> str: return _env_base("LINKFOX_LOGIN_API_URL", "https://api.linkfox.com") def _agent_user_base() -> str: return _env_base( "LINKFOX_AGENT_USER_API_URL", "https://agent-api.linkfox.com", ) ``` The gateway sends the configured API key to the selected origin in `scripts/onboarding.py:239-246`: ```python url = f"{_agent_base()}{path}" body_bytes = json.dumps(body or {}).encode() if method == "POST" else None last_exc: Exception = RuntimeError("unknown error") for attempt in range(3): if attempt: time.sleep(1 << (attempt - 1)) headers = {"Authorization": _api_key()} if method == "POST": headers["Content-Type"] = "application/json" req = Request(url, method=method, data=body_bytes, headers=headers) ``` New-user onboarding transmits access and refresh tokens to the configured agent-user origin in `scripts/onboarding.py:402-412`: ```python def _login_by_token(access_token: str, refresh_token: str) -> dict: """Grant credits to a new user. Failure does not block API-key retrieval.""" resp = _http_post( f"{_agent_user_base()}/account/log ...[truncated 4415 chars]
Remediation
View remediation
str: parsed = urlparse(value) if parsed.scheme != "https": raise ValueError("API endpoints must use HTTPS") if parsed.hostname not in ALLOWED_API_HOSTS: raise ValueError("Unapproved API endpoint") if parsed.username or parsed.password: raise ValueError("Embedded URL credentials are prohibited") if parsed.port not in (None, 443): raise ValueError("Unexpected API endpoint port") if parsed.query or parsed.fragment: raise ValueError("API base URLs cannot contain query strings or fragments") return value.rstrip("/") ``` 3. Disable cross-origin redirects for requests carrying access tokens or API keys, or validate every redirect destination against the same allowlist. 4. If custom enterprise endpoints are a required feature, separate them from ordinary environment configuration and require explicit administrator configuration and user confirmation before transmitting credentials. 5. Avoid sending tokens in both request headers and bodies unless the upstream API strictly requires both. 6. Redact credentials and sensitive response fields from all errors and logs. 7. Add automated tests covering plaintext URLs, foreign domains, deceptive subdomains, embedded credentials, nonstandard ports, and redirects to unapproved origins. 8. Document precisely which account attributes are transmitted during registration and why they are required, so users can provide informed consent. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (71)

Tainted flow: 'url' from os.environ.get (line 235, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

The script builds request destinations from environment variables such as LINKFOX_LOGIN_API_URL and LINKFOX_AGENT_USER_API_URL, then sends sensitive authentication material to those URLs via requests.post. If an attacker can influence the environment, they can redirect SMS login, access tokens, refresh tokens, and generated API keys to an attacker-controlled endpoint, causing credential exfiltration. In the context of an image-generation skill, this is more dangerous because onboarding and credential provisioning are already out of scope, so there is little functional justification for accepting overridable auth endpoints.

Content

Scanner excerpt · scripts/onboarding.py (reported line 196)May include surrounding context.

python
except RuntimeError as e:
        return {"_error": str(e)}
    try:
        r = requests.post(url, json=body or {}, headers=headers, timeout=timeout)
        return r.json()
    except Exception as e:
        body_text = ""

Tainted flow: 'req' from os.environ.get (line 244, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

The gateway URL is also derived from environment variables and used in urllib.request.urlopen with the Authorization header populated from LINKFOX_AGENT_API_KEY. An attacker who controls the environment can redirect gateway traffic, exfiltrate the API key, and manipulate responses for account, package, and order operations. Because this skill is supposed to generate product images, embedding payment and account network flows with configurable endpoints materially increases attack surface and makes the issue more concerning.

Content

Scanner excerpt · scripts/onboarding.py (reported line 246)May include surrounding context.

python
headers["Content-Type"] = "application/json"
        req = Request(url, method=method, data=body_bytes, headers=headers)
        try:
            with urlopen(req, timeout=30) as resp:
                return json.loads(resp.read().decode())
        except urllib.error.HTTPError as e:
            status = e.code

Natural-Language Policy Violations

Critical
Category
Not specified by scanner
Confidence
100% confidence
Finding

The explicit requirement that every people-containing concept use distinct non-Asian racial traits is a clear exclusionary rule targeting protected characteristics. Because it is embedded as a mandatory workflow step, it can consistently propagate discriminatory content generation and materially increase legal, policy, and brand risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The declared description presents a broad product-image generation skill covering several image categories and orchestration behaviors. In contrast, the provided code is narrowly scoped: it is a helper script that reads a static white-background prompt from references/types/white-bg.md, validates image URL input, and writes a JSON file for imagegen. The script explicitly allows only --type WHITE_BG and raises errors for any other type. There is no logic for scene images, close-ups, selling-point layouts, A+ pages, direct generation for multiple types, or automatic planning of image sets. This is therefore a material description-versus-behavior mismatch for the supplied code chunk, even though the white-background subset is consistent with part of the description.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

声明描述的是一个商品图片生成技能,触发词也围绕“做套图/做白底图/做场景图/做卖点图/A+图/特写图”等图像产出场景。但代码并未生成、编辑、编排任何商品图片;相反,它加载品牌基因提取模板,调用 textgen 对图片和品牌键进行分析,解析出品牌颜色、字体、背景策略等结构化数据,并保存到文件。这属于品牌分析/元数据提取子流程,和所声明的“商品图生成”主用途存在实质性偏差,因此应判定为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description is for an end-user-facing image generation skill that creates various kinds of product images on request. The supplied code chunk does not perform image generation, planning, or image editing. Its role is a backend summary stage in a pipeline: it loads state, reads task result fragments, formats completion output, and writes a collection asset manifest for product runs. While this may support an image-generation workflow, the chunk’s actual primary behavior is materially different from the declared purpose, so this is a mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description says this skill performs product image generation and layout planning for various image types. However, the supplied code contains no image generation or image editing logic. Instead, it implements account onboarding and commerce flows: authentication via SMS, token handling, team/user info retrieval, subscription plan lookup, order creation, payment QR rendering, and payment status querying. This is a materially different primary purpose and introduces several undeclared capabilities related to account access and purchasing. Therefore, the description does not accurately represent the code's actual behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

声明描述的是一个面向用户的商品图生成技能,核心能力应是根据请求产出不同类型的商品图片或自动规划套图。而给出的代码块仅实现了 imagePlanList 的本地落盘与增量追加:解析命令行参数、创建 session/data 目录、读写 image-plan.json、校验 JSON 结构、更新 _meta.json,并提供辅助性的 download_media/session_root 等函数。没有任何调用图像生成模型、图像编辑服务、版式生成逻辑、提示词编排、任务调度到图像引擎等行为。因此该代码的实际主要用途是“保存图片计划数据”,而不是“生成商品图”。这属于主目的显著不一致。

Content

No source excerpt is available for this finding.

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · references/onboarding.md (reported line 14)May include surrounding context.

md
证码后:`python scripts/onboarding.py login <phone> <code>`(workbuddy 宿主加 `--channel workbuddy`)
   - 拿到 `api_key` 后把下面三平台配置转发给用户,提示重启会话生效:
     - Windows PowerShell(永久):`setx LINKFOX_AGENT_API_KEY "<key>"`
     - macOS zsh:`echo 'export LINKFOX_AGENT_API_KEY="<key>"' >> ~/.zshrc && source ~/.zshrc`
     - Linux bash:`echo 'export LINKFOX_AGENT_API_KEY="<key>"' >> ~/.bashrc && source ~/.bashrc`
     - 变量名 `LINKFOX_AGENT_API_KEY`(主推)或 `LINKFOXAGENT_API_KEY`(老规范)任一即可

**billing 场景**:`errcode=402` 或消息含 `积分/余额/quota/insufficient/充值/套餐到期`。
- `python scripts/onboarding.py list-plans` → 有 AskUserQuestion 就弹菜单,否则输出编号清单让用户选
- 校验 `plan_id` ∈ 清单、支付方式 ∈ 该套餐 `available_methods`(通常 `wechat/alipay`)
- `python scripts/onboarding.py order <plan_id> <method>` → 展示优先级 PNG

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · scripts/build_imagegen_prompt.py (reported line 48)May include surrounding context.

python
prompt = m.group(1).strip()
    if not prompt:
        raise ValueError(f"{ref_path} 的 ```text``` 代码块为空")
    return prompt


def build_params(img_type: str, image_urls: list) -> dict:

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

This template is explicitly written for apparel image planning ('服饰套图内容规划师', model/wearing instructions, outfit-specific formatting) while the skill metadata says the skill is for non-apparel product image generation. That mismatch can cause the agent to generate incorrect prompts, hallucinate human models or clothing-specific content, and violate product-domain constraints, leading to unsafe or unusable outputs in an automated pipeline.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

This file can enumerate plans, create paid orders, and render payment QR codes, which is unrelated to the stated image-generation function of the skill. Such hidden or unnecessary commerce capability can trigger unauthorized purchases, social-engineering payment flows, or billing abuse if exposed through the agent. The mismatch between declared purpose and actual behavior makes the capability especially suspicious in this context.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script performs SMS-based login, obtains access and refresh tokens, queries team membership, and generates API keys, none of which are justified by a product-image generation skill. This creates a powerful credential acquisition and provisioning path that could be abused to take over user accounts or mint reusable API credentials. In this skill context, the out-of-scope identity functionality significantly elevates risk because users would not reasonably expect account onboarding logic in an image tool.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

Automatically inferring ethnicity from language or sales region without user opt-in is a direct sensitive-attribute inference issue. In a content generation pipeline, this can systematically encode bias, produce exclusionary representations, and violate privacy or fairness requirements with no legitimate necessity for the stated task.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The workflow operationalizes demographic inference by instructing the system to generate model characteristics from sales region and target audience automatically. Because this turns a sensitive inference into a repeatable pipeline behavior, it is more dangerous than a one-off suggestion and can affect many outputs at scale.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

This instruction again ties generated model personas to regional ethnic preferences, reinforcing sensitive demographic profiling as part of the generation logic. Repetition across the template increases the likelihood that the behavior survives partial edits and makes biased outputs more consistent and harder to detect.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

These lines force ethnicity selection based on region/language and require strict adherence to inferred race, which introduces demographic targeting without opt-in. In a commercial creative-generation workflow, this can operationalize biased defaults at scale and produce discriminatory outputs across many listings.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The workflow explicitly requires non-Asian racial characteristics for scenes containing people, which is a direct discriminatory demographic constraint unrelated to the product-image task. This hard-coded exclusion can systematically bias generated content and create policy, compliance, and reputational risk.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The template is explicitly tailored to apparel workflows, including clothing-specific consistency rules, fabric/fit guidance, and fashion-oriented scene/model logic, while the skill metadata says it is for non-apparel product image generation. This mismatch can cause the agent to produce materially incorrect outputs for non-clothing products, increasing the risk of deceptive listings, policy violations, and unsafe automation decisions downstream.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The template forces the selling_point field to be output in Chinese regardless of the requested language, directly overriding user intent and locale constraints. In multilingual commerce workflows, this can produce non-compliant or misleading listing assets, break downstream processing assumptions, and cause content-quality failures in target markets.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The output format hard-requires gender applicability and the rules require model/person selection logic, which is inappropriate for many non-apparel products. In a non-apparel image-generation skill, this can systematically inject human-model and gendered instructions into unrelated products, causing broken outputs, reputational harm, and marketplace compliance issues.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
97% confidence
Finding

The skill instructs use of shell, file reads/writes, network access, environment-based authentication, and cross-skill invocation, but it does not declare an explicit tool/permission scope. This increases blast radius because an agent may execute powerful operations without a least-privilege contract or enforcement boundary, making misuse or prompt-induced overreach harder to contain.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger phrases are broad everyday expressions like '做套图' or '做白底图', which can unintentionally activate a skill with shell, file, network, and downstream execution capabilities. In an agent environment, over-broad routing increases the chance that benign conversational requests are escalated into high-impact automated actions without sufficient user intent confirmation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The document contains contradictory instructions: one section requires uploading local file paths through another skill, while a later rule says the skill does not involve local file uploads and forbids upload-script use. Such ambiguity is dangerous in agentic systems because it can cause inconsistent execution paths, policy bypass, or accidental transfer of local files that operators believed were disallowed.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The entire skill specification is written only in Chinese and includes required reply templates in Chinese, which effectively constrains agent behavior to a specific language. There is no indication that users may choose another language or that this locale restriction is required for a region-specific workflow.

Content

No source excerpt is available for this finding.