T09 · Insecure Skill Coding Practices
- Location
index.js:288- Finding
Shell Command Injection Through Untrusted Backup Configuration
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is a real backup/sync tool, but it handles sensitive OpenClaw data and repository tokens in ways that can expose data or allow unsafe command execution.
Review this carefully before installing. Only use it with a private, access-controlled repository and a narrowly scoped token, and do not run sync until command construction, recursive secret filtering, token handling, confirmation prompts, and restore documentation are fixed.
index.js:288Shell Command Injection Through Untrusted Backup Configuration
index.js:196Recursive Skill Backup Bypasses Secret and Gitignore Exclusions
index.js:288Repository Access Token Exposed in Git Process Arguments
index.js:217Sensitive Agent State Can Be Uploaded Without Repository Privacy Enforcement
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
## 安全特性
- 不上传 .env 和 openclaw.json
- URL 验证
- Token 不出现在错误信息中
- 本地备份后再恢复
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
## 安全特性
- 不上传 .env 和 openclaw.json
- URL 验证
- Token 不出现在错误信息中
- 本地备份后再恢复
The skill is presented as a 'safe' configuration sync tool, but the documented behavior includes sending highly sensitive workspace data, identity/configuration files, and custom skills to a remote Git repository using an authentication token. That is a material capability beyond a benign local sync description, and the mismatch reduces informed user consent while increasing the risk of unintended data exfiltration.
The branch name used in the shell command comes from getInstanceId(), which reads INSTANCE_ID from ~/.openclaw/.backup.env or falls back to hostname, and that value is interpolated directly into an execSync shell string. An attacker who can influence INSTANCE_ID or hostname can inject shell metacharacters and execute arbitrary commands when sync runs, making this a real command-injection issue with potentially full user-level code execution.
const tag = generateTag();
const branch = getInstanceId();
safeExec(`git push ${repoUrl} HEAD:${branch} --force`);
safeExec(`git tag ${tag}`);
safeExec(`git push ${repoUrl} ${tag}`);
The README instructs users to place a GitHub token in a local config file but does not warn about least-privilege scopes, rotation, filesystem permissions, or the risk of accidental inclusion in backups or shell history. For a backup/sync skill that handles repositories, this omission can lead to credential exposure and unauthorized access if users follow the example insecurely.
The documented backup set includes extremely sensitive personal and agent state data such as memory, identity, user profile, and custom skills, yet the warning model is weak and does not prominently require a private repository or explain the privacy consequences of remote storage. Users may unknowingly publish or broadly expose irreplaceable sensitive data if the repository is misconfigured or later made public.
The top-of-file comment lists "灾难恢复" as a supported function, creating the impression that restoration from backups is implemented. In reality, the restore command stops with a TODO/error after making only a local backup of the current workspace, so the documentation overstates the skill's actual behavior.
The manifest describes a configuration synchronization tool with backups, .gitignore handling, and version control, but the implementation achieves this by invoking system git commands via execSync and performing remote force-push operations. Spawning subprocesses and executing shell commands is a distinct capability with broader security impact than ordinary file synchronization and is not explicitly disclosed in the stated purpose.
The tool transmits local workspace contents to a remote repository and force-pushes branch state without an explicit warning or confirmation, which can cause unintended exfiltration of sensitive files and overwrite remote history. In a skill context that copies memory, config, and skills content from ~/.openclaw/workspace, this is more dangerous because users may not realize personal or sensitive agent data is being published remotely.
The file's user-facing instructions and descriptions are presented only in Chinese, and there is no indication that this skill is intentionally region-specific or that alternative language support is available. This can constitute a natural-language policy issue when a specific language is effectively required without user opt-in or documented justification.
The natural-language content consistently uses Chinese for the description and operational instructions, and there is no indication that users can choose another language. Under the policy provided, forcing a specific language without opt-in is a language/locale policy violation unless clearly justified as region-specific.
The file's natural-language interface and instructions are entirely in Chinese, with no option for users to select another language or locale. The policy specifically calls for flagging language or locale constraints when they are forced without user opt-in.
Beyond straightforward file synchronization, the code reads ~/.openclaw/.backup.env, derives an instance identity from configuration or hostname, and uses that identity in remote git branch management. This host-identification and multi-instance branch orchestration is additional behavior not reflected in the manifest description of selective backup, .gitignore support, and version control.
Detected: suspicious.dangerous_exec