Back to skill

Security audit

Li PhotoIndexWithLLM

Security checks for vulnerabilities and agentic risk

Overview

This photo-search skill is mostly coherent, but it can send private photos to a configured non-local endpoint while still treating it as local and skipping remote-upload safeguards.

Review this before installing if you will scan personal, family, work, or document photos. Use it only with a verified loopback local endpoint such as localhost or 127.0.0.1, keep REMOTE_LLM_ENABLED=false unless you intentionally want remote analysis, protect the .env and SQLite database, and remember that the local index stores full file paths and derived photo descriptions in plaintext.

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

T09 · Insecure Skill Coding Practices

Warning
Location
skill.py:481
Finding
Configurable Local Endpoint Bypasses Remote Image Upload Safeguards<![CDATA[ ## Vulnerability Details **File Location**: `skill.py`, lines 481-567 and 634-659 **Vulnerability Type**: Remote data disclosure caused by trust-label-based endpoint classification **Risk Level**: Medium ### Vulnerable Code ```python class VLClient: def __init__(self, endpoint: str, model: str, api_key: str = "", max_tokens: int = 2048, timeout: int = 120, is_remote: bool = False, require_confirm: bool = True): self.endpoint = endpoint.rstrip("/") self.model = model self.api_key = api_key self.max_tokens = max_tokens self.timeout = timeout self.is_remote = is_remote self.require_confirm = require_confirm self.confirmed = False self.headers = {"Content-Type": "application/json"} if api_key: self.headers["Authorization"] = f"Bearer {api_key}" def analyze_image(self, image_path: str, prompt: str) -> dict: if self.is_remote and self.require_confirm and not self.confirmed: if not sys.stdin.isatty(): raise PermissionError( "Remote transmission requires confirmation." ) confirm = input("Continue uploading photos to the remote server? (yes/no): ") if confirm.lower() != "yes": raise PermissionError("The user rejected remote photo transmission") self.confirmed = True message = self._build_vision_message(image_path, prompt) payload = { "model": self.model, "messages": [message], "max_tokens": self.max_tokens, "stream": False, "temperature": 0.1 } response = requests.post( f"{self.endpoint}/chat/completions", headers=self.headers, json=payload, timeout=self.timeout ) def _build_vision_message(self, image_path: str, prompt: str) -> dict: with op ...[truncated 4620 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Derive trust from the destination rather than a configuration label.** - Parse the endpoint with `urllib.parse.urlparse`. - Treat only verified loopback destinations as local. - Permit `localhost`, IPv4 loopback addresses in `127.0.0.0/8`, and IPv6 `::1`. - Reject malformed URLs, embedded credentials, ambiguous host syntax, and unsupported schemes. 2. **Apply remote-upload policy to every non-loopback destination.** - Require `ALLOW_REMOTE_UPLOAD=true`. - Enforce `PRIVACY_MODE`. - Require explicit user confirmation when `REQUIRE_REMOTE_CONFIRM=true`. - Fail closed in non-interactive environments rather than silently uploading. 3. **Address DNS-based bypasses.** - Resolve hostnames and verify that all resulting addresses are loopback before classifying an endpoint as local. - Revalidate the connected peer or restrict local mode to literal loopback addresses to reduce DNS rebinding and time-of-check/time-of-use risks. 4. **Require secure transport for remote endpoints.** - Reject plaintext HTTP for non-loopback destinations. - Require HTTPS with normal certificate validation. - Consider an administrator-controlled endpoint allowlist. 5. **Protect credentials.** - Do not send a local API key until endpoint validation succeeds. - Separate credentials by endpoint and avoid reusing sensitive tokens across destinations. - Redact authorization values from errors and logs. 6. **Add regression tests.** - Confirm that `http://localhost`, `http://127.0.0.1`, and `http://[::1]` can use local mode. - Confirm that public IP addresses, external domains, malformed URLs, and hostnames resolving to non-loopback addresses trigger remote safeguards. - Confirm that non-interactive execution rejects unapproved remote transmission. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (76)

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
- ✅ 所有代码都在 skill.py 内

2. **自动配置加载**
   - ✅ 自动查找主项目的 .env 文件
   - ✅ 如果找不到,使用内置默认配置
   - ✅ 不需要设置环境变量
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
```bash
# 删除不需要的索引
rm data/photo_index.db

# 清理日志
rm logs/*.log
Confidence
85% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
```bash
# 删除不需要的索引
rm data/photo_index.db

# 清理日志
rm logs/*.log
Confidence
85% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
rm data/photo_index.db

# 清理日志
rm logs/*.log
```

### 4. 使用本地模型
Confidence
85% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Missing User Warnings

High
Confidence
96% confidence
Finding
The documentation states that local or remote VL models may be used, but it does not warn that image content, derived descriptions, or metadata could be transmitted to remote services. Because the skill processes personal photos, silent remote transmission creates substantial privacy and data exposure risk, especially when used by autonomous agents on sensitive directories.

Ae1

High
Category
analysis-evasion
Content
- 查看文档:`SKILL.md`(本文件)
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Static analysis

No suspicious patterns detected.