Back to skill

Security audit

高可靠性文本审核器

Security checks for vulnerabilities and agentic risk

Overview

The skill is a mostly understandable compliance auditor, but it includes under-disclosed remote uploads, an undocumented image/file upload command, and reliability claims that users should review before installing.

Install only if you are comfortable sending audited content to Baidu and then to an LLM, storing Baidu credentials in the OpenClaw config, and reviewing the generated report as best-effort advice rather than a safety guarantee. Avoid using the undocumented image command with sensitive files, and prefer a version that removes or scopes image upload, adds explicit remote-processing consent, fixes credential handling, and ships the documented run.ps1 workflow.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • 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
  • 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 (3)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/baidu_api.py:48
Finding

Baidu API credentials are transmitted in URL query parameters

Content
View full analysis

Vulnerability Details

File Location: scripts/baidu_api.py, lines 48–54
Vulnerability Type: Sensitive credential exposure through request URLs
Risk Level: Medium

Vulnerable Code

python
params = {
    "grant_type": "client_credentials",
    "client_id": self.api_key,
    "client_secret": self.secret_key
}
try:
    response = requests.post(TOKEN_URL, params=params, timeout=10)

Technical Analysis

The requests.post call supplies the API key and secret through the params argument. This causes both credentials to appear in the request URL query string rather than exclusively in the request body or an authorization header.

Although the destination is the declared official Baidu HTTPS endpoint, request URLs can be retained by HTTP debugging systems, reverse proxies, endpoint monitoring software, server access logs, exception-reporting services, and network observability platforms. TLS protects the request in transit but does not prevent URL logging at either endpoint.

The application also converts request exceptions to strings and ultimately prints them. Depending on the exception generated by the HTTP library, this could further expose a request URL containing the credentials.

Attack Path

  1. A user configures baidu_api_key and baidu_secret_key in ~/.openclaw/config.json.
  2. The BaiduApi constructor calls _get_access_token().
  3. The API key and secret are added to the OAuth request URL as query parameters.
  4. A proxy, monitoring agent, HTTP debugger, server log, or exception collector records the full URL.
  5. An attacker with access to those records extracts the credentials.
  6. The attacker uses the credentials to request access tokens and consume services under the victim's Baidu account.

Impact Assessment

Successful exploitation can disclose the Baidu API key and secret key. An attacker may then impersonate the configured client, consume paid API capacity ...[truncated 187 chars]

Remediation
View remediation

Remediation Suggestions

  • Use an OAuth request body or authorization header supported by the Baidu API instead of URL query parameters.
  • If the service mandates query parameters, explicitly disable request URL logging and redact client_id, client_secret, and access_token from diagnostics.
  • Do not expose raw requests exception strings to standard output. Return a generic error and retain only sanitized diagnostic information.
  • Implement centralized secret-redaction logic for URLs, request metadata, and error messages.
  • Store credentials in a dedicated secret manager or protected environment variables rather than a general configuration file.
  • Ensure ~/.openclaw/config.json has restrictive filesystem permissions and document credential rotation procedures.
  • Rotate the existing API credentials if request URLs may already have been logged.

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/baidu_api.py:76
Finding

Undeclared arbitrary local-file upload through the image moderation command

Content
View full analysis

Vulnerability Details

File Location: scripts/baidu_api.py, lines 76–84
Vulnerability Type: Excessive local file access and external data transmission
Risk Level: High

Vulnerable Code

python
def image_censor(self, image_path: str) -> Dict:
    """图像审核(本地图片文件)"""
    url = f"{IMAGE_CENSOR_URL}?access_token={self.access_token}"
    headers = {'content-type': 'application/x-www-form-urlencoded'}
    try:
        with open(image_path, 'rb') as f:
            img_base64 = base64.b64encode(f.read()).decode('utf-8')
        data = {"image": img_base64}
        response = requests.post(url, data=data, headers=headers, timeout=20)

The unrestricted path is exposed through the command-line interface at lines 103–105:

python
image_parser = subparsers.add_parser('image', help='审核图像文件')
image_parser.add_argument('path', type=str, help='需要审核的本地图片路径')

It is invoked at lines 124–126:

python
elif args.command == 'image':
    result = api_client.image_censor(args.path)
    print(json.dumps(result, ensure_ascii=False, indent=2))

Technical Analysis

The Skill is documented as a text-auditing workflow, but the included API client exposes an additional image command that accepts an arbitrary filesystem path. The implementation reads the entire referenced file and uploads its Base64 representation to an external Baidu endpoint.

There is no validation of the actual file format, no extension or MIME-type restriction, no approved-directory boundary, no symbolic-link check, no maximum file size, and no explicit user confirmation before transmission. Consequently, the input does not have to be an image. Any file readable by the process can be supplied and transmitted.

Base64 encoding does not provide confidentiality; it is only a transport representation. This capability exceeds the minimum filesystem and network privileges necessary for the declared text-auditing function.

...[truncated 1180 chars]

Remediation
View remediation

Remediation Suggestions

  • Remove the image moderation command unless image auditing is an explicit and necessary part of the Skill.
  • If retained, document the external upload clearly and require explicit, informed user approval before each transmission.
  • Restrict file selection to a designated input directory and resolve paths with Path.resolve() before enforcing that boundary.
  • Reject symbolic links and filesystem objects that are not regular files.
  • Validate the file's decoded structure with a trusted image parser rather than relying only on its extension or declared MIME type.
  • Allowlist supported formats and impose strict file-size and image-dimension limits.
  • Avoid reading the entire file into memory when streaming is supported.
  • Run the Skill under a dedicated, minimally privileged account without access to unrelated secrets.
  • Add tests proving that non-image files, out-of-scope paths, traversal paths, and symbolic links are rejected.

T01 · Skill Instruction Hijacking

Warning
Location
scripts/create_final_prompt.py:61
Finding

Untrusted text and API output are embedded into high-priority LLM instructions without injection isolation

Content
View full analysis

Vulnerability Details

File Location: scripts/create_final_prompt.py, lines 61–75; related template instructions in auditor_prompt.txt, lines 8–17
Vulnerability Type: Indirect prompt injection
Risk Level: Medium

Vulnerable Code

scripts/create_final_prompt.py directly composes and substitutes untrusted values:

python
master_risk_list = (
    f"### 1. 云端 API 初审返回结果\n"
    f"```json\n{api_result}\n```\n\n"
    f"### 2. 本地规则扫描敏感词返回结果\n"
    f"```json\n{local_scan}\n```"
)

# 执行替换
final_prompt = prompt_template.replace('{MASTER_RISK_LIST}', master_risk_list)
final_prompt = final_prompt.replace('{TEXT_TO_CHECK}', text_to_check)
final_prompt = final_prompt.replace('{RULES_DATABASE}', rules_database)

auditor_prompt.txt assigns elevated priority to one of the injected sections:

text
### **# 强制审查清单 (最高优先级)**
在开始任何工作之前,你**必须**首先处理以下由API和本地知识库联合生成的风险清单。对于清单中的**每一项**,你都必须在原文中找到它,并应用你的专业判断进行处理。这是你的首要且不可绕过的任务。
`{MASTER_RISK_LIST}`

---

### **# 待检测内容**
`{TEXT_TO_CHECK}`

Technical Analysis

The prompt builder inserts user-controlled audited text, externally supplied API output, and local-scan content into an instruction-bearing prompt through direct string replacement. These values are not schema-validated, escaped, or placed in a separate trusted data channel.

Markdown backticks and code fences are presentation syntax, not a security boundary for an LLM. Crafted input can introduce additional delimiters, headings, or imperative instructions. The template increases the risk by describing the API-derived section as the highest-priority, non-bypassable task. A downstream model may consequently interpret injected content as instructions rather than inert evidence.

The API result is also accepted as an arbitrary string rather than parsed and reconstructed from an allowlisted response schema. Thus, instruction-like data from a manipulated input, caller, result file, or alt ...[truncated 1366 chars]

Remediation
View remediation

Remediation Suggestions

  • Keep trusted instructions and untrusted audit data in separate message or API fields whenever the downstream model interface permits it.
  • Add explicit trusted instructions stating that all content inside the audited text, API response, scan result, and rules sections is inert data and must never be followed as instructions.
  • Parse API and local-scan results as JSON, validate them against strict schemas, and reconstruct only allowlisted fields instead of inserting arbitrary strings.
  • Serialize untrusted content using a robust structured representation that includes lengths or typed fields rather than relying on Markdown delimiters.
  • Remove language that grants untrusted API-derived content “highest priority” or describes it as non-bypassable.
  • Enforce a machine-readable output schema and validate the generated report before accepting or displaying it.
  • Reject malformed API results and scan data rather than embedding error strings or arbitrary file contents.
  • Add adversarial tests covering delimiter termination, fake headings, role-like instructions, output-format overrides, and instructions embedded in API-returned text.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (17)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The English description promises Baidu API, AI analysis, and a three-layer review system, while the observed behavior lacks those controls and instead includes local file handling. Such overclaiming is dangerous because it encourages operators to provide sensitive files and trust non-existent safeguards or scanning coverage.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The English description promises Baidu API, AI analysis, and a three-layer review system, while the observed behavior lacks those controls and instead includes local file handling. Such overclaiming is dangerous because it encourages operators to provide sensitive files and trust non-existent safeguards or scanning coverage.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The English description promises Baidu API, AI analysis, and a three-layer review system, while the observed behavior lacks those controls and instead includes local file handling. Such overclaiming is dangerous because it encourages operators to provide sensitive files and trust non-existent safeguards or scanning coverage.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill declares capabilities that imply reading local files, writing output files, and sending content over the network, but it does not declare any tool scope or permissions boundary. That makes data access and exfiltration behavior less transparent to users and host agents, increasing the chance that sensitive input text or local files are processed or transmitted without informed approval.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manifest description is entirely in Chinese and the rest of the usage guidance is predominantly Chinese, but there is no indication that the skill is region-specific or that users may choose another language. This can violate language/locale policy when a skill effectively forces a language without opt-in.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill asks users to configure Baidu API credentials but does not clearly warn that submitted text will be sent to external services, including Baidu and an AI model. This creates a meaningful privacy and confidentiality risk because users may supply sensitive material without realizing it will leave the local environment.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This text hard-codes compliance review against WeChat Channels rules and presents all instructions in Chinese, implicitly forcing a specific language/locale context. The policy allows locale constraints only when clearly justified as region-specific or when the user is given a choice; here the constraint is imposed without opt-in.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Claiming '零风险' and that content will '绝对不会' trigger penalties can induce unsafe overreliance on the skill's output. Users may publish risky or regulated content believing compliance is guaranteed, which is especially dangerous in a policy-enforcement context where rules are ambiguous and frequently change.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The manifest describes the skill as combining local rules, Baidu API, and AI deep analysis in a three-layer compliance review. In this prompt file, the only explicit external input is a generic API/local knowledge-base risk list, and there is no mention of Baidu-specific review or a distinct three-layer process. That creates a semantic mismatch between the advertised implementation and the documented behavior here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This JSON file defines all policy categories and matching terms exclusively in Chinese, with no accompanying natural-language indication that the skill is intentionally limited to Chinese-language content or that users may choose another locale. Under the language/locale policy, forcing a specific language without user opt-in can be a policy violation unless the locale restriction is clearly documented and justified.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The manifest describes a "高可靠性文本审核器" focused on text review, but this module explicitly wraps both text and image censorship APIs. Supporting image moderation is a materially broader capability than the stated text-only purpose, so the implemented behavior exceeds the manifest description rather than serving as an obvious implementation detail.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This function sends user-provided text to Baidu's remote moderation API without any explicit user-facing disclosure or consent mechanism. In a tool presented as a local/high-reliability auditor, users may reasonably assume content stays local, so sensitive prompts, documents, or regulated data could be unintentionally exfiltrated to a third party.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code reads a local image file, base64-encodes it, and uploads it to an external API without an explicit warning that local files are being transmitted off-device. Images often contain highly sensitive information, including faces, IDs, screenshots, or embedded metadata, so silent upload materially increases privacy and compliance risk.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The command-line interface provides an image subcommand for auditing local image files, which operationalizes image moderation as a first-class feature. That directly broadens the skill beyond the manifest's stated role as a text auditor using layered compliance review.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The skill writes final_prompt.txt into the skill directory, but this side effect is not clearly disclosed as a persistent file write. While lower impact than network disclosure, undocumented output files can expose sensitive audit content to other local users, processes, backups, or later unintended reuse.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

Labeling the final output as '绝对安全' overstates the reliability of the audit and may mislead users into treating the result as authoritative. While less severe than the earlier blanket guarantee, it still encourages false confidence and weakens appropriate human oversight.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file contains user-facing docstrings, argument descriptions, and runtime messages entirely in Chinese, which imposes a specific language on users. The policy allows locale constraints only when users are given a choice or the restriction is clearly documented and justified, neither of which appears here.

Content

No source excerpt is available for this finding.