T01 · Skill Instruction Hijacking
- Location
scripts/bootstrap_workspace_identity.sh:9- Finding
Persistent Modification of Workspace Agent Instructions and Identity
- Content
View full analysis
"$tmp_section" if [ ! -f "$path" ]; then { default_header_for "$file"; echo; echo "$MARK_BEGIN"; cat "$tmp_section"; echo "$MARK_END"; } > "$path" echo "[CREATE] $file"; rm -f "$tmp_section" "$tmp_out"; return fi awk -v begin="$MARK_BEGIN" -v end="$MARK_END" -v section="$tmp_section" ' BEGIN { while ((getline line < section) > 0) replacement = replacement line "\n"; in_block=0; replaced=0 } $0 == begin { print begin; printf "%s", replacement; print end; in_block=1; replaced=1; next } $0 == end && in_block { in_block=0; next } !in_block { print } END { if (!replaced) { print ""; print begin; printf "%s", replacement; print end } } ' "$path" > "$tmp_out" mv "$tmp_out" "$path"; rm -f "$tmp_section"; echo "[UPDATE] $file" } for file in "${OPENCLAW_FILES[@]}"; do upsert_sage_section "$file"; done if [ -f "$WORKSPACE/AGENT.md" ]; then upsert_sage_section "AGENT.md"; fi ``` ### Technical Analysis The documented startup procedure invokes a bootstrap script that creates or modifies workspace-level Agent control files. These files include primary instruction files (`AGENTS.md` and `CLAUDE.md`) as well as identity, user, tool, and heartbeat files. The script inserts a marked Sage CGO instruction section into every listed file. If a file already exists, the `awk` operation replaces the marked block or appends a new block. If it does not exist, t ...[truncated 2217 chars]- Remediation
View remediation
