Back to skill

Security audit

apiyi-gpt-image-2-all-gen(基于API易代理站)-官逆版

Security checks for vulnerabilities and agentic risk

Overview

This image-generation skill is mostly coherent, but its command templates and URL download behavior create review-worthy execution and network risks.

Install only if you are comfortable sending prompts and input images to APIYI. Do not pass API keys on the command line, avoid sensitive images or confidential prompt text, and invoke the helper scripts with argument arrays or otherwise shell-safe argument handling rather than interpolating raw user text into a shell command.

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
SKILL.md:17
Finding

Shell Command Injection Through Unescaped User-Controlled Arguments

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/generate_image.py:132
Finding

Unvalidated Response-Controlled URL Fetch in Python Client

Content
View full analysis
Optional[str]: if not content: return None url_match = re.search(r'(https?://[^\s)]+\.(png|jpg|jpeg|webp))', content, re.IGNORECASE) if url_match: return url_match.group(1) b64_match = re.search(r'(data:image/[^;]+;base64,[A-Za-z0-9+/=]+)', content) if b64_match: return b64_match.group(1) return None def download_image(url_string: str) -> bytes: try: response = requests.get(url_string, timeout=30) if response.status_code < 200 or response.status_code >= 300: sys.exit(1) return response.content except requests.exceptions.Timeout: sys.exit(1) except requests.exceptions.RequestException: sys.exit(1) def download_base64_image(url_string: str) -> str: image_buffer = download_image(url_string) return base64.b64encode(image_buffer).decode() ``` The response-controlled URL reaches the download function as follows: ```python image_url = extract_image_url(response_content) if image_url: if image_url.startswith('data:'): image_data = image_url.replace('data:image/png;base64,', '') else: image_data = download_base64_image(image_url) ``` ### Technical Analysis The script extracts the first image-looking HTTP or HTTPS URL from API-generated text and downloads it without validating the destination host or resolved IP address. There is no allowlist for the expected CDN, no rejection of loopback, private, link-local, or cloud metadata addresses, and no validation after DNS resolution. Python Requests follows redirects by default, so even an initially permitted-looking URL could redirect to a prohibited destination unless redirects are explicit ...[truncated 1882 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/generate_image.js:275
Finding

Unvalidated Response-Controlled HTTPS Fetch in Node.js Client

Content
View full analysis
{ const url = new URL(urlString); const req = https.get( { protocol: url.protocol, hostname: url.hostname, port: url.port || 443, path: url.pathname + url.search, }, (res) => { if (res.statusCode < 200 || res.statusCode >= 300) { const err = new Error(`HTTP ${res.statusCode}`); err.statusCode = res.statusCode; return reject(err); } const chunks = []; res.on('data', (d) => chunks.push(d)); res.on('end', () => resolve(Buffer.concat(chunks))); } ); req.on('error', reject); req.setTimeout(30000, () => { req.destroy(new Error('timeout')); }); }); } ``` The response-controlled URL reaches the downloader as follows: ```javascript const imageUrl = extractImageUrl(responseContent); if (imageUrl) { if (imageUrl.startsWith('data:')) { imageData = imageUrl.replace(/^data:image\/png;base64,/, ''); } else { imageData = await downloadBase64Image(imageUrl); } } ``` ### Technical Analysis The Node.js implementation trusts an image-looking URL extracted from the remote API response. It does not constrain the hostname to the provider's expected CDN, inspect the resolved address, reject internal address ranges, validate the media type, or cap the response size. Be ...[truncated 1545 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (21)

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

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/generate_image.py (reported line 245)May include surrounding context.

python
start_time = datetime.datetime.now()

    try:
        response = requests.post(url, headers=headers, json=payload, timeout=DEFAULT_TIMEOUT)
        response.raise_for_status()
        data = response.json()
    except requests.exceptions.Timeout:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- **优先尝试 Node.js 版本**:如果环境有 Node(`node` 命令可用),优先使用 `scripts/generate_image.js`(零依赖,参数与 Python 保持一致)。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- **优先尝试 Node.js 版本**:如果环境有 Node(`node` 命令可用),优先使用 `scripts/generate_image.js`(零依赖,参数与 Python 保持一致)。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- **优先尝试 Node.js 版本**:如果环境有 Node(`node` 命令可用),优先使用 `scripts/generate_image.js`(零依赖,参数与 Python 保持一致)。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- **优先尝试 Node.js 版本**:如果环境有 Node(`node` 命令可用),优先使用 `scripts/generate_image.js`(零依赖,参数与 Python 保持一致)。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- **优先尝试 Node.js 版本**:如果环境有 Node(`node` 命令可用),优先使用 `scripts/generate_image.js`(零依赖,参数与 Python 保持一致)。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- **优先尝试 Node.js 版本**:如果环境有 Node(`node` 命令可用),优先使用 `scripts/generate_image.js`(零依赖,参数与 Python 保持一致)。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- **优先尝试 Node.js 版本**:如果环境有 Node(`node` 命令可用),优先使用 `scripts/generate_image.js`(零依赖,参数与 Python 保持一致)。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- **优先尝试 Node.js 版本**:如果环境有 Node(`node` 命令可用),优先使用 `scripts/generate_image.js`(零依赖,参数与 Python 保持一致)。

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill instructs the agent to access environment variables, write files, and make outbound API calls, but it does not declare any explicit tool scope or permission boundaries. This weakens policy enforcement and reviewability, increasing the chance the skill is invoked with broader capabilities than intended and enabling unintended data access or exfiltration paths.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
89% confidence
Finding

This skill is designed to send user prompts and possibly input images to a third-party service at api.apiyi.com for processing. That external transmission is intrinsic to the skill, but it is still security-relevant because prompts and images may contain sensitive data, and the document does not require explicit consent, minimization, or data-classification checks before upload.

Content

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

md
---
name: apiyi-gpt-image-2-all-gen
description: AI图片生成技能,使用ChatGPT最新生图 gpt-image-2-all,当用户需要生成图片、视觉信息图、创建图像、编辑/修改/调整已有图片时使用此技能。基于API易平台(https://api.apiyi.com/)的ChatGPT最新生图gpt-image-2-all模型(gpt-image-2-all)的图片生成服务,无需访问外网。该模型以 $0.03/张 按次计费,支持文生图、单图编辑、多图融合、自然语言改图,文字还原度高、中文提示词友好。尺寸通过prompt描述控制(无显式size参数)与NanoBanana2不同的关键点:无size参数,需在prompt开头描述尺寸;统一$0.03/张无分辨率阶梯;使用对话式端点/v1/chat/completions为主推。
---

# 图片生成与编辑(GPT Image 2 All)Skills

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The top-level description says to use this skill whenever a user needs image generation, infographics, image creation, or image editing, which is broad enough to overlap with many ordinary requests. Over-broad trigger conditions can cause accidental invocation of a networked, file-writing skill in contexts where the user did not clearly consent to external transmission or command execution.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The document explicitly recommends or permits passing the API key on the command line, which can expose secrets through shell history, process listings, logs, and telemetry. In agent or multi-user environments, this materially increases the risk of credential disclosure and unauthorized API use.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script sends user prompts and, when provided, local input images to a third-party API endpoint without any explicit consent flow, privacy notice, or redaction safeguards. In an agent skill context, users may not realize their text and image contents leave the local environment, which can expose sensitive personal, proprietary, or regulated data.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/generate_image.js (reported line 354)May include surrounding context.

js
args.filename = adjusted

    api_key = get_api_key(args.api_key)
    url = 'https://api.apiyi.com/v1/chat/completions'

    headers = {
        'Authorization': f'Bearer {api_key}',

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/generate_image.py (reported line 184)May include surrounding context.

python
args.filename = adjusted

    api_key = get_api_key(args.api_key)
    url = 'https://api.apiyi.com/v1/chat/completions'

    headers = {
        'Authorization': f'Bearer {api_key}',

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script uploads user prompt text and optionally local image files to a third-party remote API, but it provides no explicit privacy or data-transmission warning at the point of use. In an agent-skill context, users may assume local-only processing and could unintentionally send sensitive images or confidential text off-host.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
90% confidence
Finding

The script sends prompts and possibly base64-encoded local images to an external service over the network. In this skill's context, external transmission is core functionality, but it still creates a real data-exposure risk if users supply sensitive content or assume processing is local.

Content

Scanner excerpt · scripts/generate_image.py (reported line 245)May include surrounding context.

python
start_time = datetime.datetime.now()

    try:
        response = requests.post(url, headers=headers, json=payload, timeout=DEFAULT_TIMEOUT)
        response.raise_for_status()
        data = response.json()
    except requests.exceptions.Timeout:

Vague Triggers

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

文档详细说明了执行步骤和参数提取,但没有明确说明何时应触发该技能、何时不应触发,例如仅讨论图片创意、比较模型或咨询价格时是否调用。对于 markdown 技能说明,这种缺少触发范围约束的写法会增加误触发风险。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

Natural-language help text, examples, errors, and status messages are presented entirely in Chinese, with no language-selection mechanism or indication that the tool is intentionally region-specific. This can violate language/locale policy where skills should not force a locale without user choice or clear justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The module docstring, CLI description, help text, and runtime messages are all presented in Chinese with no option for language selection. This creates a natural-language policy issue if users are not given a choice of locale or informed that the tool is intentionally Chinese-only.

Content

No source excerpt is available for this finding.