Back to skill

Security audit

Smart Image Search

Security checks for vulnerabilities and agentic risk

Overview

This image-search skill is mostly coherent, but it automatically downloads untrusted search-result images with weak network and file-size safeguards.

Review before installing. This skill will send image-search terms to external providers including Bing, Baidu, and Sogou, then may download third-party image files automatically. Use caution with private or sensitive queries, and prefer running it in an environment with restricted network egress and temporary-file cleanup until URL validation and download-size limits are added.

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/fetch_best_image.py:35
Finding

Unrestricted Search-Result URL Fetching Enables Server-Side Request Forgery

Content
View full analysis
Dict[str, Any]: encoded = urllib.parse.quote(query, safe="") url = f"https://www.bing.com/images/search?q={encoded}" text = fetch(url) blocks = re.findall(r'm="({"sid":.*?})"', text) results = [] seen = set() for block in blocks: raw = html.unescape(block) img = re.search(r'"murl":"(.*?)"', raw) page = re.search(r'"purl":"(.*?)"', raw) title = re.search(r'"t":"(.*?)"', raw) if not img: continue image_url = img.group(1) if image_url in seen: continue seen.add(image_url) results.append({ "engine": "bing", "image_url": image_url, "page_url": page.group(1) if page else "", "title": html.unescape(title.group(1)) if title else "", }) ``` The selected URL is then opened directly: ```python def download(url: str, query: str): req = urllib.request.Request( url, headers={ "User-Agent": UA, "Referer": "https://www.bing.com/", }, ) with urllib.request.urlopen(req, timeout=30) as resp: data = resp.read() content_type = resp.headers.get("Content-Type") ``` Equivalent unrestricted downloads occur in: ```python # scripts/fetch_candidate_images.py def download(url: str, query: str, idx: int): req = urllib.request.Request(url, headers={"User-Agent": UA, "Referer": "https://www.bing.com/"}) with ...[truncated 3157 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/fetch_best_image.py:35
Finding

Unbounded Network Response Reads Permit Memory and Disk Exhaustion

Content
View full analysis
str: req = urllib.request.Request(url, headers={"User-Agen ...[truncated 2935 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (16)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description promises an active image-search capability with multi-engine querying, relevance ranking, best-match selection, and optional download/attachment behavior. The supplied code is much narrower: it simply constructs and prints image-search URLs for three search engines based on the input query. Returning ready-to-open search links is mentioned in the description, but only as a fallback within a larger search-and-selection workflow. Since the actual code lacks the core advertised behavior and primarily serves as a URL builder, the description materially overstates what the code does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This code chunk does not implement image search. Its primary purpose is image quality assessment and filtering of already-obtained images or URLs. It reads local files, extracts dimensions from image headers, checks byte size thresholds, and applies simple intent-based scoring. While such logic could support a larger image-search pipeline, the supplied chunk itself materially differs from the declared end-user functionality of searching the web for images and returning results. Therefore the description does not accurately represent this code chunk's actual behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description presents an end-to-end image search capability, including searching, ranking, returning results, and possibly downloading the best image. The actual code chunk is only a query-parameter parser: it extracts count, intent hints, orientation, and resolution indicators from text. This could be a supporting utility for such a skill, but by itself it does not implement the primary declared behavior. Therefore the supplied code chunk does not accurately represent the described skill functionality.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The implementation is related to image search, so the general domain matches, but the declared description overstates what the code actually does in several material ways. The script performs simple scraping of Bing and Baidu image search result pages, gathers up to five image URLs per engine, and picks the first available image from the first engine that returns results. There is no relevance ranking, no best-match evaluation, no downloading of the image, no attachment/sending behavior, and no extraction of source page URLs. Because the primary behavior is a much narrower 'search first image candidates and return URLs' workflow than the declared 'multi-engine relevance-ranked best-match downloader/sender' capability, this is a meaningful description-behavior mismatch.

Content

No source excerpt is available for this finding.

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

md
If confidence is weak, prefer sending 2-3 candidates or links rather than a low-quality single answer.
Read `references/confidence.md` for the high / medium / low decision rule.

## Output rules

- Be brief and lead with the result.
- If the image was sent successfully, say so in one short sentence.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill instructs the agent to read local reference files, invoke Python scripts, access the network, and write downloaded images to a local directory, but it declares no explicit tool scope or permission boundaries. That mismatch can cause the agent to exercise shell, file, and network capabilities more broadly than a reviewer or policy layer expects, increasing the risk of unintended command execution, external requests, and filesystem writes.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill explicitly instructs the agent to download third-party image files to a local path and send them onward, without any warning, consent checkpoint, or trust controls. Downloading arbitrary remote content to disk expands the attack surface for storage abuse, unsafe file handling, policy violations, and accidental redistribution of malicious or inappropriate content.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
80% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

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

python3 scripts/build_image_search_urls.py "official mascot"

text

### Parse the most relevant image automatically

Run:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code fetches remote content from a URL and writes it to a local filesystem path, but the operation has no confirmation prompt and no user-facing disclosure beyond JSON output after the fact. For a code file, file writes and network transfers should have some visible warning unless they are clearly documented as the skill's stated purpose, which is not evident from this file alone.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The download function fetches remote content with urllib and writes it to a local directory, which affects user data and system state. Within this file there is no confirmation prompt, user-facing log message, or explanatory comment/docstring disclosing that the script will retrieve external data and save files under /home/mumu/clawd/tmp/search-image.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script automatically downloads untrusted remote content from a search result and writes it to a persistent local path without any consent, warning, or validation beyond a loose file-extension guess. In this skill context, image URLs come from external search engines and may point to unexpectedly large, malicious, or non-image payloads, creating privacy, storage, and unsafe-content handling risks for downstream consumers.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/run_regression.py (reported line 14)May include surrounding context.

python
q = line.strip()
    if not q or q.startswith("#"):
        continue
    proc = subprocess.run(["python3", str(SCRIPT), q], capture_output=True, text=True)
    print(f"\n=== {q} ===")
    if proc.returncode != 0:
        print("ERROR", proc.stderr.strip())

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script sends raw user queries to external search engines, which can disclose sensitive or identifying information if users search for private names, incidents, internal project terms, or regulated data. In an agent skill context, this is more concerning because users may not realize their prompt content is being forwarded to third parties outside the primary platform.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The search functions collect only raw image URLs and a search URL for each engine. They do not extract source page links, produce enriched candidate sets beyond a few image URLs, or implement the described fallback behavior of returning several candidate links when confidence is weak or download fails.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Forwarding queries to Baidu creates a third-party data-sharing risk, especially because users may not expect transmission to that provider or understand its jurisdictional/privacy implications. In this skill, the danger is amplified by the multi-engine design: a single user request may be broadcast to multiple services without granular notice or choice.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest describes multi-engine search with relevance ranking and selecting the best match, but the implementation simply queries Bing and Baidu in a fixed order and returns the first image from the first engine that has any results. There is no scoring, comparison, ranking, downloading, or confidence evaluation across candidate images.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.