Back to skill

Security audit

Baidu Pan OAuth2 Auth

Security checks for vulnerabilities and agentic risk

Overview

The skill is coherent for Baidu Pan OAuth token management, but it recommends an indefinite scheduled refresh job and handles OAuth secrets in ways that merit Review.

Install only if you are comfortable keeping Baidu OAuth app secrets and refresh tokens in a local plaintext .env file. Prefer manual refresh unless you explicitly need scheduling; if you add the cron job, use a dedicated credential file with restrictive permissions, know how to remove the cron entry, and avoid exposing command history or logs containing codes or token URLs.

Vulnerability Patterns
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • 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 (3)

T06 · System Persistence

Error
Location
SKILL.md:43
Finding

Recurring Token-Refresh Task Creates Cross-Session Persistence

Content
View full analysis
/scripts/auth.py refresh ,报告结果" → sessionTarget: isolated ``` ```bash openclaw cron add --name "百度网盘token刷新" --every 25d --session isolated \ --message "执行百度网盘token刷新:运行 python3 /scripts/auth.py refresh ,报告结果" ``` ### Technical Analysis The Skill recommends registering an indefinitely recurring OpenClaw cron task. The task survives the initiating session and periodically executes `scripts/auth.py` with access to a user-selected `.env` file containing an application secret, access token, and long-lived refresh token. Scheduled refresh is related to the declared OAuth functionality, and the user must explicitly run the documented command. However, persistent execution is not required for the minimum on-demand token exchange or refresh functionality. It increases the security boundary from a one-time command to recurring, cross-session execution of code with credential access. The cron payload references a script path rather than an immutable, integrity-verified artifact. If the script, its containing directory, the cron configuration, or the referenced environment file is later modified by another actor, the scheduled task can repeatedly execute altered behavior. ### Attack Path 1. The user follows the recommendation and registers the 25-day cron task. 2. The task persists after the original Skill interaction ends. 3. Each scheduled invocation executes `scripts/auth.py refresh` and reads credentials from the configured `.env` file. 4. An attacker who subsequently obtains write access to the referenced script path, parent directory, or cron payload modifies the execut ...[truncated 932 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/auth.py:46
Finding

OAuth Credentials Are Transmitted in URL Query Parameters

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
scripts/auth.py:100
Finding

Authorization Code Is Accepted Through a Process Command-Line Argument

Content
View full analysis
两个参数", file=sys.stderr) sys.exit(1) exchange_code(sys.argv[2], sys.argv[3]) ``` The documented invocation is: ```bash python3 scripts/auth.py code ``` ### Technical Analysis The OAuth authorization code is supplied as `sys.argv[2]`. Command-line arguments can be recorded in shell history and may be visible during execution through local process inspection, auditing systems, terminal capture, diagnostic collection, or job metadata. The code is documented as valid for ten minutes and usable once, which limits the exploitation window. However, an observer who obtains it before the legitimate exchange completes may attempt to redeem it first. The environment-file path is also exposed through the command line. Although the path is not itself a credential, it may reveal where sensitive token material is stored. ### Attack Path 1. The user runs the documented command with the authorization code as an argument. 2. The shell records the command in history, or a local process-monitoring facility captures the argument list. 3. A local user, administrator, monitoring operator, or compromised process reads the captured command. 4. The observer extracts the authorization code before it expires or is used. 5. The observer attempts to redeem the code using the matching application credentials and redirect URI. 6. If redemption succeeds first, the legitimate command fails and the observer obtains the resulting OAuth tokens. Exploitation requires local visibility into command history or process metadata and, in most OAuth configurations, access to the corresponding client credentials. ### Impact Asse ...[truncated 439 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (5)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/example.env (reported line 2)May include surrounding context.

text
# 百度网盘开放平台应用凭据
# 复制此文件为 .env 并填入实际值
# 获取方式:https://pan.baidu.com/union/console/applist

AppID=your_app_id

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill instructs users to run networked commands and to update local credential material, but it does not declare any explicit tool scope or allowed-tools boundary. That omission weakens reviewability and can lead to overbroad execution in agent environments, especially because the skill handles OAuth secrets and writes tokens to a local .env file.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation states that refresh operations automatically overwrite AccessToken, RefreshToken, and related fields in a local .env file, but it does not prominently warn that sensitive credentials are being modified in place. This creates risk of accidental secret exposure, corruption of local auth state, unsafe file permissions, or unintended automation touching production credentials.

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 · assets/example.env (reported line 3)May include surrounding context.

text
# 百度网盘开放平台应用凭据
# 复制此文件为 .env 并填入实际值
# 获取方式:https://pan.baidu.com/union/console/applist

AppID=your_app_id
AppKey=your_app_key

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains user-facing natural-language text entirely in Chinese, including the top-level description and usage instructions. Under the policy rule, forcing a specific language without user opt-in is a locale/language policy concern unless the regional constraint is explicitly justified.

Content

No source excerpt is available for this finding.