T09 · Insecure Skill Coding Practices
- Location
scripts/backup_restore.py:128- Finding
Arbitrary File Write Through Imported Backup Filenames
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This cloud-backup skill has a coherent backup purpose, but it handles credentials and local data too broadly and includes unsafe restore and transport behavior.
Review this skill carefully before installing. Use only dedicated, least-privilege backup accounts, do not paste real passwords or API keys into chat, avoid FTP and unverified SFTP, and treat imported backup files as untrusted unless the restore code is fixed.
scripts/backup_restore.py:128Arbitrary File Write Through Imported Backup Filenames
scripts/backup_manager.py:146Unsafe Tar Archive Selection and Extraction
scripts/cloud_adapter.py:575SFTP Server Authentication Is Disabled for Unknown Host Keys
scripts/cloud_adapter.py:466FTP Credentials and Backup Data Can Be Transmitted in Plaintext
scripts/cloud_adapter.py:274WebDAV Credentials and Memory Data May Be Sent Over HTTP
scripts/auto_detect.py:278Automatic Discovery Reads Sensitive Infrastructure Configuration Beyond the Claimed Scope
scripts/sync_to_nas.py:11NAS Synchronization Uploads the Entire Top-Level Memory Directory
scripts/migrate.py:43IMA API Credentials Are Written Without Explicit Restrictive Permissions
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
req = urllib.request.Request(url, data=data, headers=headers, method="POST")
try:
with urllib.request.urlopen(req, timeout=30) as response:
result = json.loads(response.read().decode("utf-8"))
# 兼容两种返回格式:code 或 retcode
if "code" in result and "retcode" not in result:
The finding points to undeclared local filesystem discovery and plugin checks unrelated to the stated backup purpose. Such host reconnaissance broadens access to local state and can expose installation details or sensitive paths that users would not expect from a simple backup guide.
The finding points to undeclared local filesystem discovery and plugin checks unrelated to the stated backup purpose. Such host reconnaissance broadens access to local state and can expose installation details or sensitive paths that users would not expect from a simple backup guide.
The finding points to undeclared local filesystem discovery and plugin checks unrelated to the stated backup purpose. Such host reconnaissance broadens access to local state and can expose installation details or sensitive paths that users would not expect from a simple backup guide.
The finding points to undeclared local filesystem discovery and plugin checks unrelated to the stated backup purpose. Such host reconnaissance broadens access to local state and can expose installation details or sensitive paths that users would not expect from a simple backup guide.
The finding points to undeclared local filesystem discovery and plugin checks unrelated to the stated backup purpose. Such host reconnaissance broadens access to local state and can expose installation details or sensitive paths that users would not expect from a simple backup guide.
The finding points to undeclared local filesystem discovery and plugin checks unrelated to the stated backup purpose. Such host reconnaissance broadens access to local state and can expose installation details or sensitive paths that users would not expect from a simple backup guide.
The finding points to undeclared local filesystem discovery and plugin checks unrelated to the stated backup purpose. Such host reconnaissance broadens access to local state and can expose installation details or sensitive paths that users would not expect from a simple backup guide.
The finding points to undeclared local filesystem discovery and plugin checks unrelated to the stated backup purpose. Such host reconnaissance broadens access to local state and can expose installation details or sensitive paths that users would not expect from a simple backup guide.
The finding points to undeclared local filesystem discovery and plugin checks unrelated to the stated backup purpose. Such host reconnaissance broadens access to local state and can expose installation details or sensitive paths that users would not expect from a simple backup guide.
The finding points to undeclared local filesystem discovery and plugin checks unrelated to the stated backup purpose. Such host reconnaissance broadens access to local state and can expose installation details or sensitive paths that users would not expect from a simple backup guide.
The finding points to undeclared local filesystem discovery and plugin checks unrelated to the stated backup purpose. Such host reconnaissance broadens access to local state and can expose installation details or sensitive paths that users would not expect from a simple backup guide.
The finding points to undeclared local filesystem discovery and plugin checks unrelated to the stated backup purpose. Such host reconnaissance broadens access to local state and can expose installation details or sensitive paths that users would not expect from a simple backup guide.
The finding points to undeclared local filesystem discovery and plugin checks unrelated to the stated backup purpose. Such host reconnaissance broadens access to local state and can expose installation details or sensitive paths that users would not expect from a simple backup guide.
The skill's documented auto-detection includes reading environment variables and secrets.env, which are high-value credential sources. Accessing these stores during broad detection flows expands exposure of unrelated secrets beyond what is necessary for simple provider recommendation.
|------|------|----------|
| ☁️ 本地云客户端 | iCloud Drive、Dropbox、OneDrive | 自动检测已安装的客户端 |
| 🌐 WebDAV | 坚果云、Nextcloud、ownCloud | 客户端/配置 |
| 🪣 云存储 API | 阿里云 OSS、腾讯云 COS、IMA | 环境变量/secrets.env |
| 🖥️ 服务器存储 | Samba/NAS、SFTP | 已挂载/配置文件 |
| 📡 SFTP | 远程服务器 | SSH 配置 |
The skill explicitly asks the user to share an email and application password in conversation so the assistant can configure WebDAV access. Collecting credentials through chat is dangerous because conversation channels may be logged, retained, or exposed to other tools, and users are not warned about safer alternatives.
The documentation instructs users to disclose account passwords and cloud access keys directly to the assistant for configuration. This is a textbook insecure secret-handling pattern that can lead to credential leakage via chat logs, prompt history, model tooling, or downstream storage.
Requesting cloud AccessKey ID/Secret directly from the user without warning about sensitivity or least privilege creates a clear secret-exposure path. These credentials can grant broad remote storage access and may enable data theft, deletion, or account abuse if disclosed improperly.
The guide similarly asks users to share NAS and SFTP login details with the assistant. Because these accounts may expose internal network storage or remote hosts, prompting conversational disclosure significantly raises the risk of unauthorized access and lateral movement if the secrets are mishandled.
The documentation directs storage of Samba credentials in a plaintext secrets.env file, signaling handling of sensitive credentials without mention of file-permission hardening or secret-manager protection. Plaintext secret files are common attack targets and become more risky when the skill also performs automatic detection and configuration.
凭证配置:在 ~/.openclaw/credentials/secrets.env 中添加:
SAMBA_HOST=192.168.10.216
SAMBA_USER=你的用户名
Centralizing all provider credentials in a single secrets.env file creates a concentrated credential target, and the document provides no guidance on encryption, permission restrictions, or isolation by backend. Compromise of that file would expose multiple external storage services at once.
所有凭证存储在 ~/.openclaw/credentials/secrets.env:
# 坚果云 WebDAV
Accessing ~/.ssh/config is credential-adjacent behavior because the file can contain host aliases, usernames, jump hosts, identity file paths, and other sensitive connection metadata. In the context of a backup setup skill, reading this file for automatic discovery is unnecessary and expands access into sensitive user infrastructure configuration.
services = []
# 检测 SSH 配置
ssh_config = Path.home() / ".ssh" / "config"
if ssh_config.exists():
try:
content = ssh_config.read_text()
Reading ~/.ssh/known_hosts performs discovery of a user's historical server connections and can reveal private hostnames and internal network assets. This is sensitive operational metadata and constitutes credential/infrastructure access beyond what is necessary for normal onboarding.
pass
# 检测 known_hosts 中的服务器
known_hosts = Path.home() / ".ssh" / "known_hosts"
if known_hosts.exists():
try:
content = known_hosts.read_text()
Referencing a secrets.env path under a credentials directory indicates deliberate probing for stored secrets. Even checking for existence in this context is risky because it normalizes secret-file discovery and may lead to future expansion into secret extraction, while already exceeding expected scope for auto-detection.
)
services.append(service)
# 检测 secrets.env
secrets_file = Path.home() / ".openclaw" / "credentials" / "secrets.env"
if secrets_file.exists():
try:
The code reads the contents of secrets.env, which is direct access to locally stored credentials or credential-bearing material. This is highly sensitive behavior and unnecessary for merely determining whether a service may be available, making the onboarding flow materially more dangerous.
services.append(service)
# 检测 secrets.env
secrets_file = Path.home() / ".openclaw" / "credentials" / "secrets.env"
if secrets_file.exists():
try:
content = secrets_file.read_text()