Back to skill

Security audit

baidu-netdisk-skills

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its Baidu Netdisk purpose, but its installer, updater, uninstall script, and memory restore path give enough local-file and agent-memory authority to require Review before use.

Install only if you trust this publisher and are comfortable with a Baidu CDN native installer. Avoid --yes for install, update, uninstall, and memory restore; verify BDPAN_CONFIG_DIR and BDPAN_INSTALL_DIR are not set to unsafe paths; back up both Baidu Netdisk data and Agent workspace memory before restore; review any update source and checksum before approving.

Vulnerability Patterns
  • 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
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

T03 · Remote Payload Retrieval and Execution

Error
Location
scripts/install.sh:204
Finding

Downloaded Installer Executes When Integrity Verification Is Unavailable

Content
View full analysis
/dev/null; then actual_checksum=$(sha256sum "${installer_name}" | awk '{print $1}') elif command -v shasum &> /dev/null; then actual_checksum=$(shasum -a 256 "${installer_name}" | awk '{print $1}') else log_warn "未找到 sha256sum/shasum 工具,跳过完整性校验" fi if [ -n "$actual_checksum" ]; then if [ "$actual_checksum" != "$expected_checksum" ]; then log_error "SHA256 校验失败!文件可能被篡改" log_error " 期望: ${expected_checksum}" log_error " 实际: ${actual_checksum}" rm -f "${installer_name}" exit 1 fi log_info "SHA256 校验通过" fi else log_warn "当前平台 ${platform_key} 无预置校验值,跳过完整性校验" fi echo "" echo -e "${YELLOW}即将执行已下载的安装器:${NC}" echo " 路径: ./${installer_name}" echo " 来源: ${installer_url}" echo " SHA256: 已校验通过" echo "" echo "该安装器将向系统写入 bdpan CLI 二进制(通常位于 ~/.local/bin)。" if [ "$force" = "yes" ]; then log_warn "检测到 --yes/--force,跳过最终确认(非交互模式)。" else read -p "是否现在执行安装器?[y/N] " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then log_info "已取消执行。安装器文件保留在当前目录:./${installer_name}" log_info "您可以先审查内容,或稍后手动执行:./${installer_name}" exit 0 fi fi # 执行安装器(非交互模式) ./${installer_name} --yes ``` ### Technical Analysis The installer is downloaded from an external CDN and executed locally. Although platform-specific SHA-256 values are embedded in the script, integrity verification fails open: 1. If neither `sha256sum` nor `shasum` is available, `actual_checksum` remains empty. 2. The sc ...[truncated 1837 chars]
Remediation
View remediation
/dev/null 2>&1; then actual_checksum=$(sha256sum "$installer_path" | awk '{print $1}') elif command -v shasum >/dev/null 2>&1; then actual_checksum=$(shasum -a 256 "$installer_path" | awk '{print $1}') else log_error "No SHA-256 implementation is available; refusing installation" exit 1 fi if [ "$actual_checksum" != "$expected_checksum" ]; then log_error "Installer checksum mismatch" exit 1 fi verified=true ``` 3. Print “SHA-256 verified” only when `verified=true`. 4. Download into a private temporary directory created by `mktemp -d`, use an absolute path, and set restrictive permissions on the directory. 5. Restrict redirects to HTTPS and, preferably, to the approved CDN host. 6. Consider verifying a cryptographically signed release manifest whose signing key is distributed independently from the CDN. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/uninstall.sh:56
Finding

Environment-Controlled Uninstall Paths Permit Arbitrary Recursive Deletion

Content
View full analysis
Remediation
View remediation

T02 · Agent Memory Poisoning

Error
Location
scripts/memory-backup.sh:260
Finding

Untrusted Backup Manifests Can Write Undeclared Files into the Agent Workspace

Content
View full analysis
&2 return 1 fi _validate_file_path "$fp" || return 1 MANIFEST_FILES+=("$fp") done ``` ```bash _validate_file_path() { local fp="$1" if [[ "$fp" == /* ]]; then echo "Invalid manifest: absolute file path not allowed: \"$fp\"" >&2 return 1 fi if [[ "$fp" == ../* ]] || [[ "$fp" == */../* ]] || [[ "$fp" == */.. ]] || [[ "$fp" == ".." ]]; then echo "Invalid manifest: path traversal not allowed: \"$fp\"" >&2 return 1 fi } ``` ```bash for file in "${MANIFEST_FILES[@]}"; do local src="$tmp_dir/$file" [ -f "$src" ] || continue local dest_path allowed_base if [[ "$ws_set" == *"|${file}|"* ]]; then dest_path="$WORKSPACE_DIR/$file" allowed_base="$WORKSPACE_DIR" elif [[ "$file" == memory/* ]]; then dest_path="$MEMORY_DIR/${file#memory/}" allowed_base="$MEMORY_DIR" else dest_path="$WORKSPACE_DIR/$file" allowed_base="$WORKSPACE_DIR" fi # 路径遍历防护:解析真实路径检查 local resolved_dest resolved_base mkdir -p "$(dirname "$dest_path")" resolved_dest=$(cd "$(dirname "$dest_path")" && pwd)/$(basename "$dest_path") resolved_base=$(cd "$allowed_base" && pwd) if [[ "$resolved_dest" != "$resolved_base"* ]]; then echo "Path traversal detected: \"$file\" resolves outside allowed directory" >&2 continue fi cp "$src" "$dest_path" done ``` ### Technical Analysis The declared backup scope is limited to seven workspace files and `memory/*.md`. Manifest validation, however, only rejects absolute paths and paths containing `..`. Any other relative ...[truncated 2344 chars]
Remediation
View remediation
.md`. - Reject nested paths, unknown extensions, empty components, control characters, and duplicate entries. 2. Implement validation such as: ```bash _validate_file_path() { local fp="$1" case "$fp" in AGENTS.md|SOUL.md|USER.md|IDENTITY.md|TOOLS.md|MEMORY.md|HEARTBEAT.md) return 0 ;; memory/*.md) local name="${fp#memory/}" if [[ "$name" == */* ]] || [ -z "$name" ]; then return 1 fi return 0 ;; *) echo "Invalid manifest entry: $fp" >&2 return 1 ;; esac } ``` 3. Include a SHA-256 digest and size for every file in the manifest and verify both before applying the restore. 4. Authenticate the manifest independently, for example with a keyed MAC or digital signature whose verification key is not stored alongside the backup. 5. Reject symbolic links and require staged inputs and destinations to be regular files. 6. Replace string-prefix containment checks with canonical path comparison that requires either exact equality with the allowed base or an allowed-base path followed by `/`. 7. Do not allow `--yes` to bypass confirmation in detected Agent environments, or require an additional explicit flag acknowledging that persistent Agent instructions may be overwritten. 8. Display unknown or security-sensitive paths separately and abort rather than treating them as ordinary restore entries. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
Findings (33)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill includes an update/install path that downloads and executes code from a remote CDN and even notes that install.sh does not perform local SHA256 verification, relying only on HTTPS. That creates a software supply-chain risk: if the CDN, transport trust, or upstream artifact is compromised, the agent may execute attacker-controlled code on the host.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The skill includes an update/install path that downloads and executes code from a remote CDN and even notes that install.sh does not perform local SHA256 verification, relying only on HTTPS. That creates a software supply-chain risk: if the CDN, transport trust, or upstream artifact is compromised, the agent may execute attacker-controlled code on the host.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill includes an update/install path that downloads and executes code from a remote CDN and even notes that install.sh does not perform local SHA256 verification, relying only on HTTPS. That creates a software supply-chain risk: if the CDN, transport trust, or upstream artifact is compromised, the agent may execute attacker-controlled code on the host.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill includes an update/install path that downloads and executes code from a remote CDN and even notes that install.sh does not perform local SHA256 verification, relying only on HTTPS. That creates a software supply-chain risk: if the CDN, transport trust, or upstream artifact is compromised, the agent may execute attacker-controlled code on the host.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill includes an update/install path that downloads and executes code from a remote CDN and even notes that install.sh does not perform local SHA256 verification, relying only on HTTPS. That creates a software supply-chain risk: if the CDN, transport trust, or upstream artifact is compromised, the agent may execute attacker-controlled code on the host.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

bash
# 3. 下载完成后清理日志
rm -f /tmp/bdpan-dl-<PID>.log

Agent 执行大文件后台下载时的行为规范:

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · reference/bdpan-commands.md (reported line 481)May include surrounding context.

md
|------|------|
| `--config-path <path>` | 指定配置文件完整路径(适用于 AI Agent 集成) |
| `--json` | JSON 格式输出 |
| `--no-check-update` | 禁用版本更新检查 |
| `--help` | 显示帮助 |
| `--version` | 显示版本 |

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · reference/bdpan-commands.md (reported line 644)May include surrounding context.

md
import subprocess
import os

env = os.environ.copy()
env["BDPAN_CONFIG_PATH"] = "/home/user/.config/bdpan/config.json"

result = subprocess.run(

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
87% confidence
Finding

The example includes a raw rm command against a local path, demonstrating destructive local filesystem behavior within a cloud-storage skill. Even though the shown path is templated for a temp backup file, such patterns can be generalized by an agent or copied into broader contexts, creating risk of unintended local deletion if variables or paths are mishandled.

Content

Scanner excerpt · reference/examples.md (reported line 380)May include surrounding context.

bdpan upload "/tmp/${BACKUP_FILE}" "backup/${BACKUP_FILE}"

清理

rm "/tmp/${BACKUP_FILE}"

echo "备份完成: ${BACKUP_FILE}"

text

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
89% confidence
Finding

The troubleshooting guide instructs deletion of a user configuration file to recover from login failure. Although targeted, destructive file operations in agent-facing skill content are risky because an automated agent may execute them without sufficient confirmation, causing credential loss, state reset, or accidental deletion if paths are expanded incorrectly in other contexts.

Content

Scanner excerpt · reference/troubleshooting.md (reported line 61)May include surrounding context.

解决方案:

bash
# 清除配置并重试
rm ~/.config/bdpan/config.json
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

The guide recommends deleting the installed binary as part of reinstall troubleshooting. While limited to a user-local path, it is still a destructive command that an agent could execute automatically, disrupting the tool or deleting the wrong target if environment assumptions are wrong or the path is manipulated.

Content

Scanner excerpt · reference/troubleshooting.md (reported line 258)May include surrounding context.

解决方案:

bash
# 删除现有二进制文件
rm ~/.local/bin/bdpan

# 重新安装
bash ${CLAUDE_SKILL_DIR}/scripts/install.sh

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The confirmation prompt tells users the update 'will not modify local files,' but the script explicitly unzips the downloaded archive into the local skill directory and updates the VERSION file. This misleading assurance can cause users to approve a code overwrite they might otherwise scrutinize, weakening informed consent around a feature that changes executable or operational local content.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest description and the entire markdown guidance force a specific language/locale for user-facing interaction, and there is no indication that users may choose another language. Under the stated policy, language constraints should be opt-in or explicitly justified as region-specific.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
87% confidence
Finding

The documented use of nohup and background execution creates persistence beyond the immediate agent action, allowing a download process to continue unattended after the original command context ends. In an agent setting, this weakens containment and observability, and could be abused to keep long-running network/file activity alive without fresh user review.

Content

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

大文件(> 50MB)后台下载流程:

bash
# 1. 启动后台下载(nohup + 进度日志)
nohup bdpan download <远端路径> <本地路径> > /tmp/bdpan-dl-$$.log 2>&1 & echo $!

Session Persistence

Medium
Category
Rogue Agent
Confidence
87% confidence
Finding

This is the same persistence pattern in the adjacent command block: a detached background download process can survive beyond the normal interactive session. That increases risk in a high-impact file-management skill because the agent may continue modifying local state or consuming network resources without continuous supervision.

Content

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

bash
# 1. 启动后台下载(nohup + 进度日志)
nohup bdpan download <远端路径> <本地路径> > /tmp/bdpan-dl-$$.log 2>&1 & echo $!
bash

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% 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 · reference/bdpan-commands.md (reported line 585)May include surrounding context.

}

text

### mv/cp/rename/mkdir 命令输出

```json
{

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% 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 · reference/bdpan-commands.md (reported line 585)May include surrounding context.

}

text

### mv/cp/rename/mkdir 命令输出

```json
{

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The transfer examples save shared content directly into the user's Baidu Drive without warning that this mutates cloud state or confirming the destination. That can cause unwanted persistence of untrusted or mistaken content in the user's account, especially when links or extraction codes are supplied conversationally.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The move, copy, rename, and folder-creation examples perform state-changing operations in the user's cloud storage without confirmation or safety prompts. In an agent context, these actions can reorganize, duplicate, or overwrite user data based on ambiguous instructions, making accidental destructive changes more likely.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The examples expand from Baidu Netdisk operations into arbitrary local shell scripting, tar-based archiving, and temp-file cleanup on the user's filesystem. In an agent setting, such examples can normalize or encourage broader local execution than the skill's stated purpose, increasing the chance the agent performs unintended local file manipulation or destructive commands outside the cloud-storage boundary.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown file contains user-facing natural-language instructions exclusively in Chinese, beginning with the title and continuing throughout the guide. Under the policy rule, forcing a specific language without user opt-in or documented justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · reference/troubleshooting.md (reported line 305)May include surrounding context.

安装所需依赖(特定于发行版):

bash
# Debian/Ubuntu
sudo apt-get install libc6

# Fedora/RHEL
sudo dnf install glibc

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · reference/troubleshooting.md (reported line 308)May include surrounding context.

安装所需依赖(特定于发行版):

bash
# Debian/Ubuntu
sudo apt-get install libc6

# Fedora/RHEL
sudo dnf install glibc

File System Enumeration

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code scans file system directories looking for sensitive files. This could be reconnaissance for credential theft.

Content

Scanner excerpt · reference/troubleshooting.md (reported line 349)May include surrounding context.

bash
# 检查配置文件是否存在及权限
ls -la ~/.config/bdpan/

# 检查登录状态和 Token 有效期
bdpan whoami

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script presents its description and all user-facing prompts in Chinese, beginning with the header comment on L002 and continuing throughout help, warnings, and confirmations. This imposes a specific language on users without opt-in or any indication that the skill is intentionally limited to a Chinese-speaking or region-specific context.

Content

No source excerpt is available for this finding.