T01 · Skill Instruction Hijacking
- Location
ima_api.cjs:119- Finding
Server-Supplied Update Instructions Can Hijack the Agent Session
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill mostly matches its IMA notes and knowledge-base purpose, but it has under-scoped network and update behavior that could expose credentials or let remote text steer the agent.
Review this skill carefully before installing. Use credentials with the least privileges available, avoid plaintext credential files where possible, do not set IMA_BASE_URL or pass baseUrl unless you fully trust the destination, and avoid importing URLs that could resolve to private or internal network resources.
ima_api.cjs:119Server-Supplied Update Instructions Can Hijack the Agent Session
ima_api.cjs:139Caller-Controlled Base URL Can Exfiltrate IMA API Credentials
knowledge-base/SKILL.md:190Arbitrary URL Download Workflow Enables SSRF and Upload of Retrieved Internal Data
The activation criteria are extremely broad, including generic phrases like '帮我记一下' and common document/note intents. This can cause the skill to trigger in many unrelated conversations, unnecessarily exposing user content and credentials to a networked skill and creating opportunities for data exfiltration or unintended remote actions.
The skill declares network and environment-variable capabilities but does not bound them with an explicit tool scope such as permissions or allowed-tools. In practice, this leaves enforcement to prose and increases the chance the agent can access credentials or make unintended outbound calls beyond the intended IMA API flow.
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.
1. **UTF-8 encoding (notes writes only):** Before calling `import_doc` or `append_doc`, ALL string fields (`content`, `title`) MUST be validated as legal UTF-8. Non-UTF-8 content causes irreversible garbled text. See [Detailed Rules](#detailed-utf-8-encoding-rules) for platform-specific methods.
2. **File upload naming:** `title` MUST equal `file_name` (with extension). Never rename, shorten, translate, or modify the original filename.
3. **Unsupported file types:** Reject immediately with a clear message. Do NOT ask user "do you still want to try?" Video files, Bilibili/YouTube URLs, and `file://` URLs are not supported — tell user to use IMA desktop client.
4. **File upload integrity:** Keep file content as-is during upload. No encoding conversion for binary files (PDF, images, Excel, etc.).
5. **PowerShell 5.1 (all modules):** If running in PowerShell, detect version before first API call. PS 5.1 silently converts request Body to GBK — must use UTF-8 byte array mode. See [Detailed Rules](#powershell-51-environment-detection).
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` |
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 instructs users to persist long-lived API credentials in plaintext files under ~/.config/ima. Plaintext session or API-secret storage increases the risk of credential theft by other local processes, users, backups, or accidental disclosure, especially since these credentials enable authenticated API access.
方式 A — 配置文件(推荐):
mkdir -p ~/.config/ima
echo "your_client_id" > ~/.config/ima/client_id
echo "your_api_key" > ~/.config/ima/api_key
The function sends clientId and apiKey in outbound request headers to a remote service, which is a safety-relevant network operation involving credentials. This file contains no confirmation prompt, user-facing log, or inline warning near the transmission to disclose that credentials will be sent over the network.
The skill performs an undisclosed network-based self-update check and persists local state in the user's home directory, behavior that is not implied by the note/knowledge-base description. This expands the skill's actual capabilities beyond user expectations and introduces a control path where a remote service can influence execution flow by causing the skill to abort with an update-required condition.
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.
## 接口决策表
| 用户意图 | 调用接口 | 关键参数 |
| --------------------------------------------- | ---------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| 上传文件到知识库 | `check_repeated_names` → `create_media` → COS Upload → `add_knowledge` | `media_type`(按扩展名),`knowledge_base_id`,`file_name`,`file_size` |
| 上传文件到知识库的某个文件夹 | 先定位文件夹 → 同上(`folder_id` 传入目标文件夹 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.
## 接口决策表
| 用户意图 | 调用接口 | 关键参数 |
| --------------------------------------------- | ---------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| 上传文件到知识库 | `check_repeated_names` → `create_media` → COS Upload → `add_knowledge` | `media_type`(按扩展名),`knowledge_base_id`,`file_name`,`file_size` |
| 上传文件到知识库的某个文件夹 | 先定位文件夹 → 同上(`folder_id` 传入目标文件夹 ID) | 见「文件夹操作」章节 |
The skill explicitly instructs downloading attacker-controlled external URLs with curl into a local temporary directory and then processing the file through subsequent tooling. Even though the file is later deleted, this still causes untrusted remote content to be fetched onto the local system, creating SSRF-like reachability, malicious file handling, and downstream parser/processing exposure without any documented trust boundary, allowlist, or safety checks on the source URL.
The documentation explicitly instructs callers to send long-lived API credentials (ima-openapi-clientid, ima-openapi-apikey) and later also describes handling returned access headers for media retrieval, but it provides no warning about treating these values as secrets. In an agent skill context, omission of secret-handling guidance increases the chance that credentials or privileged headers are logged, surfaced to users, or reused insecurely across requests, enabling unauthorized API access or data exposure.
The quick-start workflow normalizes file upload and URL import into a remote knowledge base without any user-consent, privacy, or retention warning. In a skill that may be triggered from vague intents like '帮我记一下' or upload-related requests, this omission can cause users' files, notes, or URLs to be transmitted to third-party infrastructure and stored remotely without clear notice, creating privacy and compliance risk.
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.
| 值 | 名称 | content_type / 说明 |
| --- | -------------- | ------------------------------------------------------------------------------------------------------------- |
| 1 | PDF | `application/pdf` |
| 2 | 网页 | N/A(直接 AddKnowledge,`web_info.content_id=<url>`) |
| 3 | Word | `application/msword` / `application/vnd.openxmlformats-officedocument.wordprocessingml.document` |
| 4 | PPT | `application/vnd.ms-powerpoint` / `application/vnd.openxmlformats-officedocument.presentationml.presentation` |
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.
| 9 | 图片 | `image/png`, `image/jpeg`, `image/webp` |
| 11 | 笔记 | N/A(直接 AddKnowledge,`note_info.content_id=<doc_id>`) |
| 12 | AI会话 | N/A(直接 AddKnowledge,`session_info.content_id=<session_id>`) |
| 13 | TXT | `text/plain` |
| 14 | Xmind | `application/x-xmind` / `application/vnd.xmind.workbook` / `application/zip` |
| 15 | 录音 | `audio/mpeg`(mp3), `audio/x-m4a`(m4a), `audio/wav`(wav), `audio/aac`(aac) |
| 16 | 视频解析 | **不支持通过 skill 添加**。Bilibili/YouTube/本地HTML等仅支持在 ima 桌面端内添加进知识库 |
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.
#### 返回字段(`data` 内)
| 字段 | 类型 | 说明 |
| ------------------- | --------------- | ------------------------------------------------------------------------------------------------- |
| `media_type` | int32 | 媒体类型(见 MediaType 枚举) |
| `url_info` | URLInfo | 访问链接信息,非笔记类型时填写(见 [URLInfo](#urlinfo访问链接信息)) |
The trigger guidance uses broad phrases like general 'search/find' wording for a privacy-sensitive notes capability, which can cause the agent to invoke the note-search API when the user meant a general conversation or non-note lookup. In this skill context, accidental invocation can expose notebook metadata or private note-derived results unnecessarily, making misrouting more dangerous than in a non-sensitive domain.
The note-listing trigger includes very broad phrases such as 'recent notes' or 'list notes' without sufficient scope constraints, so ordinary organizational requests may be interpreted as permission to enumerate private user data. Because notebook contents are sensitive, overbroad dispatch increases the chance of unintended disclosure of titles, summaries, and folder structure.
The documentation exposes note creation and modification capabilities but does not require an explicit user warning or confirmation that the action will persist or alter personal data. For a privacy-sensitive notes system, missing write-safety UX increases the risk of unauthorized or accidental storage and modification, especially when combined with broad trigger phrases.
The create/import trigger includes generalized 'save/create' phrasing that can match ordinary assistant tasks, leading the agent to write user data into persistent storage without clear consent. In a notes skill, unintended persistence is a privacy and integrity risk because it may store sensitive content the user only wanted drafted or discussed transiently.
The append trigger is underconstrained and may fire on ordinary editing instructions, causing silent modification of an existing note. In this context, unintended appends can corrupt user records, inject sensitive conversational content into notes, or create auditability problems around what was actually authorized.
The implementation loads clientId and apiKey from environment variables and files in ~/.config/ima/. While authentication may be operationally useful for calling the IMA API, the manifest does not mention credential handling or local secret-file access as part of the skill’s purpose, so this capability is not justified by the stated user-facing scope alone.
The skill emits Chinese-only natural-language messages such as the missing-credentials error, with similar Chinese strings elsewhere in the file. This imposes a specific language on users without opt-in or locale selection, which matches the language/locale policy violation criterion.
The code creates directories and writes the last update check date to ~/.config/ima/last_update_check, which modifies user state on disk. There is no prompt, log message, or nearby warning indicating that the skill persists this data locally.
Natural-language policy requires avoiding forced language or locale constraints without user opt-in or clear justification. This skill documentation is entirely Chinese and does not state that the language is optional, user-selected, or limited to a justified region-specific context.