T09 · Insecure Skill Coding Practices
- Location
SKILL.md:274- Finding
Insecure Collection and Broad Plaintext Storage of Access Tokens
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill's Docker image sync purpose is coherent, but it asks OpenClaw to handle and persist powerful GitHub and CNB tokens in risky ways.
Review before installing. Prefer gh auth login and do not paste GitHub or CNB tokens into chat. If you use this skill, create short-lived, narrowly scoped tokens, avoid broad repo tokens, store secrets outside shared plaintext files when possible, rotate any token previously pasted into OpenClaw, and inspect the pushed GitHub Actions workflow before running it.
SKILL.md:274Insecure Collection and Broad Plaintext Storage of Access Tokens
cnb-pull.sh:180GitHub Token Exposed Through Clone URLs and Temporary Git Metadata
workflow/docker-image-sync.yml:17GitHub Actions Dependencies Use Mutable Version Tags
The skill tells the user they may provide a GitHub Personal Access Token to OpenClaw. Having the agent receive a token with repository, secrets, and workflow permissions creates significant credential-handling risk and broadens the blast radius if the token is exposed.
- **已登录** → 自动创建私有仓库 `cnb-docker-sync`(**默认私有,不会暴露镜像名**)
- **未登录** → 运行 `gh auth login` 在终端登录,或提供 GitHub Personal Access Token 给 openclaw
> Token 获取路径:GitHub → Settings → Developer settings → Personal access tokens → Generate new token
>
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
- **已登录** → 自动创建私有仓库 `cnb-docker-sync`(**默认私有,不会暴露镜像名**)
- **未登录** → 运行 `gh auth login` 在终端登录,或提供 GitHub Personal Access Token 给 openclaw
> Token 获取路径:GitHub → Settings → Developer settings → Personal access tokens → Generate new token
>
> **推荐方式(不过用户手):**
> 运行 `gh auth login`,走设备码流程登录,token 自动由 `gh` 管理,无需用户复制粘贴
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
- **已登录** → 自动创建私有仓库 `cnb-docker-sync`(**默认私有,不会暴露镜像名**)
- **未登录** → 运行 `gh auth login` 在终端登录,或提供 GitHub Personal Access Token 给 openclaw
> Token 获取路径:GitHub → Settings → Developer settings → Personal access tokens → Generate new token
>
> **推荐方式(不过用户手):**
> 运行 `gh auth login`,走设备码流程登录,token 自动由 `gh` 管理,无需用户复制粘贴
Although framed as minimal scope, the skill still instructs users to create a fine-grained token that can read/write contents, secrets, and workflows for a repository. Those permissions are powerful, and if the agent handles the token directly, compromise could enable repository tampering, secret manipulation, and workflow abuse.
> 运行 `gh auth login`,走设备码流程登录,token 自动由 `gh` 管理,无需用户复制粘贴
>
> **如果必须提供 Token(细粒度最小权限):**
> 创建 Fine-grained Personal Access Token,限制到**仅 `cnb-docker-sync` 仓库**,权限:
> - `Contents: read and write`(读写仓库,触发 workflow)
> - `Secrets: read and write`(设置 Repository Secrets)
> - `Workflows: read and write`(触发 Actions)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
#### 2.4 获取 CNB_TOKEN
在制品库页面,找到**访问令牌**或 **Access Token** 配置,创建一个访问令牌(用于拉取凭证)。
### 第三步:提供参数给 openclaw
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
#### 2.4 获取 CNB_TOKEN
在制品库页面,找到**访问令牌**或 **Access Token** 配置,创建一个访问令牌(用于拉取凭证)。
### 第三步:提供参数给 openclaw
The skill explicitly asks the user to send a CNB access token directly to the agent in chat. Sending secrets through chat increases the chance of credential exposure via logs, transcripts, model retention, plugins, or downstream tooling, and the skill also plans to persist that secret for reuse.
The skill instructs the user to paste CNB_TOKEN into chat and states that OpenClaw will write it to ~/.openclaw/.env and reuse it later. This creates both exposure risk during transmission and persistence risk after storage, making compromise of the chat system or local environment materially more damaging.
The English section repeats the instruction to provide a GitHub Personal Access Token to the agent. Because the token enables repository operations and secret management, direct submission to the agent meaningfully increases credential exposure risk.
- **Logged in** → Automatically creates private repo `cnb-docker-sync` (**private by default, image names not exposed**)
- **Not logged in** → Run `gh auth login` in terminal, or provide a GitHub Personal Access Token to openclaw
> Token path: GitHub → Settings → Developer settings → Personal access tokens → Generate new token
>
The documentation again authorizes creation of a powerful fine-grained token for agent-driven automation. Even with limited repository scope, the permissions include workflows and secrets, so exposure could let an attacker alter CI behavior, tamper with images, or exfiltrate stored secrets.
> Run `gh auth login` — device flow, token managed by `gh`, no copy-paste needed
>
> **If you must provide a Token (fine-grained, minimal scope):**
> Create a Fine-grained Personal Access Token limited to the **`cnb-docker-sync` repo only**, permissions:
> - `Contents: read and write` (commit/push to trigger workflow)
> - `Secrets: read and write` (set Repository Secrets)
> - `Workflows: read and write` (trigger Actions)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
#### 2.4 Get CNB_TOKEN
In the CNB registry page, find **访问令牌** (Access Token) configuration, create an access token for pull authentication.
### Step 3 — Provide Parameters to openclaw
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
#### 2.4 Get CNB_TOKEN
In the CNB registry page, find **访问令牌** (Access Token) configuration, create an access token for pull authentication.
### Step 3 — Provide Parameters to openclaw
This section explicitly asks the user to reply with the CNB access token value, including an example token format. Soliciting secrets in normal chat is dangerous because it exposes credentials to transcript storage, logs, and any system that processes the conversation.
| Parameter | Description | Example |
|-----------|-------------|---------|
| `CNB_TOKEN` | CNB access token | `8B76Bopie1d966fVDMgJnhFRepZ` |
| `CNB_REGISTRY` | CNB registry address (fixed value) | `docker.cnb.cool` |
| `CNB_REPO_SLUG` | CNB namespace (lowercase) | `lufei123/lufei-docker` |
| `CNB_GITHUB_REPO` | Private repo address (format: `your-github-username/cnb-docker-sync`) | `your-github-username/cnb-docker-sync` |
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Docker官网镜像拉取能力
#
# 安全特性:
# ✅ .env 加载:无 shell source,使用 IFS 逐行解析,避免注入
# ✅ workflow 内嵌:不在制品内的是用户自建私有仓库
# ✅ 默认私有仓库:不在制品内的是用户自建私有仓库,镜像名不暴露
#
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Docker官网镜像拉取能力
#
# 安全特性:
# ✅ .env 加载:无 shell source,使用 IFS 逐行解析,避免注入
# ✅ workflow 内嵌:不在制品内的是用户自建私有仓库
# ✅ 默认私有仓库:不在制品内的是用户自建私有仓库,镜像名不暴露
#
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# ─── 加载环境变量(安全解析,无 shell source)────────────
# 解析 .env 文件,仅提取技能需要的变量,避免注入风险
load_env() {
local env_file="$HOME/.openclaw/.env"
if [[ ! -f "$env_file" ]]; then
return 0 # 文件不存在,继续用默认值
fi
The script explicitly tells the user to provide a GitHub Personal Access Token to the agent so it can configure GITHUB_TOKEN. In an agent-skill context, instructing users to hand over a broad-scope PAT materially increases credential theft and misuse risk, because the token can grant repository and workflow control far beyond the immediate task and may traverse or be stored in systems the user does not expect.
echo ""
echo "请选择以下方式之一解决:"
echo " 1. 运行 'gh auth login' 在终端登录(推荐)"
echo " 2. 提供 GitHub Personal Access Token 给 openclaw,我会帮你配置 GITHUB_TOKEN"
echo ""
echo "获取 Token 路径:GitHub → Settings → Developer settings → Personal access tokens → Generate new token"
echo "所需权限:repo (全部) + workflow"
This line reinforces the PAT collection flow and recommends generating access tokens with broad repo and workflow permissions. In this skill context, that is especially dangerous because the same script later uses the token for authenticated git clone/push and secret management, meaning compromise of the token can lead to repository takeover, workflow abuse, and exposure of synchronized image metadata or further secrets.
echo " 1. 运行 'gh auth login' 在终端登录(推荐)"
echo " 2. 提供 GitHub Personal Access Token 给 openclaw,我会帮你配置 GITHUB_TOKEN"
echo ""
echo "获取 Token 路径:GitHub → Settings → Developer settings → Personal access tokens → Generate new token"
echo "所需权限:repo (全部) + workflow"
exit 1
fi
Docker image references without a specific tag (:latest is implicit) or digest (@sha256:...) can be silently replaced by a malicious image.
Docker image references without a specific tag (:latest is implicit) or digest (@sha256:...) can be silently replaced by a malicious image.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
**openclaw 收到后会帮你完成以下操作:**
1. 写入 `~/.openclaw/.env`(注意:请保持该文件可信,`chmod 600 ~/.openclaw/.env`)
2. 自动创建私有仓库 `你的用户名/cnb-docker-sync`(如不存在)
3. 将 **内嵌的 GitHub Actions workflow** 推送到你的私有仓库(workflow 代码来自技能制品,透明可查)
4. 将 `CNB_REGISTRY`、`CNB_REPO_SLUG_LOWERCASE`、`CNB_TOKEN` 设置到私有仓库的 Repository Secrets
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
**openclaw 收到后会帮你完成以下操作:**
1. 写入 `~/.openclaw/.env`(注意:请保持该文件可信,`chmod 600 ~/.openclaw/.env`)
2. 自动创建私有仓库 `你的用户名/cnb-docker-sync`(如不存在)
3. 将 **内嵌的 GitHub Actions workflow** 推送到你的私有仓库(workflow 代码来自技能制品,透明可查)
4. 将 `CNB_REGISTRY`、`CNB_REPO_SLUG_LOWERCASE`、`CNB_TOKEN` 设置到私有仓库的 Repository Secrets
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
**openclaw 收到后会帮你完成以下操作:**
1. 写入 `~/.openclaw/.env`(注意:请保持该文件可信,`chmod 600 ~/.openclaw/.env`)
2. 自动创建私有仓库 `你的用户名/cnb-docker-sync`(如不存在)
3. 将 **内嵌的 GitHub Actions workflow** 推送到你的私有仓库(workflow 代码来自技能制品,透明可查)
4. 将 `CNB_REGISTRY`、`CNB_REPO_SLUG_LOWERCASE`、`CNB_TOKEN` 设置到私有仓库的 Repository Secrets
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
**openclaw 收到后会帮你完成以下操作:**
1. 写入 `~/.openclaw/.env`(注意:请保持该文件可信,`chmod 600 ~/.openclaw/.env`)
2. 自动创建私有仓库 `你的用户名/cnb-docker-sync`(如不存在)
3. 将 **内嵌的 GitHub Actions workflow** 推送到你的私有仓库(workflow 代码来自技能制品,透明可查)
4. 将 `CNB_REGISTRY`、`CNB_REPO_SLUG_LOWERCASE`、`CNB_TOKEN` 设置到私有仓库的 Repository Secrets
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.
When `hub.docker.com` is unreachable, this skill proxies through GitHub Actions:
1. Modify `images.txt` in the GitHub repo — **clear all entries, write only the target image**
2. Push to trigger GitHub Actions sync to CNB
3. Wait for Actions completion
4. Pull the image from CNB to local