Back to skill

Security audit

Product Image Archiver

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent product-image archiving purpose, but it needs review because its network fetching and local file writing are not safely scoped and some advertised checks are overstated.

Review before installing. Use only in a restricted, non-admin environment with a dedicated archive directory and limited outbound network access. Do not process untrusted product URLs until hostname allowlisting, redirect validation, image URL validation, size quotas, and product ID path sanitization are added, and treat the risk-detection/completeness claims as incomplete.

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
scripts/archiver.py:126
Finding

Server-Side Request Forgery Through Weak Product URL Validation

Content
View full analysis

Vulnerability Details

File Location: scripts/archiver.py:126-135, scripts/sources/wsy_source.py:39-45, scripts/sources/source_1688.py:39-45
Vulnerability Type: Server-Side Request Forgery (SSRF)
Risk Level: High

Vulnerable Code

scripts/archiver.py:126-135

python
def _fetch_product_info(self, url: str) -> Optional[Dict]:
    from sources.wsy_source import WSYSource
    from sources.source_1688 import Source1688
    
    if 'wsy.com' in url:
        source = WSYSource()
    elif '1688.com' in url:
        source = Source1688()
    else:
        logger.error(f"Unsupported source website: {url}")
        return None

scripts/sources/wsy_source.py:39-45

python
def fetch_product(self, url: str, download_images: bool = False) -> Optional[Dict]:
    logger.info(f"[WSY] Fetching product: {url}")
    
    try:
        self._random_delay()
        response = self.session.get(url, timeout=30)
        response.raise_for_status()

scripts/sources/source_1688.py:39-45

python
def fetch_product(self, url: str, download_images: bool = False) -> Optional[Dict]:
    logger.info(f"[1688] Fetching product: {url}")
    
    try:
        self._random_delay()
        response = self.session.get(url, timeout=30)
        response.raise_for_status()

Technical Analysis

The entry point determines whether a URL is supported by searching for wsy.com or 1688.com anywhere in the complete URL string. This does not verify the parsed hostname.

An attacker can place an approved string in the path, query, fragment, user-information component, or an attacker-controlled hostname. For example, http://127.0.0.1/service?wsy.com passes the substring test even though its destination is localhost.

The source adapter then passes the original URL directly to requests.Session.get. Requests follows HTTP redirects by default, and the code neither disables red ...[truncated 1762 chars]

Remediation
View remediation

Remediation Suggestions

  1. Parse URLs with urllib.parse.urlsplit instead of applying substring checks.
  2. Require the https scheme and reject URLs containing user-information.
  3. Compare the normalized hostname against an explicit allowlist, such as www.wsy.com and approved 1688 hosts. If subdomains are supported, validate them using exact DNS-label boundaries rather than endswith alone.
  4. Resolve all destination hostnames and reject every loopback, private, link-local, multicast, reserved, unspecified, and metadata-service address for both IPv4 and IPv6.
  5. Disable automatic redirects or manually follow a small number of redirects while applying the complete validation process to every destination.
  6. Protect against DNS rebinding by connecting only to a validated resolved address and ensuring that the HTTP hostname and TLS certificate remain correct.
  7. Apply outbound firewall or proxy restrictions so the process cannot contact internal networks or cloud metadata services.
  8. Add tests covering deceptive hosts, user-information URLs, encoded addresses, IPv6 literals, redirect chains, and DNS rebinding scenarios.

T09 · Insecure Skill Coding Practices

Error
Location
scripts/image_downloader.py:80
Finding

Secondary SSRF and Unbounded Disk Consumption Through Untrusted Image URLs

Content
View full analysis

Vulnerability Details

File Location: scripts/sources/wsy_source.py:66-77, scripts/sources/source_1688.py:66-75, scripts/image_downloader.py:80-106
Vulnerability Type: Server-Side Request Forgery and Unrestricted Resource Consumption
Risk Level: High

Vulnerable Code

scripts/sources/wsy_source.py:66-77

python
images = []
img_elems = soup.select('.product-images img') or soup.select('.goods-images img')
for img in img_elems[:10]:
    img_src = img.get('data-src') or img.get('src')
    if img_src:
        if img_src.startswith('//'):
            img_src = 'https:' + img_src
        elif img_src.startswith('/'):
            img_src = self.base_url + img_src
        images.append(img_src)

scripts/sources/source_1688.py:66-75

python
images = []
img_elems = soup.select('.img-container img')[:10]
for img in img_elems:
    img_src = img.get('data-ks-lazyload') or img.get('src')
    if img_src:
        if img_src.startswith('//'):
            img_src = 'https:' + img_src
        images.append(img_src)

scripts/image_downloader.py:80-106

python
try:
    response = self.session.get(url, timeout=self.timeout, stream=True)
    response.raise_for_status()
    
    content_type = response.headers.get('Content-Type', 'image/jpeg')
    file_ext = self._get_file_extension(content_type)
    
    filename = f"{index:03d}_original{file_ext}"
    filepath = output_dir / filename
    
    total_size = 0
    with open(filepath, 'wb') as f:
        for chunk in response.iter_content(chunk_size=self.chunk_size):
            if chunk:
                f.write(chunk)
                total_size += len(chunk)
    
    if total_size == 0:
        return {
            'success': False,
            'filename': filename,
            'error': 'File size is zero',
            'size': 0,
            'url': url
        }

Technic

...[truncated 2625 chars]

Remediation
View remediation

Remediation Suggestions

  1. Validate every image URL independently, even when the product-page URL has already been validated.
  2. Permit only HTTPS URLs hosted by an explicit list of trusted image CDN domains.
  3. Resolve destination hosts and reject private, loopback, link-local, reserved, unspecified, multicast, and metadata addresses for IPv4 and IPv6.
  4. Disable redirects or revalidate every redirect target before following it.
  5. Reject unsupported schemes, embedded credentials, malformed ports, and ambiguous encoded IP representations.
  6. Define a strict per-image size limit and a cumulative per-product download limit. Abort and delete partial files as soon as either limit is exceeded.
  7. Check Content-Length before downloading when present, while still enforcing limits during streaming because the header cannot be trusted.
  8. Require an approved image media type and validate the downloaded file's magic bytes and decodability before retaining it.
  9. Write to a temporary file within the archive directory, validate it, and atomically rename it only after successful completion.
  10. Apply filesystem quotas and outbound network controls as defense-in-depth measures.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/folder_manager.py:35
Finding

Archive Directory Traversal Through an Unsanitized Product Identifier

Content
View full analysis

Vulnerability Details

File Location: scripts/archiver.py:62-68, scripts/folder_manager.py:35-48
Vulnerability Type: Path Traversal
Risk Level: Medium

Vulnerable Code

scripts/archiver.py:62-68

python
product_name = product_info.get('title', 'Unknown product')
product_name_short = self._truncate_name(product_name)

folder_name = f"{product_id}_{product_name_short}"
archive_path = self.folder_manager.create_archive_folders(folder_name)

scripts/folder_manager.py:35-48

python
def create_archive_folders(self, folder_name: str) -> Path:
    main_folder = self.base_dir / folder_name
    
    main_folder.mkdir(parents=True, exist_ok=True)
    logger.info(f"Created main folder: {main_folder}")
    
    for sub_folder in self.sub_folders:
        sub_path = main_folder / sub_folder
        sub_path.mkdir(parents=True, exist_ok=True)
    
    return main_folder

Technical Analysis

The remotely obtained product title is passed through a filename-sanitization function, but the user-provided product_id is inserted into the directory name without validation.

Python's pathlib join operation does not guarantee that the resulting path remains below base_dir. Traversal components such as .. can escape the archive root after path normalization. On supported platforms, an absolute path component can also cause the preceding base path to be discarded.

Once the path escapes the archive root, the application creates the main directory and fixed subdirectories there. Later stages write downloaded files and the Excel manifest beneath the returned path. The product title suffix does not establish containment and does not prevent crafted traversal components in the product identifier.

Attack Path

  1. The attacker invokes the archive command with a product identifier containing traversal or absolute-path syntax.
  2. The identifier is concatenated with the shorten ...[truncated 1167 chars]
Remediation
View remediation

Remediation Suggestions

  1. Restrict product identifiers to a conservative allowlist, for example ^[A-Za-z0-9_-]{1,64}$.
  2. Reject empty identifiers, absolute paths, path separators, drive prefixes, . components, and .. components.
  3. Resolve the configured archive root and proposed destination before creating directories.
  4. Verify containment using Path.is_relative_to on supported Python versions, or compare normalized path components safely on older versions.
  5. Perform the containment check again immediately before every write where practical.
  6. Avoid running the Skill with administrative or root privileges.
  7. Use a dedicated archive directory with restrictive permissions and filesystem quotas.
  8. Add automated tests for POSIX traversal, Windows separators and drive paths, UNC paths, absolute paths, repeated separators, and encoded traversal variants.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (47)

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 · README.md (reported line 16)May include surrounding context.

bash
# 复制环境变量模板
copy .env.example .env

# 编辑 .env 文件(如使用百度 AI 侵权检测)
notepad .env

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 · README.md (reported line 18)May include surrounding context.

复制环境变量模板

copy .env.example .env

编辑 .env 文件(如使用百度 AI 侵权检测)

notepad .env

text

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 · README.md (reported line 19)May include surrounding context.

复制环境变量模板

copy .env.example .env

编辑 .env 文件(如使用百度 AI 侵权检测)

notepad .env

text

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

Claiming lossless download, archival, integrity checking, and risk labeling while actually only scraping page metadata or collecting image URLs creates a significant trust gap. That can lead operators to assume files were preserved and screened when no such processing occurred. Because the skill is positioned as an archival and compliance aid, this mismatch is operationally dangerous even if not directly malicious.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

Claiming lossless download, archival, integrity checking, and risk labeling while actually only scraping page metadata or collecting image URLs creates a significant trust gap. That can lead operators to assume files were preserved and screened when no such processing occurred. Because the skill is positioned as an archival and compliance aid, this mismatch is operationally dangerous even if not directly malicious.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

Claiming lossless download, archival, integrity checking, and risk labeling while actually only scraping page metadata or collecting image URLs creates a significant trust gap. That can lead operators to assume files were preserved and screened when no such processing occurred. Because the skill is positioned as an archival and compliance aid, this mismatch is operationally dangerous even if not directly malicious.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

Claiming lossless download, archival, integrity checking, and risk labeling while actually only scraping page metadata or collecting image URLs creates a significant trust gap. That can lead operators to assume files were preserved and screened when no such processing occurred. Because the skill is positioned as an archival and compliance aid, this mismatch is operationally dangerous even if not directly malicious.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Claiming lossless download, archival, integrity checking, and risk labeling while actually only scraping page metadata or collecting image URLs creates a significant trust gap. That can lead operators to assume files were preserved and screened when no such processing occurred. Because the skill is positioned as an archival and compliance aid, this mismatch is operationally dangerous even if not directly malicious.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

Claiming lossless download, archival, integrity checking, and risk labeling while actually only scraping page metadata or collecting image URLs creates a significant trust gap. That can lead operators to assume files were preserved and screened when no such processing occurred. Because the skill is positioned as an archival and compliance aid, this mismatch is operationally dangerous even if not directly malicious.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

Claiming lossless download, archival, integrity checking, and risk labeling while actually only scraping page metadata or collecting image URLs creates a significant trust gap. That can lead operators to assume files were preserved and screened when no such processing occurred. Because the skill is positioned as an archival and compliance aid, this mismatch is operationally dangerous even if not directly malicious.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest describes a skill for manually triggered single-product lossless original-image download and standardized archiving with infringement-risk labeling and completeness checks. In this file, the implementation fetches a product page, extracts basic fields and up to 10 image URLs, and returns them in memory; it neither downloads image binaries, performs archival/storage, labels infringement risk, nor validates download completeness or integrity.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The README notes optional Baidu AI infringement detection and .env configuration, but it does not clearly disclose that enabling this feature may send images or related metadata to a third-party external service. This creates a data exposure risk, especially if product images, URLs, or business-sensitive information are transmitted without explicit informed consent.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The documented chat trigger phrase is very generic and could plausibly match ordinary user conversation, increasing the chance of accidental invocation. In an agent setting, unintended activation can cause the skill to fetch remote content and create local archive folders/files without the user realizing they triggered an operational workflow.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The README shows archive folder creation and report generation, but it does not clearly warn users up front that running the skill writes multiple files and directories to disk. In agent environments, insufficient disclosure of side effects can lead to unintended persistence of downloaded content, metadata, and reports on the host system.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill declares capabilities implying network and environment access via metadata and described behavior, but it does not define an explicit tool/permission scope. That creates an authorization ambiguity where a reviewer or runtime may not clearly constrain what the skill is allowed to do, which is risky for a network-fetching archiver. In this context, the skill is meant to download remote product images, so missing scope is more dangerous than in a purely local formatting skill.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The file’s natural-language description, headings, commands, and usage instructions are entirely in Chinese, and there is no indication that users may choose another language or that the skill is intentionally limited to a China-specific compliance or regional workflow. Under the policy rule, forcing a specific language without opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This is a manifest-style YAML file, so vague-trigger checks apply. The file defines behavior and purpose but provides no explicit trigger phrases, activation conditions, or exclusion criteria, leaving unclear when the skill should activate versus not activate.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file's natural-language interface and instructions are entirely in Chinese, including the module description and operational messaging, and there is no indication that users may select another language. Under the policy, forcing a specific language without user opt-in is a locale/language policy violation unless clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This code file contains natural-language descriptions and log messages exclusively in Chinese, including the module docstring and class docstring, with no indication that the skill is region-specific or that users can choose another language. Under the policy, forcing a specific language without opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The file’s natural-language descriptions, status messages, and user-facing output are entirely in Chinese, and there is no indication that users can select another language or opt in to this locale. The policy specifically calls for flagging language or locale constraints when a skill forces a specific language without user choice.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The stated constraint of 'single-item manual trigger only' conflicts with code that accepts a list of URLs and adds randomized delays that mimic human behavior. In a downloader skill, this mismatch can enable bulk acquisition and anti-detection behavior, increasing the risk of abusive scraping, policy evasion, or unauthorized archiving beyond the declared use case.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file’s natural-language descriptions and taxonomy are fixed in Chinese, and _detect_category returns Chinese category labels with a default of '男装'. This indicates a locale/language constraint without any visible user opt-in or justification that the skill is intentionally region-specific.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The function signature includes download_images: bool = False, which signals an intent that the method can optionally download images. However, the parameter is never used and the code only retrieves the HTML page and parses image URLs, creating a misleading API contract/documented intent relative to actual behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The module docstring, class docstring, and user-facing log messages are all written in Chinese, indicating a fixed language behavior. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly documented and justified, which is not present here.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The method signature at L035 advertises a download_images control, implying behavior may vary based on whether images should be downloaded. However, the implementation never uses that parameter, and the comment at L067 asserts a specific no-download behavior instead. This creates intent-level documentation drift between the public API and the actual code path.

Content

No source excerpt is available for this finding.