T09 · Insecure Skill Coding Practices
- Location
scripts/alist_cli.py:115- Finding
Shell Command Injection Through Documented eval-Based Login Workflow
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This AList file-management skill mostly matches its stated purpose, but its setup and login guidance create avoidable risks around credentials, shell execution, and privileged host changes.
Review this skill carefully before installing. Use only a trusted HTTPS AList server, avoid eval/source of login output, do not store ALIST_PASSWORD in shell startup files, prefer a virtual environment or direct script path, and require explicit confirmation before delete or move operations.
scripts/alist_cli.py:115Shell Command Injection Through Documented eval-Based Login Workflow
scripts/alist_cli.py:101Credentials and Bearer Tokens Can Be Transmitted Over Plaintext HTTP
references/ONBOARDING.md:33Unpinned Dependency Installation Into Privileged System Environments
references/ONBOARDING.md:57Onboarding Forcibly Replaces a Global Command Using Elevated Privileges
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
return False
def _do_login(self, username, password, silent=False):
data = requests.post(
f"{self.url}/api/auth/login",
json={"username": username, "password": password},
).json()
The declared description is about AList file management for AI agents, including operational file actions and authentication handling. The supplied code does not perform any AList interaction or file management operations like upload/download/list/mkdir/rm/mv/search/url. Instead, it implements a project metadata/version consistency check across SKILL.md, plugin.json files, and git tags. This is a materially different primary purpose and unrelated to the declared triggers.
Referenced artifact was not completely inspected
- `references/openapi.json` - AList API specification
The onboarding recommends appending ALIST_URL, ALIST_USERNAME, and ALIST_PASSWORD to ~/.bashrc, persisting credentials in plaintext on the host. This creates long-lived exposure of sensitive secrets to other local processes, future shells, backups, and accidental disclosure.
Appending plaintext AList credentials to ~/.bashrc matches a persistence-style pattern because it installs secrets into a long-lived shell startup file. While not obviously malicious malware here, in skill context it is still dangerous because it creates durable secret exposure and conditions agents to make sensitive host modifications.
名 | 用户提供 |
| ALIST_PASSWORD | 登录密码 | 用户提供 |
重要:如果环境变量未设置,必须询问用户提供这三个值。不要猜测或使用默认值。
设置方式(选一种):
# 临时(当前 session)
export ALIST_URL="https://..."
export ALIST_USERNAME="xxx"
export ALIST_PASSWORD="xxx"
# 持久化(写入 shell 配置)
echo 'export ALIST_URL="https://..."' >> ~/.bashrc
echo 'export ALIST_USERNAME="xxx"' >> ~/.bashrc
echo 'export ALIST_PASSWORD="xxx"' >> ~/.bashrc
source ~/.bashrc
Windows PowerShell 当前会话:
$env:ALIST_URL = "https://..."
$env:ALIST_USERNAME = "<username>"
$env:ALIST_PASSWORD = "<password>"
密码和 token 不得写入仓库。Agent 未获用户明确同意时,不把密码追加到 shell profile 或其他持久化配置。
alist-cli whoami
期望输出:
用户: <username>
ID: <id>
根目�
The OpenAPI surface includes extensive admin functionality well beyond the advertised file-management CLI scope, including user management, storage administration, settings, token reset, and task controls. In an agent skill context, this creates a dangerous capability mismatch: an AI or downstream integrator may invoke privileged endpoints that enable full server takeover or destructive administration when only basic file operations were expected.
User and role administration endpoints are unrelated to normal file management and allow creation, modification, deletion of users, role changes, and 2FA cancellation. If an agent or compromised workflow can reach these operations, an attacker could escalate privileges, create backdoor accounts, or disable protections on existing accounts.
Storage-backend administration endpoints allow creating, updating, enabling, disabling, and deleting storage mounts, which exceeds the expected behavior of a file-management CLI. Abuse of these endpoints could redirect data flows, mount attacker-controlled backends, expose additional secrets, or disrupt access to legitimate storage.
Settings and token-management endpoints include access to private settings and token reset functionality, which can directly expose secrets or mint new long-lived credentials. In an agent-integrated skill, that effectively enables full persistence and control over the AList instance, far beyond ordinary file operations.
The README states that login and token refresh are automatic but does not warn that the skill will handle credentials and authentication tokens for the user's storage account. This matters because agent users may not realize sensitive secrets are being processed and persisted, which increases the risk of over-trusting the skill or misconfiguring the environment.
The README advertises delete and move capabilities for remote files but does not warn that these operations affect live data in remote storage and may be irreversible. In an AI-agent workflow, users may treat examples as low-risk assistant actions, so omission of destructive-operation warnings raises the chance of accidental data loss.
The example trigger phrases are broad enough to activate the skill for generic requests like uploading, browsing, searching, or sharing files without clearly signaling that the action targets AList remote storage. In an agent setting, this can cause unintended invocation of a skill that performs authenticated remote file operations, increasing the risk of accidental data exposure or destructive actions in the wrong context.
Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.
alist-cli/
├── .claude-plugin/plugin.json
├── .codex-plugin/plugin.json
├── skills/alist-cli/SKILL.md
├── SKILL.md
├── scripts/
│ └── alist_cli.py
The skill declares no explicit tool scope or permissions even though it clearly relies on environment variables and network access for authentication and file operations. In an agent setting, missing scope boundaries can cause the runtime to grant broader-than-expected capabilities, increasing the chance of secret exposure or unintended remote actions.
The manifest trigger text lists broad phrases like "file management" and "upload/download," which overlap with common everyday requests and do not clearly distinguish when this AList-specific skill should or should not activate. The description also lacks negative examples or constraints that would narrow invocation to AList-related contexts.
The documented rm <path> command enables destructive deletion, but the skill text does not require confirmation, dry-run behavior, or a prominent warning before use. In an agent workflow, ambiguous user requests or path mistakes could lead to irreversible data loss on remote storage.
The document instructs the AI agent in Chinese and does not offer a language choice or state that Chinese is required for a justified region-specific reason. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.
The onboarding instructs agents to install dependencies system-wide, including using pip against the host interpreter and even sudo with --break-system-packages. That exceeds the skill’s file-management purpose and can alter or destabilize the host environment, especially when executed automatically by an agent.
This instruction explicitly uses sudo to install Python packages on the host, which elevates privileges for a non-essential setup action. In an automated agent workflow, encouraging root execution increases the risk of unintended system modification or abuse if the package source or command path is compromised.
# 尝试 2: pip
pip3 install requests 2>/dev/null && echo "OK"
# 尝试 3: sudo pip(PEP 668 限制时)
sudo pip3 install --break-system-packages requests 2>/dev/null && echo "OK"
# 尝试 4: venv(隔离环境,不会污染系统)
The sudo pip guidance is part of a broader privileged installation path and normalizes root execution for dependency setup. Even if intended for compatibility, it unnecessarily expands the blast radius of mistakes and conflicts with least-privilege operation for this skill.
pip3 install requests 2>/dev/null && echo "OK"
# 尝试 3: sudo pip(PEP 668 限制时)
sudo pip3 install --break-system-packages requests 2>/dev/null && echo "OK"
# 尝试 4: venv(隔离环境,不会污染系统)
SKILL_DIR="<skill_dir>"
The document directs creation of a symlink in /usr/local/bin via sudo, which modifies the host PATH and requires elevated privileges unrelated to core file operations. In an agent setting, this broadens the skill’s effective capabilities and creates persistence on the machine beyond the current task.
Using sudo ln -sf to place a binary in /usr/local/bin requires root and creates a persistent system-wide executable entry. For a file-management CLI used by agents, this is unnecessary host modification and increases persistence and trust surface on the machine.
chmod +x <skill_dir>/scripts/alist_cli.py
# 创建 symlink 到 PATH 目录
sudo ln -sf <skill_dir>/scripts/alist_cli.py /usr/local/bin/alist-cli
# 验证
alist-cli --help
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
alist-cli --help
如果无 sudo 权限,可用 alias 替代:
```bash
alias alist-cli="python3 <skill_dir>/scripts/alist_cli.py"
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
| 错误 | 原因 | 解决 |
|------|------|------|
| `No module named 'requests'` | 依赖未安装 | 回到 Step 2 |
| `Permission denied` | 无 sudo 权限 / 脚本无执行权 | Step 3 改用 alias 或 venv |
| `❌ 请设置 ALIST_URL` | 环境变量未设置 | Step 4 |
| `❌ 登录失败` | 用户名或密码错误 | 检查凭据,重新设置 |
| `❌ 未认证` | Token 过期 | 重新登录或设置 ALIST_USERNAME/PASSWORD 让脚本自动登录 |
The API metadata references external OCR and preview services, which indicates that file content or URLs may be sent to third-party infrastructure. In a file-management skill, this is materially risky because agents may handle sensitive documents, and external transmission can leak file contents, metadata, or access URLs outside the expected trust boundary.
"iframe_previews": "{\n\t\"doc,docx,xls,xlsx,ppt,pptx\": {\n\t\t\"Microsoft\":\"https://view.officeapps.live.com/op/view.aspx?src=$e_url\",\n\t\t\"Google\":\"https://docs.google.com/gview?url=$e_url&embedded=true\"\n\t},\n\t\"pdf\": {\n\t\t\"PDF.js\":\"https://alist-org.github.io/pdf.js/web/viewer.html?file=$e_url\"\n\t},\n\t\"epub\": {\n\t\t\"EPUB.js\":\"https://alist-org.github.io/static/epub.js/viewer.html?url=$e_url\"\n\t}\n}",
"logo": "https://cdn.jsdelivr.net/gh/alist-org/logo@main/logo.svg",
"main_color": "#1890ff",
"ocr_api": "https://api.nn.ci/ocr/file/json",
"package_download": "true",
"pagination_type": "all",
"robots_txt": "User-agent: *\nAllow: /",
Detected: suspicious.install_untrusted_source