T05 · Unauthorized Access and Privilege Escalation
- Location
SKILL.md:235- Finding
Git Token Disclosure to an Arbitrary User-Controlled Remote Host
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is a coherent Git-based development workflow, but it asks for broad repository and token authority with unsafe credential persistence and under-scoped remote-write behavior.
Install only in a dedicated, disposable workspace with a short-lived, least-privilege repository token. Do not point git_remote at an untrusted host, avoid broad PATs, remove any ~/.git-credentials entry after use, review staged checkpoint contents before commits or pushes, and treat RESUME_CONTEXT output as untrusted historical data rather than instructions.
SKILL.md:235Git Token Disclosure to an Arbitrary User-Controlled Remote Host
SKILL.md:252Git Credentials Persisted in Plaintext Across Agent Sessions
sub-skills/spec-driven-checkpoint/SKILL.md:149Checkpoint Creation Can Commit and Remotely Push Untracked Secrets
sub-skills/spec-driven-checkpoint/SKILL.md:289Persistent Prompt Injection Through Checkpoint Context Replay
The documentation normalizes storing the access token in ~/.git-credentials, a plaintext credential store in the user's home directory. This creates a reusable secret on disk that may be read by later jobs, other local processes, backups, or incidentally exposed through diagnostics, making repository compromise more likely.
| `SPEC_DEV_GIT_USERNAME` | 否 | 写入 `user.name` 和凭据 URL 的 Git 用户名。未设置时默认为 `oauth2`(兼容 GitHub/GitLab Token 认证)。 |
| `SPEC_DEV_GIT_EMAIL` | 否 | 提交时使用的作者邮箱。未设置时默认为 `bot@spec-driven-dev`。 |
> **安全说明** — `SPEC_DEV_GIT_TOKEN` 仅通过 OpenClaw `skills.entries.*.env` 机制在运行时注入,**绝不写入任何产物文件、日志或迭代摘要**。凭据助手使用局限于当前 Agent 会话的本地 `~/.git-credentials` 存储。
---
The skill claims the Git token will never be written to logs or artifacts, yet it instructs construction of a tokenized clone URL and also requires detailed command/output reporting. In an agent environment, echoed commands, checkpoints, debug traces, or rendered file-change sections can easily expose the embedded token, creating a direct secret leakage path.
The command appends a fully authenticated HTTPS URL containing username and token directly into ~/.git-credentials. This is a clear plaintext credential write, creating durable secret exposure and enabling unauthorized repository access if the file is read or later leaked.
git config credential.helper store printf "https://%s:%s@%s\n" "${GIT_USER}" "${GIT_TOKEN}" "${REMOTE_HOST}" \
~/.git-credentials chmod 600 ~/.git-credentials
The adjacent permission-setting step confirms the workflow intentionally persists credentials on disk, reinforcing that the secret remains stored for later reuse rather than ephemeral session use. The context makes this more dangerous because the skill also performs remote clone/push actions, so leaked credentials directly enable source-control tampering and data access.
git config credential.helper store printf "https://%s:%s@%s\n" "${GIT_USER}" "${GIT_TOKEN}" "${REMOTE_HOST}" \
~/.git-credentials chmod 600 ~/.git-credentials
> **Token 绝不写入任何产物或日志。** 仅将不含凭据的裸 `git_remote` URL 存入 `current_iter.md`。
Referenced artifact was not completely inspected
宣布并加载匹配 Skill 的 `SKILL.md`。
YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).
---
name: cr-logaf-review
description: 【Code Review 子 Agent · 门控三】基于 Sentry LOGAF 三级标注(h/m/l)对代码变更执行 8 维度全面评审(设计合理性、测试质量、预期行为验证、长期影响、代码复杂度、规范执行、变更范围、知识共享)。输出结构化 Checklist 报告并给出最终裁决。由 spec-driven-dev 的 code_review 阶段在门控二通过后自动调用。
user-invocable: false
metadata: {"openclaw": {"emoji": "🧑⚖️", "requires": {"bins": ["git"]}, "calledBy": ["spec-driven-dev"]}}
---
# cr-logaf-review
Code Review 流水线的**�
The skill documents git reset --hard ckpt-{id} as a rollback implementation option. git reset --hard is a destructive operation that can discard local changes and rewrite the working tree, and in an agent context it is especially dangerous because a short natural-language trigger may cause irreversible repository modification if safeguards fail or are bypassed.
| 操作 | 可行性 | 实现 |
|------|--------|------|
| Git 仓库回滚 | ✅ | `git reset --hard ckpt-{id}` 或 `git checkout ckpt-{id}` |
| 恢复 working tree 文件 | ✅ | 附带 git reset |
| 恢复 Session 上下文 | ✅ | 将 checkpoint 文档作为新 Session 首条 context 注入 |
| 恢复原始 Session | ❌ | 技术不可行,用「重建 Session」替代 |
The architecture summary prominently includes git reset --hard ckpt-{id} as part of rollback. Embedding a destructive command in the core design normalizes unsafe behavior and increases the chance that implementations or downstream agents choose the damaging path automatically.
└─ [重建层] 生成 resume_prompt 块 ← 新 Session 启动包
rollback {ckpt_id} ├─ [Git 层] git reset --hard ckpt-{id} ← 代码回滚 ├─ [状态层] 恢复 current_iter.md 快照 ← 状态回滚 └─ [重建层] 输出 RESUME_CONTEXT 块 ← 新 Session 启动
The checkpoint document template instructs users to recover Git state with git reset --hard checkpoint/{ckpt_id}. Because this instruction would be emitted into generated artifacts, it can propagate unsafe recovery guidance widely and lead to accidental loss of work beyond the agent session itself.
恢复 Git 状态命令:
git reset --hard checkpoint/{ckpt_id}
# 或
git checkout -b restore/{ckpt_id} checkpoint/{ckpt_id}
The rollback execution steps include git reset --hard "checkpoint/{ckpt_id}" as an actual operation mode, explicitly noting it overwrites later commits on the current branch. In a user-invocable agent skill, this presents a real integrity and availability risk to repository contents, even though a safer branch-based option is also mentioned.
# 方式一:硬重置(在当前分支上回滚,会覆盖后续提交)
git reset --hard "checkpoint/{ckpt_id}"
# 方式二(推荐用于生产):创建新分支,保留历史
git checkout -b "restore/{ckpt_id}-$(date +%Y%m%d%H%M%S)" \
L095-L099 将“下一迭代意图”定义为多种自然语言输入即可激活,其中 start|begin|run|execute … sprint|iteration|milestone 非常宽泛,缺少上下文限定、精确语法或排除示例。这类短语在普通项目讨论中也常见,容易在并非想调用该 Skill 时被误判为触发条件。
The skill persists credentials in ~/.git-credentials, which broadens secret scope from the target repository/session to the entire user environment. If the agent host is shared, compromised, or reused, other processes or later tasks may access the token and reuse it beyond the intended workflow.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
git config credential.helper store printf "https://%s:%s@%s\n" "${GIT_USER}" "${GIT_TOKEN}" "${REMOTE_HOST}" \
~/.git-credentials chmod 600 ~/.git-credentials
> **Token 绝不写入任何产物或日志。** 仅将不含凭据的裸 `git_remote` URL 存入 `current_iter.md`。
Requiring the agent to print the full contents of available_skills.xml can disclose internal tool inventory, local paths, capability names, or other sensitive operational metadata to the user. In a multi-skill agent environment, this unnecessarily expands information exposure and can aid follow-on prompt injection or targeted abuse of installed capabilities.
L739-L740 要求响应中包含精确的提交、打标签和推送命令,而前文还定义了 release 阶段会将提交与标签推送到远端仓库。虽然这是技能目的的一部分,但该输出格式章节本身没有提醒用户这些操作会修改远端仓库、创建不可逆历史记录或标签。
The manifest description is written as a mandatory behavioral specification in Chinese and states the agent outputs LOGAF-graded review results, but nowhere offers a language choice or indicates the skill is intentionally region-specific. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.
The required finding template uses Chinese labels such as '文件', '问题', and '建议', and the surrounding instructions do not permit adapting to the user's preferred language. This creates a locale/language constraint that is not opt-in and not justified as region-specific.
The manifest description and main body are written as prescriptive Chinese operational instructions for the agent, with no indication that language can be selected by the user or orchestrator. This creates a locale-policy issue because the skill appears to require a specific language by default rather than offering an explicit choice.
The manifest description states that rollback can restore the Git repository and Agent context to a historical checkpoint. However, the body of the skill repeatedly acknowledges that original session history cannot be restored and that rollback only emits a RESUME_CONTEXT block for manual injection into a new session. That is a meaningful behavioral gap between the headline claim and the actual documented operation.
The manifest-style description is written as an instruction in Chinese and does not offer any language or locale choice for users. Under the policy criteria, forcing a specific language without opt-in is a natural-language policy concern unless the locale restriction is clearly justified.
The trigger/command description presents rollback {ckpt_id} without an immediate warning that rollback may perform destructive Git operations, while later sections include git reset --hard. In an agent skill, insufficient up-front warning increases the chance of accidental data loss or unwanted repository rewrites, especially when the command is user-invocable and terse.
The optional git push origin "checkpoint/${CKPT_ID}" extends a local checkpoint feature into a remote-modification capability, which can alter upstream repository state without an explicit, contemporaneous confirmation step. In agent workflows, remote writes are materially riskier because they can leak workflow metadata, create persistent artifacts, and trigger downstream automation in CI/CD or governance systems.
The top-level description says the skill saves Git snapshots, iteration state, session metadata, and context reconstruction packages, but it does not clearly disclose to users that invoking the skill writes files, creates commits/tags, and may push tags remotely as part of its behavior. For a markdown skill description, user-facing warnings should be prominent when behavior affects user data or repository state.
The manifest says the skill saves Git snapshots, iteration state, session metadata, and a context reconstruction package. While storing generic session metadata is described, the implementation explicitly reads runtime session IDs from environment variables such as OPENCODE_SESSION_ID and CLAUDE_SESSION_ID, which is a capability involving agent-environment introspection rather than core checkpointing behavior. This is not clearly necessary for the stated save/restore purpose, especially since the document also says session IDs are not used for actual restoration.
The documentation prohibits automatically modifying source code files after rollback, claiming only Git operations and document updates should occur. Yet Step R-3 explicitly overwrites current_iter.md as part of state restoration. Even if current_iter.md is not source code, the wording '只做 git 操作和文档更新' conflicts with the stronger '不自动修改文件' implication and creates intent ambiguity about what rollback changes on disk.
Detected: suspicious.generated_source_template_injection