T09 · Insecure Skill Coding Practices
- Location
knowledge-base/SKILL.md:273- Finding
Unrestricted URL Fetching Enables Server-Side Request Forgery
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a coherent IMA notes and knowledge-base integration, but it handles private data, uploads, credentials, and arbitrary URLs with under-scoped safeguards.
Review before installing. Use a secure credential store or tightly permissioned files, avoid importing untrusted or internal URLs, and confirm every file or URL upload because private content may be sent to IMA and Tencent COS. The skill should be hardened with explicit upload consent, URL validation, safer secret handling, and structured JSON construction.
knowledge-base/SKILL.md:273Unrestricted URL Fetching Enables Server-Side Request Forgery
knowledge-base/SKILL.md:178Temporary COS Credentials Exposed Through Process Arguments
SKILL.md:38IMA API Credentials Stored Without Explicitly Restrictive Permissions
knowledge-base/SKILL.md:151Unescaped File Metadata Is Interpolated Into Authenticated JSON Requests
The skill advertises very broad activation triggers such as everyday phrases like '帮我记一下' and general document/knowledge actions. This can cause the agent to invoke the skill in ambiguous contexts and route user content or files to an external service when the user may not have intended that, increasing the risk of unintended data disclosure.
This duplicate finding points to the same credential persistence pattern: storing Client ID and API Key in predictable plaintext paths and reloading them on each run. Persistent plaintext credentials increase the blast radius of any local compromise and make accidental disclosure through backups, dotfile syncing, or support bundles more likely.
方式 A — 配置文件(推荐):
mkdir -p ~/.config/ima
echo "your_client_id" > ~/.config/ima/client_id
echo "your_api_key" > ~/.config/ima/api_key
This duplicate finding points to the same credential persistence pattern: storing Client ID and API Key in predictable plaintext paths and reloading them on each run. Persistent plaintext credentials increase the blast radius of any local compromise and make accidental disclosure through backups, dotfile syncing, or support bundles more likely.
方式 A — 配置文件(推荐):
mkdir -p ~/.config/ima
echo "your_client_id" > ~/.config/ima/client_id
echo "your_api_key" > ~/.config/ima/api_key
The helper function sends arbitrary JSON bodies plus API credentials to an external network endpoint. Although the domain is restricted to the declared official service, this still creates a real exfiltration boundary: sensitive user note content, knowledge-base data, or uploaded metadata may be transmitted off-host whenever the skill is triggered.
# All requests go ONLY to the official IMA API (ima.qq.com)
ima_api() {
local path="$1" body="$2"
curl -s -X POST "https://ima.qq.com/$path" \
-H "ima-openapi-clientid: $IMA_CLIENT_ID" \
-H "ima-openapi-apikey: $IMA_API_KEY" \
-H "Content-Type: application/json" \
Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
## 模块决策表
| 用户意图 | 模块 | 读取 |
| ------------------------------------------------------------------------------------------ | -------------- | ------------------------- |
| 搜索笔记、浏览笔记本、获取笔记内容、创建笔记、追加内容 | notes | `notes/SKILL.md` |
| 上传文件、添加网页链接、搜索知识库、浏览知识库内容、获取知识库信息、获取可添加的知识库列表 | knowledge-base | `knowledge-base/SKILL.md` |
The skill content is written as mandatory operating instructions in Chinese, and the examples and user-facing messages throughout the file assume Chinese output. There is no indication that users may choose another language or that the locale restriction is justified as a region-specific requirement, which matches the language/locale policy violation criteria.
The upload workflow sends local file contents to COS and then associates them with the knowledge base, yet the skill only discusses operational steps and progress messaging, not a clear user warning that the local file will be transmitted to external services. In contexts involving personal notes, internal documents, or regulated data, this omission increases the risk of users unintentionally disclosing sensitive information.
The skill instructs the agent to fetch user-provided URLs, download remote content to a temporary directory, inspect headers, and then upload the content into external storage and the knowledge-base service, but it does not require an explicit user-facing disclosure that file contents will transit through third-party systems. This can cause unintended exfiltration of sensitive documents or authenticated resources, especially when the user may not realize that URL dereferencing and re-upload will copy the full content outside the immediate chat context.
This markdown file describes use of ima-openapi-clientid and ima-openapi-apikey, which are sensitive credentials. Under the missing-warning criterion for markdown files, the description lacks any warning about credential handling, storage, or accidental disclosure in logs, examples, or shared requests.
The quick-decision section tells the skill to upload files and add web content to the knowledge base, which can affect user data, privacy, and remote system state. The markdown does not include a user-facing warning that uploaded files, URLs, and related metadata will be sent to ima.qq.com/COS and stored in the knowledge base.
Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
### MediaType(媒体类型枚举)
| 值 | 名称 | content_type / 说明 |
| --- | -------------- | ------------------------------------------------------------------------------------------------------------- |
| 1 | PDF | `application/pdf` |
| 2 | 网页 | N/A(直接 AddKnowledge,`web_info.content_id=<url>`) |
The skill content is written entirely in Chinese and directs user-facing prompts in Chinese, such as the confirmation examples and warnings. Under the policy, forcing a specific language without giving the user a choice is a natural-language policy violation unless the locale constraint is explicitly justified.
Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
## 接口决策表
| 用户意图 | 调用接口 | 关键参数 |
| --------------------------------------------------------------------------------------------------------- | ---------------------------- | ----------------------------------------------------------------------------- |
| 搜索/查找笔记 | `search_note_book` | `query_info`(QueryInfo 对象) |
| 查看笔记本列表 | `list_note_folder_by_cursor` | `cursor`(必填,首页传`"0"`) + `limit`(必填) |
Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
## 接口决策表
| 用户意图 | 调用接口 | 关键参数 |
| --------------------------------------------------------------------------------------------------------- | ---------------------------- | ----------------------------------------------------------------------------- |
| 搜索/查找笔记 | `search_note_book` | `query_info`(QueryInfo 对象) |
| 查看笔记本列表 | `list_note_folder_by_cursor` | `cursor`(必填,首页传`"0"`) + `limit`(必填) |
Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
| 用户意图 | 调用接口 | 关键参数 |
| --------------------------------------------------------------------------------------------------------- | ---------------------------- | ----------------------------------------------------------------------------- |
| 搜索/查找笔记 | `search_note_book` | `query_info`(QueryInfo 对象) |
| 查看笔记本列表 | `list_note_folder_by_cursor` | `cursor`(必填,首页传`"0"`) + `limit`(必填) |
| 浏览某笔记本里的笔记,当用户表述"最新"、"最近"之类的通用限定,没有指明笔记本时,都应该直接在全部笔记里去拉 | `list_note_by_folder_id` | `folder_id`(选填,空为全部笔记本) + `cursor`(必填,首次传`""`) + `limit`(必填) |
| 读取笔记正文 | `get_doc_content` | `doc_id` + `target_content_format`(必填,推荐`0`纯文本) |
Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
| 用户意图 | 调用接口 | 关键参数 |
| --------------------------------------------------------------------------------------------------------- | ---------------------------- | ----------------------------------------------------------------------------- |
| 搜索/查找笔记 | `search_note_book` | `query_info`(QueryInfo 对象) |
| 查看笔记本列表 | `list_note_folder_by_cursor` | `cursor`(必填,首页传`"0"`) + `limit`(必填) |
| 浏览某笔记本里的笔记,当用户表述"最新"、"最近"之类的通用限定,没有指明笔记本时,都应该直接在全部笔记里去拉 | `list_note_by_folder_id` | `folder_id`(选填,空为全部笔记本) + `cursor`(必填,首次传`""`) + `limit`(必填) |
| 读取笔记正文 | `get_doc_content` | `doc_id` + `target_content_format`(必填,推荐`0`纯文本) |
Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
| 用户意图 | 调用接口 | 关键参数 |
| --------------------------------------------------------------------------------------------------------- | ---------------------------- | ----------------------------------------------------------------------------- |
| 搜索/查找笔记 | `search_note_book` | `query_info`(QueryInfo 对象) |
| 查看笔记本列表 | `list_note_folder_by_cursor` | `cursor`(必填,首页传`"0"`) + `limit`(必填) |
| 浏览某笔记本里的笔记,当用户表述"最新"、"最近"之类的通用限定,没有指明笔记本时,都应该直接在全部笔记里去拉 | `list_note_by_folder_id` | `folder_id`(选填,空为全部笔记本) + `cursor`(必填,首次传`""`) + `limit`(必填) |
| 读取笔记正文 | `get_doc_content` | `doc_id` + `target_content_format`(必填,推荐`0`纯文本) |
| 新建一篇笔记(用户明确说"新建/创建笔记"时走此接口) | `import_doc` | `content` + `content_format`(必填,固定`1`) + 可选 `folder_id` |
Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
| 搜索/查找笔记 | `search_note_book` | `query_info`(QueryInfo 对象) |
| 查看笔记本列表 | `list_note_folder_by_cursor` | `cursor`(必填,首页传`"0"`) + `limit`(必填) |
| 浏览某笔记本里的笔记,当用户表述"最新"、"最近"之类的通用限定,没有指明笔记本时,都应该直接在全部笔记里去拉 | `list_note_by_folder_id` | `folder_id`(选填,空为全部笔记本) + `cursor`(必填,首次传`""`) + `limit`(必填) |
| 读取笔记正文 | `get_doc_content` | `doc_id` + `target_content_format`(必填,推荐`0`纯文本) |
| 新建一篇笔记(用户明确说"新建/创建笔记"时走此接口) | `import_doc` | `content` + `content_format`(必填,固定`1`) + 可选 `folder_id` |
| 往已有笔记追加内容(⚠️ **敏感操作**:用户必须明确指定目标笔记,否则先确认再操作) | `append_doc` | `doc_id` + `content` + `content_format`(必填,固定`1`) |
Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
#### SearchedDoc
| 字段 | 类型 | 说明 |
| ---------------- | --------------------- | ------------------------------------------------------------------------------------------ |
| `doc` | DocBasicInfo | 笔记 basic 数据,见 [DocBasicInfo](#docbasicinfo) |
| `highlight_info` | map\<string, string\> | 该条笔记匹配的高亮词,key: `doc_title`(文档标题),value: 包含 `<em>高亮词</em>` 的字段值 |
The trigger guidance for search is overly broad (e.g., generic terms like ‘搜索’/‘查找’) and can cause the skill to activate on ambiguous everyday requests. In a note/knowledge-base skill, accidental invocation can expose notebook names, search hits, or note contents from a user’s private data source when the user did not clearly intend to access it.
The file is Chinese-language documentation and explicitly says to show errmsg directly to the user. Because this constrains user-visible messaging to the service-provided language without any opt-in or locale handling, it may violate the language/locale policy described in SQP-3.
No suspicious patterns detected.