Back to skill

Security audit

Enterprise AI Assistant Bundle

Security checks for vulnerabilities and agentic risk

Overview

This is a plausible Feishu/OpenClaw assistant, but it exposes enterprise messages and credentials with weak controls that users should review before installing.

Review this before installing in any real enterprise tenant. Use only in a contained test environment unless you add Feishu webhook signature/token validation, rate limits, TLS/proxy deployment controls, secret handling through environment or a secret manager, pinned dependencies, and clear notice/approval for sending chat contents to the external model provider.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
bot.py:39
Finding
Unauthenticated Public Webhook Permits Unauthorized Model API Usage## Vulnerability Details **File Location**: `bot.py:39-70` **Vulnerability Type**: Missing webhook authentication and request-integrity validation **Risk Level**: High ### Complete Code Snippet ```python @app.route("/webhook", methods=["POST"]) def webhook(): """处理飞书消息""" data = request.json # 验证请求 if data.get("type") == "url_verification": return {"challenge": data["challenge"]} # 解析消息 event = data.get("event", {}) message = event.get("message", {}) content = json.loads(message.get("content", "{}")) text = content.get("text", "") sender_id = event.get("sender", {}).get("sender_id", {}).get("open_id", "") # 调用 AI 生成回复 messages = [ {"role": "system", "content": "你是企业AI助手,用简洁专业的中文回答问题。"}, {"role": "user", "content": text} ] reply = call_openclaw(messages) # TODO: 调用飞书 API 发送回复 # 这里需要使用 lark SDK 发送消息 return {"success": True, "reply": reply} ``` The service is additionally exposed on all network interfaces at `bot.py:82`: ```python app.run(host="0.0.0.0", port=8080) ``` ### Technical Analysis The `/webhook` endpoint trusts every incoming JSON request. Although the code contains a request-verification comment, it only handles the Feishu URL-verification challenge and does not authenticate normal events. There is no verification of a webhook signature, verification token, encryption key, timestamp, nonce, source address, or event identifier. There is also no replay protection or rate limiting. Consequently, an attacker who can reach TCP port 8080 can construct a synthetic event containing arbitrary text. The application then forwards that text to the configured OpenClaw endpoint while authenticating with the server's `OPENCLAW_API_KEY`. Returning the model response directly also provides attackers with an unauthenticated model API proxy. The unused `sender_i ...[truncated 1529 chars]
Remediation
## Remediation Suggestions 1. Validate every webhook using Feishu's documented signature, verification-token, or encrypted-event mechanism before reading or processing event content. 2. Store verification credentials in a secret manager or protected environment variables rather than trusting fields from the incoming request. 3. Validate timestamps and nonces and maintain a bounded cache of processed event identifiers to prevent replay attacks. 4. Reject requests with missing, malformed, stale, or invalid authentication data using an appropriate authorization error. 5. Apply per-source and global rate limits, request-size limits, model-token limits, and API spending controls. 6. Restrict network exposure through a firewall, reverse proxy, or API gateway. Do not directly expose Flask's development server. 7. Deploy through a production WSGI server with TLS termination, structured security logging, and alerting for repeated authentication failures. 8. Validate the event schema and ensure the sender and tenant are authorized before invoking the model.

T09 · Insecure Skill Coding Practices

Warning
Location
deploy.py:27
Finding
Feishu Application Secret Is Accepted on the Command Line and Stored in Plaintext## Vulnerability Details **File Location**: `deploy.py:27-44` **Vulnerability Type**: Insecure sensitive-data storage and handling **Risk Level**: Medium ### Complete Code Snippet ```python def create_config(app_id, app_secret, model="deepseek-chat"): """创建配置文件""" config = { "feishu": { "app_id": app_id, "app_secret": app_secret, "encrypt_key": "", "verification_token": "" }, "openclaw": { "model": model, "api_key": "${OPENCLAW_API_KEY}", "base_url": "https://api.openclaw.ai/v1" }, "skills": [ "smart-reply", "meeting-assistant", "approval-bot" ] } config_path = Path("config.json") with open(config_path, "w") as f: json.dump(config, f, indent=2) print(f"✅ 配置文件已创建: {config_path}") return config_path ``` The secret is supplied through a required command-line argument at `deploy.py:91-95`: ```python parser = argparse.ArgumentParser(description="企业 AI 助手一键部署") parser.add_argument("--app-id", required=True, help="飞书应用 ID") parser.add_argument("--app-secret", required=True, help="飞书应用密钥") parser.add_argument("--model", default="deepseek-chat", help="AI 模型") args = parser.parse_args() ``` ### Technical Analysis The deployment script accepts the Feishu application secret as a command-line argument and serializes it directly into `config.json`. Command-line arguments may be visible in process listings and can be retained in shell history. The generated file is created using the process's default umask, with no explicit requirement that only its owner can read it. Plaintext configuration files are also prone to exposure through source-control commits, broad backup access, support bundles, shared directories, container image layers, and permissive filesystem settings. Th ...[truncated 1127 chars]
Remediation
## Remediation Suggestions 1. Remove `--app-secret` from the command-line interface. 2. Read the secret from a protected environment variable, operating-system credential store, or managed secret service. 3. Keep only non-sensitive settings in `config.json`; resolve secrets at runtime. 4. If local secret storage is unavoidable, create the file atomically with owner-only permissions such as mode `0600`. 5. Add `config.json` and other generated secret files to version-control ignore rules. 6. Prevent secrets from appearing in logs, error messages, support archives, and deployment output. 7. Document credential rotation and immediately rotate any secret that may have entered shell history or source control. 8. Grant the Feishu application only the minimum permissions necessary for its intended operation.

T08 · Insecure Dependencies

Warning
Location
deploy.py:13
Finding
Deployment Script Automatically Installs Unpinned Third-Party Packages## Vulnerability Details **File Location**: `deploy.py:13-25` **Vulnerability Type**: Unpinned runtime dependency installation **Risk Level**: Medium ### Complete Code Snippet ```python def check_dependencies(): """检查依赖是否安装""" try: import lark print("✅ lark 已安装") except ImportError: print("❌ lark 未安装,正在安装...") os.system("pip install lark") try: import openclaw print("✅ openclaw 已安装") except ImportError: print("❌ openclaw 未安装,正在安装...") os.system("pip install openclaw") ``` The same unpinned installation instruction appears in `SKILL.md:25-28`: ```bash pip install openclaw lark ``` ### Technical Analysis The deployment process installs packages by mutable package name without exact versions, hashes, a lockfile, an explicit trusted index, or provenance verification. If either import is unavailable, the script invokes `pip` through `os.system` and runs the currently published package and its installation process with the deployment user's privileges. This design makes deployments non-reproducible and exposes them to registry compromise, malicious package-version publication, dependency takeover, and unexpected upstream changes. The script also does not check the return value from `os.system`, so installation failures may be ignored and deployment can continue in an inconsistent state. The command strings are fixed and do not include user-controlled values, so the reviewed code does not establish command injection through these calls. The risk arises from automatic execution of unverified third-party package content. ### Attack Path 1. A deployment environment does not already contain `lark` or `openclaw`. 2. `check_dependencies()` catches the corresponding `ImportError`. 3. The script executes an unpinned `pip install` command. 4. `pip` resolves the package and transitive dependencies to whatever versions ar ...[truncated 966 chars]
Remediation
## Remediation Suggestions 1. Remove automatic package installation from application code and fail with a clear dependency error instead. 2. Declare dependencies in a standard project manifest and lock them to reviewed, exact versions. 3. Use hash verification, such as a requirements file generated with hashes, to ensure artifact integrity. 4. Verify that each package name is the intended distribution and review its publisher, provenance, release history, and transitive dependencies. 5. Install dependencies in an isolated virtual environment or container as a non-privileged user. 6. Use an approved internal package mirror or explicitly configured trusted index. 7. Run dependency vulnerability and software-composition scans during continuous integration. 8. Check installation exit statuses and stop deployment immediately if dependency setup fails.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (15)

Tainted flow: 'headers' from os.getenv (line 25, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Content
"max_tokens": 1000
    }
    
    response = requests.post(
        f"{OPENCLAW_BASE_URL}/chat/completions",
        headers=headers,
        json=payload,
Confidence
90% confidence
Finding
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

os.system() or os exec-family call

High
Category
Dangerous Code Execution
Content
print("✅ lark 已安装")
    except ImportError:
        print("❌ lark 未安装,正在安装...")
        os.system("pip install lark")

    try:
        import openclaw
Confidence
92% confidence
Finding
The script executes a shell command to install a package automatically when an import fails. Even though the command string is constant and not directly attacker-controlled, invoking pip through the shell during setup expands the script's behavior from configuration into code execution and dependency retrieval from external sources, which can install untrusted or tampered packages.

os.system() or os exec-family call

High
Category
Dangerous Code Execution
Content
print("✅ openclaw 已安装")
    except ImportError:
        print("❌ openclaw 未安装,正在安装...")
        os.system("pip install openclaw")

def create_config(app_id, app_secret, model="deepseek-chat"):
    """创建配置文件"""
Confidence
92% confidence
Finding
This line similarly launches a shell command to install a dependency automatically. While there is no direct command injection here, automatic shell-based installation can unexpectedly execute package installation logic and pull remote code, which is risky in a deployment script that users may trust to only generate configuration.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The skill markets an enterprise chat bot that automatically monitors incoming Feishu messages and sends AI-generated replies, but it does not warn users or administrators about message monitoring, automated processing, or possible privacy implications. In an enterprise context, this omission can cause unintentional collection or processing of sensitive internal communications without informed notice or governance.

External Transmission

Medium
Category
Data Exfiltration
Content
"max_tokens": 1000
    }
    
    response = requests.post(
        f"{OPENCLAW_BASE_URL}/chat/completions",
        headers=headers,
        json=payload,
Confidence
80% confidence
Finding
This code transmits conversation content to an external service, which is a genuine security/privacy concern in an enterprise bot if data classification, vendor trust, and destination controls are not enforced. The surrounding context increases sensitivity because webhook text may include internal business information and the destination base URL is configuration-driven.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
User-supplied message text is forwarded to an external LLM service without any indication here of consent, minimization, or policy controls. In an enterprise assistant context, users may submit sensitive business, personal, or credential data, creating a real risk of unauthorized external disclosure.

Intent-Code Divergence

Medium
Confidence
91% confidence
Finding
The function is documented as '处理飞书消息' and the module purpose says it receives Feishu messages and generates replies, which implies replying through the Feishu integration. However, the implementation only calls the LLM and returns JSON to the webhook caller, while comments at L73-L74 explicitly note that Feishu API reply sending is not implemented.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
The string literal instructs the assistant to answer in Chinese (`用简洁专业的中文回答问题`), which imposes a specific language choice on all users. The file does not provide a user language selection mechanism or explain a justified region-specific constraint, so this is a natural-language policy violation.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The function is documented as only checking dependencies, but it also installs packages via shell commands. This mismatch is dangerous because it hides code-executing side effects from reviewers and operators, increasing the chance that the script is run in environments where package installation is not expected or allowed.

Context-Inappropriate Capability

Medium
Confidence
88% confidence
Finding
A script presented as a one-click deployment/configuration helper also executes package installation commands. That extra capability broadens the trust boundary and can lead users to run a script that performs network retrieval and local environment modification beyond the stated purpose.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The script installs dependencies immediately after an ImportError without advance confirmation. In context, silent environment modification and package retrieval increase risk because users may not realize the script will execute external installation commands as part of deployment.

External Transmission

Medium
Category
Data Exfiltration
Content
"openclaw": {
            "model": model,
            "api_key": "${OPENCLAW_API_KEY}",
            "base_url": "https://api.openclaw.ai/v1"
        },
        "skills": [
            "smart-reply",
Confidence
60% 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
88% confidence
Finding
The script creates or overwrites local files such as config.json and later skill JSON files as part of execution. While there is a success message after writing, there is no confirmation prompt or advance warning in the script description that user files will be created in the current directory.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The embedded prompt instructs the assistant to answer in Chinese, imposing a fixed language behavior. The file does not offer a user opt-in or choice of language, and no region-specific justification is documented for this constraint.

Natural-Language Policy Violations

Low
Confidence
79% confidence
Finding
The skill documentation is overwhelmingly written in Chinese and presents the bundle as a Chinese-community offering without stating that other languages are supported or optional. This may constitute a language/locale policy concern if users are not given a choice or opt-in for language preference.

Static analysis

No suspicious patterns detected.