Back to skill

Security audit

alfred-github-backup

Security checks for vulnerabilities and agentic risk

Overview

This backup skill is purpose-aligned, but it handles GitHub credentials and sensitive workspace backups in ways users should review carefully before installing.

Install only if you are comfortable backing up OpenClaw workspace files, including memory and configuration, to a GitHub repository. Do not paste a GitHub token into chat or use a broad classic repo token; prefer GitHub CLI, SSH, a credential helper, or a fine-grained repository-specific token stored outside the conversation. Review the exact files before pushing, add secret scanning or exclusions, and avoid the documented restore command unless you first restore into a temporary directory and compare changes.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/backup.sh:4
Finding
GitHub Token Exposure Through Command-Line Arguments and Persistent Remote Configuration## Vulnerability Details **File Location**: `scripts/backup.sh:4-7, 26-32`; related unsafe usage is documented in `SKILL.md:42-50, 106-115, 135-138` **Vulnerability Type**: Plaintext credential exposure **Risk Level**: High ### Vulnerable Code ```bash # Usage: ./backup.sh [github-username] [repo-name] [token] GITHUB_USER="${1}" REPO_NAME="${2}" TOKEN="${3}" BACKUP_MESSAGE="${4:-Backup: $(date +%Y-%m-%d)}" ``` ```bash CURRENT_REMOTE=$(git remote get-url origin 2>/dev/null || echo "") EXPECTED_REMOTE="https://x-access-token:${TOKEN}@github.com/${GITHUB_USER}/${REPO_NAME}.git" if [ "$CURRENT_REMOTE" != "$EXPECTED_REMOTE" ]; then git remote set-url origin "$EXPECTED_REMOTE" 2>/dev/null || \ git remote add origin "$EXPECTED_REMOTE" fi ``` The related documentation instructs the user to provide the token through the interactive conversation and recommends displaying configured remotes: ```text Then copy and send me the Token ``` ```bash git remote -v ``` ### Technical Analysis The backup script accepts a GitHub token as its third command-line argument and embeds it directly in an HTTPS Git remote URL. Git persists that URL in the repository's `.git/config` file. This creates several independent credential exposure channels: 1. The token can be retained in the agent conversation or transcript when the user submits it. 2. Command-line arguments may be visible to other local processes or users through process inspection while the script is running. 3. An interactive invocation may leave the complete command, including the token, in shell history. 4. The token remains in plaintext in `.git/config` after execution. 5. Diagnostic commands such as `git remote -v`, explicitly recommended by the documentation, can print the credential. 6. Logs, terminal captures, support records, or configuration backups may preserve the credential. The documentation states that API keys are excluded from backup content, but that claim does not mitigate the plaintext toke ...[truncated 1582 chars]
Remediation
## Remediation Suggestions 1. Do not request or transmit access tokens through agent conversations. 2. Remove the token command-line parameter. Command-line arguments must not carry secrets. 3. Configure a token-free remote, such as: ```bash git remote set-url origin https://github.com/USER/REPOSITORY.git ``` 4. Authenticate through Git Credential Manager, GitHub CLI authentication, a protected credential helper, or SSH with a securely stored key. 5. If noninteractive HTTPS authentication is required, retrieve the secret at runtime from an approved secret manager and provide it through a short-lived credential helper without writing it into the remote URL. 6. Prefer a fine-grained, repository-specific GitHub token with only the minimum contents permissions necessary for backup pushes. Avoid classic tokens with broad `repo` scope. 7. Prevent diagnostic output from disclosing credentials. Do not display authenticated remote URLs, and redact user information from URLs before logging. 8. Check and remove existing credentials from `.git/config`, shell history, transcripts, logs, cron configuration, and related artifacts. 9. Immediately revoke and rotate any token previously used by this script because it may already have been retained in plaintext. 10. Restrict access permissions on the workspace and Git metadata as defense in depth, while recognizing that file permissions do not replace secure credential handling.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (13)

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding
描述把该技能表述为一个完整的 GitHub 备份系统,包含自动/手动两种模式、配置向导、仓库创建、初始化备份、定时任务、恢复和配置修改等功能。但提供的代码只是一个单独的 shell 备份脚本,功能局限于:配置 git remote、暂存固定文件列表、提交并推送到 GitHub。它没有任何定时任务、交互式向导、仓库创建、恢复或配置修改逻辑。此外,描述称备份 OpenClaw 工作空间,而代码实际上只备份显式列出的文件和目录,不是整个工作空间。因此描述显著高于代码实际能力,属于不匹配。

Missing User Warnings

High
Confidence
99% confidence
Finding
The skill explicitly tells the user to paste a GitHub token into chat and provides no warning that this shares a secret with the agent and any system that stores conversation history. Because the token is requested with repo scope, compromise could allow repository read/write access and possible access to private code or backups.

Ssd 3

High
Confidence
99% confidence
Finding
Instructing the user to paste a GitHub token into plain chat is a direct secret-disclosure pattern. The token may be captured in chat logs, telemetry, transcripts, or displayed back to the user, creating a durable credential exposure with repository access.

Intent-Code Divergence

High
Confidence
98% confidence
Finding
The skill claims sensitive information and API keys are not backed up, yet it explicitly stages files like USER.md, TOOLS.md, AGENTS.md, and memory/ that commonly contain credentials, tokens, prompts, or private operational data. This can cause users to exfiltrate secrets into a GitHub repository under a false sense of safety.

Missing User Warnings

High
Confidence
98% confidence
Finding
The restore instructions copy repository contents into the workspace without warning that files may be overwritten or replaced. This can lead to destructive data loss, corrupted local state, or reintroduction of unsafe files, especially because cp -r into an existing workspace is not a reversible operation.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
The description, prompts, trigger phrases, and interaction flow are written in Chinese and instruct users to respond with specific Chinese phrases such as "确认", without documenting language choice or opt-in. This can violate a language/locale policy when a skill implicitly forces one language for use.

Context-Inappropriate Capability

Medium
Confidence
96% confidence
Finding
Requesting that the user paste a GitHub token directly into the agent causes the skill to collect credentials in chat, which is broader access than necessary for a documentation-driven backup workflow. Even if intended for setup, this expands exposure of a repo-scoped token to the agent, logs, and any downstream storage.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The backup workflow performs git push operations that transmit workspace contents to GitHub, but it does not clearly warn the user that local data will leave the system and be stored remotely. In this skill's context, that omission is significant because the selected files may include sensitive personal or operational information.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The keyword list includes generic phrases such as "自动备份", "手动备份", "立即备份", and "查看备份", which are broad enough to match everyday backup-related conversation outside this specific GitHub skill. The file does not provide exclusion conditions or negative examples to narrow when the skill should activate.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The script embeds the GitHub token directly into the origin URL, which can expose credentials through git configuration, process arguments, logs, shell history, or error output. In a backup skill that operates on a long-lived workspace, this increases the chance that the token is accidentally persisted locally or included in future backups, enabling repository compromise.

Missing User Warnings

Medium
Confidence
85% confidence
Finding
The script stages and pushes substantial workspace content to GitHub automatically, but provides no explicit consent step, file preview, or warning about transmitting local data to a remote service. Because the targeted paths include agent files, skills, and memory content, the backup context makes accidental exfiltration of sensitive prompts, secrets, or personal/project data materially more dangerous.

Vague Triggers

Low
Confidence
90% confidence
Finding
The restore activation text is too loose for a destructive operation, since a casual request could trigger file restoration steps that alter the workspace. In context, restore is especially sensitive because subsequent instructions copy repository contents into the workspace without strong gating.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
The script's usage and status messages are written in Chinese, which imposes a specific language on users without opt-in or alternative locale support. This can violate language/locale policy when the skill is intended for a broader audience.

Static analysis

No suspicious patterns detected.