Back to skill

Security audit

Feishu Channel Integration for Nanoclaw​

Security checks for vulnerabilities and agentic risk

Overview

The Feishu channel is mostly coherent, but it needs Review because it duplicates the whole environment file containing secrets and asks for an apparently unused Feishu chat-member permission.

Review before installing. Use a dedicated runtime env file containing only FEISHU_APP_ID and FEISHU_APP_SECRET, restrict its permissions, and keep it out of version control, backups, and diagnostics. Remove im:chat.members:read unless you verify it is required. Prefer pinned/local install and test tooling, and understand that registered Feishu chat messages, sender identity, and chat metadata will be processed and stored by NanoClaw so the bot can respond.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:101
Finding

Unnecessary Duplication of the Entire Environment File

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 101-102
Vulnerability Type: Sensitive credential exposure through excessive environment copying
Risk Level: Medium

bash
mkdir -p data/env && cp .env data/env/env

Technical Analysis

The Feishu integration requires only FEISHU_APP_ID and FEISHU_APP_SECRET, but the setup instructions copy the complete .env file into data/env/env. This can duplicate unrelated credentials, API keys, database passwords, and other secrets into a location intended for the container environment.

The command does not explicitly set restrictive permissions on the destination directory or file. The effective permissions depend on the source file, process umask, host configuration, and container volume mappings. Creating an unnecessary second copy also expands the number of locations that must be protected, rotated, excluded from version control, and removed from backups.

Attack Path

  1. A user follows the Skill instructions with an .env file containing Feishu credentials and unrelated application secrets.
  2. The complete file is copied to data/env/env.
  3. The data directory is mounted into a container, included in a backup, exposed to another local process, or otherwise granted broader access than the original .env.
  4. A process or user able to read the duplicated file obtains all credentials stored in the original .env, rather than only the two Feishu credentials required by this integration.
  5. The exposed credentials may then be used against their corresponding external services.

Impact Assessment

The potential scope is not limited to Feishu. Any secret present in .env may be exposed to principals that can access data/env/env. Depending on the contents of the host project, this could include credentials for databases, messaging platforms, cloud services, or model providers.

This does not independently grant access unless an attac ...[truncated 149 chars]

Remediation
View remediation

Remediation Suggestions

  • Create a dedicated environment file containing only the variables required by this channel.
  • Create the destination directory and file with restrictive permissions.
  • Avoid copying unrelated entries from .env.
  • Ensure the generated file is excluded from source control and unnecessary backups.
  • Document credential rotation and secure deletion requirements.

Example hardened approach:

bash
install -d -m 700 data/env
umask 077
{
  printf 'FEISHU_APP_ID=%s\n' "$FEISHU_APP_ID"
  printf 'FEISHU_APP_SECRET=%s\n' "$FEISHU_APP_SECRET"
} > data/env/env
chmod 600 data/env/env

If values must be read from .env, use a parser that selects only the two exact variable names rather than copying the complete file. Prefer the deployment platform's secret-management facility where available.

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
SKILL.md:76
Finding

Feishu Chat-Member Permission Exceeds Implemented Functionality

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 76-80
Vulnerability Type: Excessive third-party API permission
Risk Level: Medium

text
6. Go to **Permissions & Scopes** → add the following permissions:
   - `im:message` (Send & receive messages)
   - `im:message:send_as_bot` (Send messages as bot)
   - `im:chat` (Read chat info)
   - `im:chat.members:read` (Read chat members)

Technical Analysis

The setup instructions request im:chat.members:read, which permits access to chat membership information. The audited implementation receives messages, sends bot replies, requests bot information, resolves individual sender names, and retrieves chat metadata. It does not enumerate or otherwise use chat-member lists.

Granting an unused scope violates least privilege. Although the extra permission is administered by Feishu rather than the local operating system, it expands the authority associated with the application credentials and increases the impact of credential compromise or malicious modification of the integration.

The implementation also calls the contact user API to resolve sender names, but the documented permission list does not explain which minimum contact scope, if any, Feishu requires for that specific operation. Permissions should be validated against the actual API calls instead of requesting broad scopes speculatively.

Attack Path

  1. An administrator follows the Skill instructions and grants the Feishu application im:chat.members:read.
  2. The application receives credentials or tokens carrying that approved authority.
  3. An attacker obtains the Feishu App Secret or compromises the process using it.
  4. The attacker authenticates to Feishu through the application and invokes chat-member APIs that the audited Skill itself does not need.
  5. The attacker enumerates membership information for chats accessible to the application, subject to Feishu tenant controls and ...[truncated 583 chars]
Remediation
View remediation

Remediation Suggestions

  • Remove im:chat.members:read from the required setup permissions.
  • Document every requested Feishu permission alongside the exact API call and feature that requires it.
  • Test installation with the minimum scopes needed for:
    • receiving im.message.receive_v1 events;
    • sending messages as the bot;
    • reading the current chat's metadata;
    • resolving a sender's display name, if that behavior is retained.
  • If member enumeration is added later, make it an optional feature with a separate permission request and explicit administrator consent.
  • Periodically review and revoke unused scopes in the Feishu application console.
  • Rotate the App Secret if it may have been exposed, and restrict the app's tenant and chat availability as narrowly as operationally possible.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (12)

Credential Access

High
Category
Privilege Escalation
Confidence
93% confidence
Finding

The instruction to copy .env into data/env/env explicitly duplicates secrets into another persistent plaintext location that the container consumes. If that directory is more broadly readable, mounted into containers, captured in backups, or exposed through debugging/log collection, an attacker could obtain the Feishu App Secret and impersonate the integration.

Content

Scanner excerpt · SKILL.md (reported line 102)May include surrounding context.

Sync to container environment:

bash
mkdir -p data/env && cp .env data/env/env

The container reads environment from data/env/env, not .env directly.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill instructs the agent/user to access environment secrets and copy them into runtime files, but the skill metadata declares no explicit tool scope or permissions boundaries. Missing scope declarations increase the chance that an automation system grants broader-than-necessary access or that users cannot accurately assess what sensitive operations the skill performs.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
91% confidence
Finding

Using npx tsx without pinning an exact package version introduces a supply-chain risk because the command may resolve to a different package version over time. A compromised or unexpectedly changed dependency could execute arbitrary code during skill application.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
91% confidence
Finding

The second npx tsx invocation has the same unpinned dependency risk as the first and can fetch or execute an unexpected package version. Because it applies code changes from the skill package, compromise here could directly alter the target repository or execute malicious install-time behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The skill tells the user to copy .env into data/env/env, creating another plaintext copy of sensitive credentials, but does not warn at that step about persistence, file permissions, backup exposure, or accidental inclusion in artifacts. This increases the attack surface for secret disclosure, especially in shared hosts, containers, or support bundles.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The troubleshooting section states that group responses are triggered by message keywords such as '帮, 请, 分析', which imposes a specific language behavior in natural-language instructions. There is no indication that users can configure equivalent keywords for other languages or that this limitation is intentionally scoped to a Chinese-language deployment.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 234)May include surrounding context.

If running npm run dev while the service is active:

bash
# macOS:
launchctl unload ~/Library/LaunchAgents/com.nanoclaw.plist
npm run dev
# When done testing:
launchctl load ~/Library/LaunchAgents/com.nanoclaw.plist

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 237)May include surrounding context.

If running npm run dev while the service is active:

bash
# macOS:
launchctl unload ~/Library/LaunchAgents/com.nanoclaw.plist
npm run dev
# When done testing:
launchctl load ~/Library/LaunchAgents/com.nanoclaw.plist

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 237)May include surrounding context.

md
launchctl unload ~/Library/LaunchAgents/com.nanoclaw.plist
npm run dev
# When done testing:
launchctl load ~/Library/LaunchAgents/com.nanoclaw.plist
# Linux:
# systemctl --user stop nanoclaw
# npm run dev

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The handler forwards message content, sender identity, and chat metadata to the skill via onMessage and logs that the message was stored. This involves processing and retaining user/chat data, but the file provides no user-facing notice, confirmation, or explanatory comment/docstring disclosing that messages from registered chats will be ingested and stored.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
91% confidence
Finding

The manifest’s test command uses npx vitest without pinning the exact package version in the invocation. If vitest is not already installed from the locked project dependencies, npx may resolve and execute an unexpected version from the registry at runtime, reducing build reproducibility and creating a supply-chain execution risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The channel reads FEISHU_APP_ID and FEISHU_APP_SECRET from environment/config and uses them to connect to Feishu and make API requests. Although this is expected for a Feishu integration, this file does not include any user-facing warning or explanatory documentation about credential use or external transmission.

Content

No source excerpt is available for this finding.