Back to skill

Security audit

DingTalk Integration

Security checks for vulnerabilities and agentic risk

Overview

This DingTalk integration mostly matches its purpose, but it exposes a callable tool that returns part of an access token, which users should review before installing.

Install only if you trust the publisher and can scope the DingTalk app permissions narrowly. Before broad use, remove or disable dingtalk_get_token, avoid returning any token substring in tool results or logs, and require clear user confirmation before sending messages or creating chats.

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
dingtalk.py:248
Finding
Agent-Callable Diagnostic Tool Discloses Part of the DingTalk Access Token## Vulnerability Details **File Location**: `dingtalk.py`, lines 248–263; tool registration at lines 312–315 **Vulnerability Type**: Exposure of authentication-token material through a public tool result **Risk Level**: Medium ### Vulnerable Code ```python async def dingtalk_get_token() -> Dict[str, Any]: """ Get DingTalk access token. Returns: Dictionary with token info """ client = _get_client() if not client: return {"success": False, "error": "DingTalk not configured"} token = client.get_token(force_refresh=True) if token: return {"success": True, "token": token[:20] + "..."} else: return {"success": False, "error": "Failed to get token"} ``` The function is exposed as an Agent-callable tool: ```python { "name": "dingtalk_get_token", "description": "Get DingTalk access token" } ``` ### Technical Analysis Access tokens are bearer credentials and should remain confined to the authentication and API-client layer. This function forces a token refresh and returns the first 20 characters of the resulting token to the calling Agent. The same tool is also declared publicly in `claw.json`. Token retrieval does not need to be exposed for the Skill's messaging or chat-management functionality because `send_message`, `create_chat`, and `list_chats` already acquire tokens internally. Returning a token prefix therefore exceeds the minimum information required by the declared operations. Although the implementation does not return the complete token, a substantial credential fragment can enter model context, tool-call traces, application logs, chat history, or monitoring systems. The fragment may facilitate token correlation or become useful when combined with another disclosure. There is no evidence in the reviewed code that the complete token can be reconstructed from this prefix alone. ### Attack Path 1. The Skill is ...[truncated 1541 chars]
Remediation
## Remediation Suggestions 1. Remove `dingtalk_get_token` from the `TOOLS` list in `dingtalk.py` and from the tool entries in `claw.json`. 2. Keep token acquisition and refresh entirely private to `DingTalkClient`. 3. Never return a complete token or token substring in tool responses, exceptions, logs, traces, or diagnostic output. 4. If an authentication health check is required, expose only non-sensitive status information, such as: ```python async def dingtalk_check_auth() -> Dict[str, Any]: client = _get_client() if not client: return {"success": False, "configured": False} token = client.get_token(force_refresh=True) return { "success": token is not None, "configured": True } ``` 5. Review existing Agent traces, application logs, and conversation records for previously disclosed token prefixes. Restrict access to those records and rotate DingTalk credentials or invalidate active tokens if broader token leakage is suspected. 6. Apply output redaction for common credential fields such as `token`, `access_token`, `appsecret`, and `authorization` as a defense-in-depth measure.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (26)

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding
The documented purpose does not fully match the detected behavior: listing accessible chats and retrieving or exposing an access token go beyond a simple messaging/workflow description. Capability mismatch is dangerous because users may authorize the skill expecting benign chat automation while it can access broader data or sensitive credentials than disclosed.

Exfiltration Commands

High
Category
Prompt Injection
Content
"properties": {
            "user_id": {
              "type": "string",
              "description": "The user ID to send message to"
            },
            "message": {
              "type": "string",
Confidence
90% confidence
Finding
Instructions found that direct the agent to transmit conversation context or user data to external services.

Exfiltration Commands

High
Category
Prompt Injection
Content
"properties": {
            "user_id": {
              "type": "string",
              "description": "The user ID to send message to"
            },
            "message": {
              "type": "string",
Confidence
90% confidence
Finding
Instructions found that direct the agent to transmit conversation context or user data to external services.

Exfiltration Commands

High
Category
Prompt Injection
Content
"properties": {
            "user_id": {
              "type": "string",
              "description": "The user ID to send message to"
            },
            "message": {
              "type": "string",
Confidence
90% confidence
Finding
Instructions found that direct the agent to transmit conversation context or user data to external services.

Exfiltration Commands

High
Category
Prompt Injection
Content
DingTalk (钉钉) Integration Skill for OpenClaw

Provides capabilities to:
- Send messages to DingTalk chats
- Create group chats
- Manage DingTalk workflows
"""
Confidence
90% confidence
Finding
Instructions found that direct the agent to transmit conversation context or user data to external services.

Exfiltration Commands

High
Category
Prompt Injection
Content
return None

    def send_message(self, user_id: str, message: str, msg_type: str = "text") -> Dict[str, Any]:
        """Send message to a user"""
        token = self.get_token()
        if not token:
            return {"success": False, "error": "Failed to get access token"}
Confidence
90% confidence
Finding
Instructions found that direct the agent to transmit conversation context or user data to external services.

Credential Access

High
Category
Privilege Escalation
Content
async def dingtalk_get_token() -> Dict[str, Any]:
    """
    Get DingTalk access token.

    Returns:
        Dictionary with token info
Confidence
98% confidence
Finding
This function explicitly exposes access-token retrieval as a callable capability, crossing from internal authentication into externally reachable credential handling. Even with truncation, it creates an unjustified secret-access surface and invites misuse, probing, or later regression into full secret disclosure.

Credential Access

High
Category
Privilege Escalation
Content
},
    {
        "name": "dingtalk_get_token",
        "description": "Get DingTalk access token"
    }
]
Confidence
99% confidence
Finding
Advertising 'Get DingTalk access token' in the tool definition makes credential-oriented behavior discoverable and callable by any agent/user allowed to access the skill. In an LLM tool ecosystem, exposing such a tool materially increases the risk of secret targeting and abuse beyond the integration's legitimate purpose.

Credential Access

High
Category
Privilege Escalation
Content
List all accessible DingTalk chats for the authenticated app.

### dingtalk_get_token
Get the DingTalk access token for API calls.

## Configuration
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
List all accessible DingTalk chats for the authenticated app.

### dingtalk_get_token
Get the DingTalk access token for API calls.

## Configuration
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
List all accessible DingTalk chats for the authenticated app.

### dingtalk_get_token
Get the DingTalk access token for API calls.

## Configuration
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
List all accessible DingTalk chats for the authenticated app.

### dingtalk_get_token
Get the DingTalk access token for API calls.

## Configuration
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
List all accessible DingTalk chats for the authenticated app.

### dingtalk_get_token
Get the DingTalk access token for API calls.

## Configuration
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
List all accessible DingTalk chats for the authenticated app.

### dingtalk_get_token
Get the DingTalk access token for API calls.

## Configuration
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Lp3

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The skill declares required environment variables and its documented functionality clearly implies outbound network access, but it does not declare any explicit tool scope such as permissions or allowed-tools. That weakens least-privilege controls and makes it harder for users or the platform to understand and constrain what the skill can access at runtime.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The skill advertises actions that can send messages and create groups on the user's behalf without clearly warning about those side effects. In an agent setting, insufficient disclosure can lead to unauthorized or unintended communications, social engineering opportunities, or disruptive group creation if a user invokes the skill without understanding its authority.

Missing User Warnings

Medium
Confidence
86% confidence
Finding
The skill reads sensitive environment variables containing DingTalk application credentials and uses them to authenticate API requests. While the code logs missing configuration, it does not clearly disclose to users that credential-based access will be used by this skill.

External Transmission

Medium
Category
Data Exfiltration
Content
}

        try:
            response = requests.post(
                f"{BASE_URL}/topapi/message/corpconversation_asyncsend_v2",
                params={"access_token": token},
                headers=headers,
Confidence
80% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
}

        try:
            response = requests.post(
                f"{BASE_URL}/topapi/chat/create",
                params={"access_token": token},
                headers=headers,
Confidence
80% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The create-chat tool performs an external state-changing action with no built-in confirmation, approval gate, or user-disclosure mechanism. In agent environments, this can lead to unintended creation of chats, unwanted addition of users, or abuse through prompt-driven actions that the user did not explicitly authorize.

Description-Behavior Mismatch

Medium
Confidence
97% confidence
Finding
The skill exposes a public function that retrieves a DingTalk access token, which exceeds the stated messaging/group/workflow scope and creates an unnecessary credential-handling surface. Even though the returned token is truncated, the capability normalizes token access and could be expanded, misused, or relied upon by other components to expose sensitive authentication material.

Context-Inappropriate Capability

Medium
Confidence
98% confidence
Finding
Registering dingtalk_get_token as a public tool grants callers direct access to credential-derived data without a business need for normal messaging operations. In an agent setting, any unnecessary credential-oriented tool materially increases the chance of secret probing, privilege misuse, and future accidental full-token disclosure.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The skill enables sending messages and managing group chats but does not warn users that these actions may affect other people, expose organizational metadata, or transmit potentially sensitive content through DingTalk. In a messaging/integration skill, omission of privacy and consent guidance increases the risk of misuse, accidental disclosure, and unauthorized communications.

Natural-Language Policy Violations

Low
Confidence
71% confidence
Finding
The description and tags emphasize DingTalk and 'chinese', which may imply a fixed locale/language context, but the file does not explicitly state that the skill is region-specific or offer language/locale choice. Organizational policy requires locale constraints to be documented and justified when a skill effectively targets a specific language or region.

Natural-Language Policy Violations

Low
Confidence
61% confidence
Finding
The file presents itself specifically as a DingTalk (钉钉) integration, which implies a language and locale-specific platform context, but there is no explicit explanation of that scope for users. This can be a policy concern when a skill assumes a locale-specific communication platform without stating that the behavior is region/service specific.

Static analysis

No suspicious patterns detected.