Back to skill

Security audit

Nano Banana Cut 图片生成切割,用于短视频创作,解决角色一致性问题和故事叙事

Security checks for vulnerabilities and agentic risk

Overview

This is a real image-generation and cutting tool, but it exposes powerful unauthenticated web APIs that can disclose local files, alter/delete data, save credentials, and stop the service.

Only run this in a tightly controlled local environment, not on a shared or exposed network. Before installing or using it, remove or protect the shutdown/admin/config routes, bind to localhost, add authentication/CSRF protection, restrict all file serving and crop/upload paths to a dedicated workspace, stop logging Authorization headers, and rotate any API keys used with this version if logs or the service were exposed.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (6)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
server.py:758
Finding

Arbitrary Local File Disclosure Through Unrestricted Catch-All Route

Content
View full analysis
') def serve_file(filepath): if '..' in filepath or filepath.startswith('/'): return "Invalid path", 403 full_path = os.path.join('/', filepath) if os.path.exists(full_path) and os.path.isfile(full_path): return send_from_directory(os.path.dirname(full_path), os.path.basename(full_path)) return "File not found", 404 ``` ### Technical Analysis The catch-all route treats the URL path as a filesystem path rooted at `/`. The check for `..` does not provide confinement because an attacker does not need directory traversal sequences. For example, the URL path `etc/passwd` is converted into `/etc/passwd`. The route then returns any file for which the Flask process has read permission. It is not restricted to the configured image output directory, project directory, or records associated with a valid work item. On Windows, behavior differs according to drive and path handling, but known paths on the current drive may still be exposed. The application must not rely on the operating system to prevent disclosure. ### Attack Path 1. An attacker connects to the service on port 697. 2. The attacker requests a known local path without a leading slash in the route parameter, such as `/etc/passwd`. 3. The handler constructs `/etc/passwd`. 4. If the service account can read the file, Flask sends it to the attacker. 5. The attacker repeats the process for application files, database files, configuration, credentials, or user documents. ### Impact Assessment A remote, unauthenticated attacker may read any file available to the server account. Potential targets include: - The `.env` file containing `API_KEY` and `PLATFORM_TOKEN` - `data/works.db`, including prompts, task IDs, output paths, and API responses - Source code and config ...[truncated 281 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
server.py:716
Finding

Unauthenticated Network Exposure of Administrative and Privileged APIs

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
server.py:412
Finding

Arbitrary File Overwrite and Deletion via Uploaded Filename Traversal

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
server.py:724
Finding

Arbitrary Filesystem Read and Write Through the Crop API

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
templates/index.html:1486
Finding

Stored DOM Cross-Site Scripting Through Prompts and Error Messages

Content
View full analysis
${msg}`); $('body').append(toast); setTimeout(() => { toast.fadeOut(300, () => toast.remove()); }, 3000); } ``` ```javascript const item = $(`
${deleteBtn} ${work.prompt}
${work.prompt.substring(0, 20)}${work.prompt.length > 20 ? '...' : ''}
${work.date.substring(5, 16)} ${statusHtml}
${retryBtn}
`); ``` ```javascript ${work.error || '未知错误'} ``` ```javascript function showToast(msg, type = 'success') { const toast = $(`
${msg}
`); $('body').append(toast); setTimeout(() => toast.remove(), 3000); } ``` ```javascript const tr = $(` ${work.id} ${work.model || '-'} ${work.date || '-'} ${statusText} ${work.prompt ? work.prompt.substring(0, 30) + '...' : '-'} ${work.num || 1} 宫格 ${work.ratio || '-'} ${work.quality || '-'} ${work.task_id ? work.task_id.substring(0, 15) + '...' : '-'} ${work.path ? work.path.substring(0, 20) + '...' : '-' ...[truncated 2511 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
server.py:510
Finding

External API Bearer Credential Exposed in Application Logs

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (57)

Tainted flow: 'headers' from os.getenv (line 487, 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 · server.py (reported line 206)May include surrounding context.

python
}
                print(f"请求参数: {json.dumps(payload, indent=2)}")
                
                response = requests.post(CONFIG['server']['task_url'], headers=headers, json=payload, timeout=120)
                print(f"返回状态码: {response.status_code}")
                print(f"返回原始内容: {repr(response.text)}")

Tainted flow: 'headers' from os.getenv (line 487, 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 · server.py (reported line 517)May include surrounding context.

python
print(f"生成请求URL: {CONFIG['server']['url']}")
        print(f"请求头: {json.dumps(headers, indent=2)}")
        print(f"请求payload: {json.dumps(payload, indent=2, ensure_ascii=False)}")
        response = requests.post(CONFIG['server']['url'], headers=headers, json=payload, timeout=120)
        print(f"返回状态码: {response.status_code}")
        print(f"返回内容: {repr(response.text)}")
        response.raise_for_status()

Tainted flow: 'headers' from os.getenv (line 87, 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 · task.py (reported line 95)May include surrounding context.

python
payload = {"id": task_id,"action": "retrieve"}
    
    try:
        response = requests.post(CONFIG['server']['task_url'], headers=headers, json=payload, timeout=60)
        response.raise_for_status()
        data = response.json()
        print(f"接口返回成功: {json.dumps(data, indent=2, ensure_ascii=False)}")

Tainted flow: 'cut_cmd' from requests.post (line 149, network input) → subprocess.run (code execution)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

External input (network, user) flows to a code execution sink. This enables remote code execution or command injection.

Content

Scanner excerpt · task.py (reported line 155)May include surrounding context.

python
'-num', str(num),
                '-out', save_dir
            ]
            result = subprocess.run(cut_cmd, capture_output=True, text=True, encoding='utf-8')
            if result.returncode == 0:
                print(f"图片切割成功: {result.stdout}")
            else:

Tainted flow: 'headers' from os.getenv (line 71, 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 · upload.py (reported line 77)May include surrounding context.

python
files = {
            "file": open(file_path, "rb")
        }
        response = requests.post(UPLOAD_URL, headers=headers, files=files, timeout=60)
        response.raise_for_status()
        result = response.json()
        url = result.get('url')

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill is presented as an image generation/cutting utility, but the underlying capabilities include reading arbitrary local files, opening local folders, invoking local scripts on user-supplied paths, writing credentials, and remotely shutting down the service. In this context, the mismatch makes the hidden capabilities more dangerous because the skill appears routine and creative, not administrative or system-level.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill is presented as an image generation/cutting utility, but the underlying capabilities include reading arbitrary local files, opening local folders, invoking local scripts on user-supplied paths, writing credentials, and remotely shutting down the service. In this context, the mismatch makes the hidden capabilities more dangerous because the skill appears routine and creative, not administrative or system-level.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill is presented as an image generation/cutting utility, but the underlying capabilities include reading arbitrary local files, opening local folders, invoking local scripts on user-supplied paths, writing credentials, and remotely shutting down the service. In this context, the mismatch makes the hidden capabilities more dangerous because the skill appears routine and creative, not administrative or system-level.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
72% confidence
Finding

The skill structure explicitly includes a real .env file containing API credentials within the project layout, which increases the risk that secrets are stored alongside application code and may be accidentally exposed, copied, or read by other local components. In a skill that also has file-access and admin behavior, credential storage inside the workspace is more sensitive.

Content

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

md
├── upload.py              # 图片上传工具
├── set.json               # 配置文件(模型、分辨率、质量)
├── prompt.md              # 提示词模板
├── .env                   # 环境变量(API密钥)
├── .env.example           # 环境变量示例
├── SKILL.md               # 本文档
├── data/

Credential Access

High
Category
Privilege Escalation
Confidence
78% confidence
Finding

The documentation instructs users to place API keys and platform tokens into a .env file, which constitutes credential handling and local secret storage. If combined with weak file permissions, backup leakage, or undocumented file-reading routes, those secrets may be exposed or misused to access third-party services.

Content

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

  • apikey 字段已废弃,请使用 .env 文件配置
  • save_path 可自定义图片保存路径

.env 环境变量

bash
# 请访问 https://share.acedata.cloud/r/1uN88BrUTQ 获取以下配置

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · server.py (reported line 48)May include surrounding context.

python
os.makedirs(SAVE_BASE_PATH, exist_ok=True)

# 检查API_KEY配置,创建.env文件如果不存在
env_path = os.path.join(BASE_DIR, '.env')
if not os.path.exists(env_path):
    with open(env_path, 'w', encoding='utf-8') as f:
        f.write("# 请访问 https://share.acedata.cloud/r/1uN88BrUTQ 获取以下配置\n")

Credential Access

High
Category
Privilege Escalation
Confidence
91% confidence
Finding

This endpoint writes API_KEY and PLATFORM_TOKEN to disk and updates runtime configuration without any authentication or authorization checks. An attacker who can reach the service can replace credentials, redirect service behavior, or break functionality, turning configuration management into a remote tampering primitive.

Content

Scanner excerpt · server.py (reported line 397)May include surrounding context.

python
return jsonify({"success": False, "msg": "API_KEY为必填项,请填写"}), 400
        
        # 写入.env文件
        env_path = os.path.join(BASE_DIR, '.env')
        with open(env_path, 'w', encoding='utf-8') as f:
            f.write(f"API_KEY={api_key}\n")
            f.write(f"PLATFORM_TOKEN={platform_token}\n")

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill exposes administrative OS/process control endpoints unrelated to its stated image-generation purpose, including opening local folders and shutting down the server. With CORS enabled globally and no authentication checks on these routes, any reachable client can trigger disruptive or host-interacting actions remotely.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The shutdown endpoint immediately terminates the process via os._exit(0) with no authentication, authorization, or confirmation. Any reachable caller can cause a trivial denial of service, and in this image-processing skill that fully stops all generation, polling, and file-management functions.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The catch-all file-serving route joins attacker-supplied paths against the filesystem root and serves any existing file outside the app scope. The '..' check is insufficient because absolute or normalized paths like Windows drive paths or sensitive Unix paths can still expose arbitrary local files, making this a major information disclosure issue.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The UI directly exposes a service shutdown action that posts to /api/shutdown, which is inappropriate for a normal image-generation tool and can cause denial of service if accessible to non-admin users. In this skill context, shutdown is unrelated to core functionality, so accidental or unauthorized triggering is especially risky.

Content

No source excerpt is available for this finding.

Tainted flow: 'files' from open (line 74, file read) → requests.post (network output)

High
Category
Data Flow
Confidence
80% confidence
Finding

File contents flow to a network sink. This may indicate data exfiltration of sensitive files.

Content

Scanner excerpt · upload.py (reported line 77)May include surrounding context.

python
files = {
            "file": open(file_path, "rb")
        }
        response = requests.post(UPLOAD_URL, headers=headers, files=files, timeout=60)
        response.raise_for_status()
        result = response.json()
        url = result.get('url')

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
81% confidence
Finding

The skill documents capabilities that imply filesystem access, environment variable handling, network communication, and shell/process execution, but it does not declare any explicit tool scope or permission boundaries. This creates a least-privilege failure: users and hosting platforms cannot easily assess or constrain what the skill is allowed to do, increasing the risk of overbroad local access and unintended side effects.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill explains how to configure API keys and use generation/editing features but does not clearly warn that prompts, uploaded images, and task metadata are transmitted to third-party services and also stored locally. This can lead to unintentional disclosure of sensitive content, especially because users may assume a localhost tool keeps data entirely local.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
86% confidence
Finding

The skill transmits content to an external API endpoint for image generation. External transmission is expected for this type of service, but it is still security-relevant because prompts, task metadata, and possibly user content leave the local environment and go to a third party.

Content

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

json
{
  "server": {
    "url": "https://api.acedata.cloud/nano-banana/images",
    "task_url": "https://api.acedata.cloud/nano-banana/tasks",
    "upload_url": "https://platform.acedata.cloud/api/v1/files/",
    "apikey": ""

External Transmission

Medium
Category
Data Exfiltration
Confidence
89% confidence
Finding

The documented upload endpoint sends files to a third-party platform service, which can expose user images and related metadata outside the local system. In an image-editing workflow this may be functional rather than malicious, but the absence of prominent warning and data-governance detail makes it a real privacy/security concern.

Content

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

md
{
  "server": {
    "url": "https://api.acedata.cloud/nano-banana/images",
    "task_url": "https://api.acedata.cloud/nano-banana/tasks",
    "upload_url": "https://platform.acedata.cloud/api/v1/files/",
    "apikey": ""
  },

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The documented admin endpoints include retry, close, delete, and shutdown actions but do not include warnings about deleting local data, altering task state, or stopping the running service. Exposing destructive operations without clear warnings increases the chance of accidental denial of service or data loss by users who do not realize the effect of these routes.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The natural-language instructions are written as mandatory requirements in Chinese and direct the model to generate output under those constraints without any indication that the user can choose another language or locale. This creates a language/locale policy issue because it imposes a specific language context by default rather than offering opt-in or documenting a justified regional limitation.

Content

No source excerpt is available for this finding.

Tainted flow: 'payload' from requests.post (line 201, network input) → requests.post (network output)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · server.py (reported line 206)May include surrounding context.

python
}
                print(f"请求参数: {json.dumps(payload, indent=2)}")
                
                response = requests.post(CONFIG['server']['task_url'], headers=headers, json=payload, timeout=120)
                print(f"返回状态码: {response.status_code}")
                print(f"返回原始内容: {repr(response.text)}")

Tainted flow: 'image_url' from requests.post (line 220, network input) → requests.get (network output)

Medium
Category
Data Flow
Confidence
96% confidence
Finding

The server downloads image_url returned by an external service without validating scheme, host, IP range, or content type. If the upstream service is compromised or attacker-influenced, this enables SSRF to internal services or retrieval of arbitrary local-network resources, which is especially risky because this skill already acts as a networked backend.

Content

Scanner excerpt · server.py (reported line 240)May include surrounding context.

python
ext = 'png'
                        main_path = os.path.join(save_dir, f'main.{ext}')
                        
                        img_response = requests.get(image_url, stream=True, timeout=60)
                        img_response.raise_for_status()
                        with open(main_path, 'wb') as f:
                            for chunk in img_response.iter_content(chunk_size=8192):