T09 · Insecure Skill Coding Practices
- Location
scripts/manage_agent.py:16- Finding
Unvalidated Agent ID Allows Workspace Path Traversal and Destructive File Operations
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is intended to manage OpenClaw agents, but it handles Feishu secrets and workspace paths in ways that could expose credentials or alter unintended files.
Review this skill carefully before installing. Use it only in an OpenClaw environment where you are comfortable letting an agent create persistent workspaces, edit global OpenClaw configuration, bind Feishu bots, and restart the gateway. Prefer a test Feishu app or tightly scoped credentials, rotate any secret that appears in logs or chat transcripts, avoid the default all-open bot setting unless intended, and validate agent IDs before use.
scripts/manage_agent.py:16Unvalidated Agent ID Allows Workspace Path Traversal and Destructive File Operations
scripts/feishu_auth.py:54Feishu Application Secret Is Exposed Through Output, Process Arguments, and Plaintext Configuration
scripts/feishu_auth.py:12Predictable Shared Temporary File Insecurely Stores the Feishu OAuth Device Code
The script prints the returned App ID and especially the App Secret directly to stdout, which can expose credentials through shell history capture, terminal logging, CI logs, shared consoles, or monitoring systems. Anyone who obtains the secret may be able to impersonate the application and access Feishu resources tied to it.
The README explicitly advertises automatic Feishu authorization, credential acquisition, and binding from a chat-driven workflow, but it does not clearly warn users how sensitive OAuth tokens or bot credentials are stored, scoped, or protected. In a skill whose purpose is to create and manage other agents, this omission is more dangerous because it normalizes handing high-value credentials to an automation layer that may propagate access across multiple agents or workspaces.
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.
***
name: agent-manager
description: Manage OpenClaw Agents. Create new agents, configure workspaces, manage Feishu bot integrations (QR code scanning, bindings), and verify multi-bot routing.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Agent 管理专家 (Agent Manager)
The skill explicitly instructs the operator to obtain Feishu app credentials and then use them in command-line arguments, but it provides no warning or guardrails for handling those secrets safely. This increases the risk of credential exposure through chat transcripts, shell history, logs, process listings, or accidental copy/paste into insecure channels.
The skill states that it will automatically clean the new agent's .git directory, which destroys repository metadata and can irreversibly remove commit history, remotes, and auditability for that workspace. Doing this without an explicit warning and opt-in is dangerous because users may not realize version-control state will be deleted as part of agent creation.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
def generate_url():
try:
resp = requests.post('https://accounts.feishu.cn/oauth/v1/app/registration',
data={'action': 'begin', 'archetype': 'PersonalAgent', 'auth_method': 'client_secret', 'request_user_info': 'open_id'},
headers={'Content-Type': 'application/x-www-form-urlencoded'})
resp.raise_for_status()
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
def generate_url():
try:
resp = requests.post('https://accounts.feishu.cn/oauth/v1/app/registration',
data={'action': 'begin', 'archetype': 'PersonalAgent', 'auth_method': 'client_secret', 'request_user_info': 'open_id'},
headers={'Content-Type': 'application/x-www-form-urlencoded'})
resp.raise_for_status()
The script writes the device_code to a predictable file in /tmp, which is a shared world-accessible location on many systems. Another local user or process could read, replace, or race this file, allowing session interference or unauthorized polling of the authorization flow.
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.
print("Polling Feishu for authorization result...")
for i in range(20):
try:
resp = requests.post('https://accounts.feishu.cn/oauth/v1/app/registration',
data={'action': 'poll', 'device_code': device_code},
headers={'Content-Type': 'application/x-www-form-urlencoded'}, timeout=10)
result = resp.json()
The module docstring says the script only manages agent creation and workspace initialization, but the create path also writes Feishu credentials and bindings into the global ~/.openclaw/openclaw.json configuration. This hidden side effect can cause operators to expose or alter global messaging integrations without realizing the script changes security-relevant state beyond the local agent workspace.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def run_cmd(cmd, check=True):
print(f"Executing: {' '.join(cmd)}")
subprocess.run(cmd, check=check)
def create_agent(name, agent_id, description=""):
workspace = f"{os.path.expanduser('~')}/.openclaw/workspace-{agent_id}"
The script writes AGENTS.md and SOUL.md content entirely in Chinese, including operational guidance for the created agent. This imposes a specific language/locale on downstream agent behavior without presenting a user choice or documenting an opt-in, which matches the language-policy violation criteria.
The skill README is written entirely in Chinese and all invocation examples assume Chinese-language interaction, but it does not state that Chinese is optional or that other languages are supported. This can constitute a language/locale policy issue because the skill appears to impose a specific language without user opt-in or justification.
The documentation frames the script as a verifier, which implies checking correctness or consistency of bindings. In practice, the code loads the config and lists current bindings and app IDs, with no validation logic beyond detecting an empty bindings map.
The script reads a user configuration file from the home directory and prints account/app binding information directly to stdout. While this appears intended for troubleshooting, it can expose potentially sensitive internal identifiers in terminal logs, shared sessions, CI output, or other captured environments, making it an information disclosure issue.