T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/index.js:509- Finding
Whitelist authorization is not bound to the actual document mutation target
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This DingTalk document skill is mostly coherent, but it exposes high-impact write/delete powers with weak boundaries that should be reviewed before installation.
Install only if you trust the DingTalk app credentials and first replace the bundled whitelist with narrow, user-approved targets. Avoid using the low-level dingtalk-client.js commands, remove or disable get-token, and require explicit confirmation for overwrites and deletions.
scripts/index.js:509Whitelist authorization is not bound to the actual document mutation target
scripts/dingtalk-client.js:610Direct low-level client commands bypass mandatory whitelist enforcement
scripts/dingtalk-client.js:570Live DingTalk access token is exposed through standard output
config/whitelist.json:4Distributed whitelist configuration enables workspace-wide destructive access by default
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
OpenClaw 会在启动时自动加载此文件中的环境变量。
# ~/.openclaw/.env
DINGTALK_CLIENTID=dingxxxxxx
DINGTALK_CLIENTSECRET=your_secret
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).
- `POST /v1.0/doc/workspaces/{workspaceId}/docs`
- `GET /v2.0/wiki/nodes`
- `GET /v2.0/wiki/nodes/{nodeId}`
- `DELETE /v1.0/doc/workspaces/{workspaceId}/docs/{nodeId}`
- `GET /v1.0/doc/suites/documents/{docKey}/blocks`
- `POST /v1.0/doc/suites/documents/{docKey}/overwriteContent`
- `POST /v1.0/doc/suites/documents/{docKey}/blocks`
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).
- `POST /v1.0/doc/suites/documents/{docKey}/overwriteContent`
- `POST /v1.0/doc/suites/documents/{docKey}/blocks`
- `PUT /v1.0/doc/suites/documents/{docKey}/blocks/{blockId}`
- `DELETE /v1.0/doc/suites/documents/{docKey}/blocks/{blockId}`
常见所需权限:
The top-level description presents the skill as a document read/update helper, but the body documents materially broader capabilities such as token acquisition, user identity resolution, create/delete operations, CLI execution, and potentially wider workspace management. This mismatch can cause reviewers or orchestrators to authorize the skill under a narrower trust model than its actual power warrants.
The top-level description presents the skill as a document read/update helper, but the body documents materially broader capabilities such as token acquisition, user identity resolution, create/delete operations, CLI execution, and potentially wider workspace management. This mismatch can cause reviewers or orchestrators to authorize the skill under a narrower trust model than its actual power warrants.
Referenced artifact was not completely inspected
通过钉钉开放平台 API 管理钉钉文档与钉钉知识库内文档。`SKILL.md` 只保留 agent 执行所需规则;配置细节、示例、API 背景见 `README.md`。
Referenced artifact was not completely inspected
- `scripts/index.js`:主入口
Referenced artifact was not completely inspected
- `scripts/index.js`:主入口
Referenced artifact was not completely inspected
- `scripts/index.js`:主入口
Referenced artifact was not completely inspected
- `scripts/index.js`:主入口
The deleteDoc primitive accepts workspaceId/nodeId/operatorId and directly constructs a destructive API request with no local authorization, confirmation, or constraint on what resources may be targeted. This is a classic high-risk tool surface for parameter abuse in agent systems, where attacker-influenced parameters can cause deletion of arbitrary accessible documents.
/**
* 删除知识库文档 (doc_1.0)
* API: DELETE /v1.0/doc/workspaces/{workspaceId}/docs/{nodeId}
*/
async function deleteDoc(workspaceId, nodeId, operatorId) {
const path = `/v1.0/doc/workspaces/${workspaceId}/docs/${nodeId}?operatorId=${encodeURIComponent(operatorId)}`;
The deleteBlock primitive similarly accepts attacker-influenceable identifiers and issues a destructive API request without confirming the block belongs to the intended document context or that the user explicitly approved its removal. In an agent environment, this increases the chance of unauthorized or accidental content removal through parameter manipulation.
/**
* 删除块元素
* API: DELETE /v1.0/doc/suites/documents/{docKey}/blocks/{blockId}
*/
async function deleteBlock(docKey, blockId, operatorId) {
const path = `/v1.0/doc/suites/documents/${docKey}/blocks/${blockId}?operatorId=${encodeURIComponent(operatorId)}`;
The write authorization is bound to nodeId, but the actual destructive API call uses a caller-supplied docKey without verifying that the docKey belongs to the same document that was authorized. An attacker or confused caller could pass an allowed nodeId to satisfy whitelist checks and a different docKey for overwrite/delete/modify operations, potentially causing unauthorized writes or deletions against another accessible document.
/**
* 删除块元素(写入操作,需要白名单)
* API: DELETE /v1.0/doc/suites/documents/{docKey}/blocks/{blockId}
*
* @param {string} nodeId - 节点 ID(用于白名单检查)
* @param {string} blockId - 块 ID
The skill relies on sensitive environment variables (DINGTALK_CLIENTID, DINGTALK_CLIENTSECRET, sender identity fields) but does not declare an explicit tool scope or permissions boundary in the skill manifest. That weakens reviewability and increases the chance the agent accesses secrets or identity context more broadly than operators expect.
The skill documents destructive actions such as overwrite, block deletion, and document deletion without requiring explicit user confirmation or warning about irreversible data loss. In an agent setting, ambiguous or mistaken instructions could therefore lead to unintended destructive changes to production knowledge-base content.
The file presents a contradictory security posture: a comment says AI must not modify the configuration, yet the actual policy grants broad write access via allowRootWrite=true and whitelist ['/'], effectively permitting writes anywhere in the workspace root. In the context of a document-management skill that can update DingTalk docs/knowledge-base content, this makes unauthorized or overbroad AI-driven modification materially more dangerous because a prompt mistake or adversarial instruction could alter arbitrary content in the allowed workspace.
The skill resolves sender IDs to unionId/operatorId by querying user profile/address-book APIs, adding identity lookup functionality unrelated to simple document handling. This increases access to organizational identity data and creates privacy and privilege risks if sender IDs are spoofed, mishandled, or logged, especially since operator identity is then reused to authorize downstream document actions.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
/**
* 获取 access_token(企业内部应用)
* POST https://api.dingtalk.com/v1.0/oauth2/accessToken
*
* @returns {Promise<string>} 用于请求头 x-acs-dingtalk-access-token 的 accessToken
*/
The client exposes destructive and administrative capabilities such as deleting documents, deleting blocks, copying nodes, and creating workspaces/docs, which go beyond the skill’s stated document read/summarize/update purpose. Scope expansion increases the blast radius if the skill is invoked unexpectedly or manipulated by prompt/tool misuse, because the process can perform irreversible changes rather than only read or summarize content.
The overwriteContent operation replaces entire document contents without any user-facing warning, preview, or confirmation. Because it is a full overwrite rather than a bounded edit, misuse can cause large-scale data loss or tampering from a single call.
The block deletion primitive removes content with no confirmation or guardrails. In a document-management agent, low-friction destructive primitives are dangerous because they can be triggered by malformed instructions, parameter confusion, or prompt injection and may silently remove important content.
The CLI exposes document deletion directly with no confirmation, dry-run, or secondary approval step. In an agent skill context, this makes accidental, coerced, or prompt-injected destructive execution much more likely, and the action is potentially irreversible.
The script performs document deletion via deleteDoc(...) after permission checks, but there is no confirmation prompt, user-facing warning, or log immediately before the irreversible action. Although the file comments describe delete capability, they do not clearly disclose at runtime that the command will permanently remove content.
The function deletes a document block through deleteBlock(...), which is an irreversible content modification. The code includes permission checks but no confirmation prompt, no warning print/log, and no nearby user-facing disclosure that the targeted block content will be removed.
This code file contains natural-language comments and CLI output in Chinese, and the help/error interface shown to users is also fixed to Chinese later in the file. Under the policy, forcing a specific language without user opt-in is a locale/language policy violation unless the tool is clearly documented as region-specific, which is not evident here.