T09 · Insecure Skill Coding Practices
- Location
blog-toolkit.py:484- Finding
Path Injection in Uploaded-File Deletion Endpoint
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a disclosed blog-management CLI, but it can create, modify, upload, and delete public blog data with weak guardrails.
Install only if you trust the target Blog API and intend the agent to manage that site. Use a non-production endpoint or a least-privileged, protected API where possible, prefer HTTPS, avoid passing sensitive files or passwords through commands, and require human approval before any create, update, upload, or delete operation.
blog-toolkit.py:484Path Injection in Uploaded-File Deletion Endpoint
blog-toolkit.py:148Sensitive User Data Can Be Transmitted over Plaintext HTTP
requirements.txt:1Unpinned and Overly Broad Third-Party Dependency
The documented delete-article operation exposes a destructive parameterized action, including an option for hard deletion via soft=false, against an explicitly unauthenticated public API. In this skill context, an agent or user can directly invoke irreversible content deletion by supplying an article ID, making abuse trivial.
- 响应:`{"code":200,"data":{...}}`
- 子命令:`update-article`
### 5. DELETE /api/articles/{article_id} — 删除文章
- 参数(path):`article_id*(int)`;(query):`soft(bool,默认true)`,soft=false 硬删除
- 响应:`{"code":200,"data":{...}}`
- 子命令:`delete-article`
The documented comment deletion endpoint enables direct deletion by comment_id on a public unauthenticated API. Because the skill is a CLI wrapper for these endpoints, it facilitates straightforward moderation abuse or censorship by anyone who can enumerate IDs.
- 响应:`{"code":200,"data":{id,...}}`
- 子命令:`create-comment`
### 14. DELETE /api/comments/{comment_id} — 删除评论(软删除)
- 参数(path):`comment_id*(int)`
- 响应:`{"code":200,"data":{...}}`
- 子命令:`delete-comment`
The message deletion endpoint allows a destructive action keyed only by message_id and is documented as part of an unauthenticated public API. This makes unauthorized removal of user-generated content easy to automate through the skill.
- 响应:`{"code":200,"data":{id,...}}`
- 子命令:`reply-message`
### 18. DELETE /api/messages/{message_id} — 删除留言(软删除)
- 参数(path):`message_id*(int)`
- 响应:`{"code":200,"data":{...}}`
- 子命令:`delete-message`
The mood deletion endpoint is another direct destructive operation on a public unauthenticated API. Even if limited to informal content, it still permits unauthorized content tampering and service abuse through simple ID-based requests.
- 响应:`{"code":200,"data":{id,...}}`
- 子命令:`create-mood`
### 21. DELETE /api/moods/{mood_id} — 删除说说
- 参数(path):`mood_id*(int)`
- 响应:`{"code":200,"data":{...}}`
- 子命令:`delete-mood`
The upload deletion endpoint is especially dangerous because the same document also explains how to enumerate uploaded files and obtain the exact filename token needed for deletion. In an unauthenticated public API, this enables bulk deletion of stored files and potentially broader disruption of site assets or user content.
- 子命令:`list-uploads`
- 注意:列表项的 `filename` 即存储文件名(hash),可直接用于 delete-upload
### 25. DELETE /api/uploads/{filename} — 删除已上传文件
- 参数(path):`filename*(str)` — 存储文件名(hash,即 upload 返回 `data.url` 路径末段,或 list-uploads 返回的 `filename`)
- 响应:`{"code":200,"message":"文件已删除"}`
- 子命令:`delete-upload`
The skill scans all environment variables and harvests any matching username, password, token, API key, and base URL values under the prefix, even though this particular skill uses no authentication. Broad secret collection is dangerous because it expands the sensitive data the process reads and can be combined with future logging, error handling, or code changes to leak credentials.
def _load_credentials():
"""动态扫描环境变量获取认证凭据(前缀由 skill name 推导)。"""
creds = {}
for k, v in os.environ.items():
u = k.upper()
if u.startswith(_CRED_PREFIX):
if 'USERNAME' in u or u.endswith('_USER'):
This tool exposes a high-impact parameterized delete capability, including hard delete control via soft=false, with no policy enforcement or confirmation. In an agent context, such direct destructive primitives are susceptible to prompt injection, operator mistakes, or misuse against arbitrary article IDs on a public API.
def cmd_delete_article(args):
"""能力 E:删除文章(默认软删除,soft=false 硬删除)。"""
# DELETE /api/articles/{article_id}
params = {'soft': 'true' if args.soft else 'false'}
return _api_request('DELETE', '/api/articles/%s' % args.article_id,
params=params)
The tool permits arbitrary comment deletion by ID without verification of ownership, confirmation, or runtime policy checks. As an agent skill for an unauthenticated public API, this creates a strong misuse primitive for destructive moderation actions.
def cmd_delete_comment(args):
"""能力 N:删除评论(软删除)。"""
# DELETE /api/comments/{comment_id}
return _api_request('DELETE', '/api/comments/%s' % args.comment_id)
This is a direct arbitrary message-deletion primitive exposed through a low-friction CLI interface. The public/no-auth API context makes the capability more dangerous because there is no compensating authentication boundary enforced by the client.
def cmd_delete_message(args):
"""能力 R:删除留言(软删除)。"""
# DELETE /api/messages/{message_id}
return _api_request('DELETE', '/api/messages/%s' % args.message_id)
The mood deletion command is another arbitrary destructive operation that trusts a single input parameter and immediately calls the remote API. In tool-using agent systems, such unchecked destructive endpoints are a common abuse path.
def cmd_delete_mood(args):
"""能力 U:删除说说。"""
# DELETE /api/moods/{mood_id}
return _api_request('DELETE', '/api/moods/%s' % args.mood_id)
Deleting uploaded files by arbitrary filename gives the tool a direct remote content-destruction capability with no guardrails. Because the filename is user-supplied and the API is public, an attacker or bad prompt can steer the tool toward deleting content with minimal resistance.
def cmd_delete_upload(args):
"""能力 Y:删除已上传文件。"""
# DELETE /api/uploads/{filename}
return _api_request('DELETE', '/api/uploads/%s' % args.filename)
The skill declares operational capabilities that read project files, consume environment variables, and make network requests, but it does not declare an explicit tool scope such as allowed-tools or permissions. In an agent environment, that ambiguity weakens least-privilege controls and can let the skill access broader resources than a reviewer or runtime policy expects.
The task-completion instructions require the final JSON block contents to be written in Chinese, such as the example strings and field guidance, but do not provide any user opt-in or alternative language option. This creates a locale/language constraint in the skill's natural-language behavior that may violate organizational language-choice policy.
This markdown file describes deletion capabilities, including article deletion with an explicit hard-delete option, but does not include any warning about data loss, reversibility, or the need for care when invoking the command. Under the markdown-specific SQP-2 criteria, destructive behaviors affecting user data should be disclosed to users.
The document explicitly describes a public unauthenticated user-list endpoint returning personal data fields including phone, email, address, and profession. In this skill context, that makes privacy exposure easy to discover and operationalize, enabling bulk harvesting of PII from a public API.
The file documents unauthenticated upload, listing, and deletion capabilities for server-hosted files, including exactly how to derive deletion identifiers from responses. In a CLI management skill, this materially lowers the barrier to arbitrary file hosting abuse, mass enumeration, and deletion of stored content.
L092-L095 的说明明确表示“只读 base_url/api_url/host——不读 token/密码等敏感凭据”。但实际执行路径中,_get_base_url 在 L137 调用 _load_credentials,而 _load_credentials 在 L61-L73 会遍历并读取 BLOG_TOOLKIT 前缀下的 username、password、token、api_key 和 base_url 环境变量。该注释对实际敏感信息读取行为形成了直接误导。
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
if method == 'GET':
resp = requests.get(url, params=params, timeout=30, **auth_kwargs)
elif method == 'POST':
resp = requests.post(url, json=payload, files=files, timeout=30,
**auth_kwargs)
elif method == 'PUT':
resp = requests.put(url, json=payload, files=files, timeout=30,
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
resp = requests.post(url, json=payload, files=files, timeout=30,
**auth_kwargs)
elif method == 'PUT':
resp = requests.put(url, json=payload, files=files, timeout=30,
**auth_kwargs)
elif method == 'PATCH':
resp = requests.patch(url, json=payload, timeout=30,
The skill exposes a remote delete operation for articles, including hard delete via soft=false, with no confirmation prompt, dry-run mode, or high-friction safety flag. In an agent/tooling context, this increases the chance of accidental or prompt-induced destructive actions against a live public API.
Comment deletion triggers a remote destructive action immediately with no user confirmation or secondary safety check. In an agent setting, this makes accidental deletion or instruction-injection-driven misuse materially easier.
Message deletion is executed directly from a single parameter with no confirmation, preview, or guardrail. Because the API is explicitly unauthenticated and public, misuse is easier and accidental destructive actions have lower friction.
The mood deletion command performs an irreversible remote action from a single ID input without any human-in-the-loop confirmation. This is risky in CLI skills intended for agent use, where malformed inputs or adversarial prompts can trigger deletions unintentionally.
This command reads a local file and transmits its contents to a remote host without an explicit warning at execution time about data exfiltration risk. In agent-mediated workflows, local file paths may come from untrusted prompts, so the lack of friction increases the chance of unintended disclosure.
Batch upload amplifies the previous risk by allowing multiple local files to be transmitted to a remote service in one action, again with no warning or confirmation. If driven by an agent or copied instructions, this can quickly exfiltrate a set of unintended files.