Back to skill

Security audit

developer-self-improve-core

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a memory and reminder helper, but it has Review-worthy risks around persistent agent memory changes, automatic proposal deletion, and optional DingTalk data sharing.

Install only if you are comfortable with this skill creating persistent local memory rules that may shape future agent behavior. Keep reminders and cleanup disabled until tested, avoid wiring auto-confirm to chat replies, review proposal contents before sending them to DingTalk, and back up the memory directory before running cleanup or scheduled automation.

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 (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/developer-self-improve-core.sh:340
Finding

Proposal Cleanup Ignores the Configured Safety Control

Content
View full analysis
/dev/null | cut -d: -f2 | tr -d ' ' || echo "7") local current_time=$(date +%s) local expired_count=0 echo "📅 检查超期提案(保留${retention_days}天)..." for file in "$PROPOSALS_DIR"/*.md; do if [ -f "$file" ]; then local file_time=$(stat -c %Y "$file" 2>/dev/null || echo "0") local age_days=$(( (current_time - file_time) / 86400 )) if [ "$age_days" -gt "$retention_days" ]; then echo " ⚠️ 超期文件:$(basename $file)(已${age_days}天)" rm -f "$file" expired_count=$((expired_count + 1)) fi fi done if [ "$expired_count" -gt 0 ]; then echo "✅ 已清理 $expired_count 个超期文件" echo "$(date -Iseconds) CLEANUP_EXPIRED count=$expired_count" >> "$LOGS_DIR/operations.log" else echo "✓ 无超期提案" fi } # 4. 定期清洗 cleanup() { echo "🧹 执行记忆清洗扫描..." cleanup_expired_proposals ``` The corresponding safety setting is declared in `config/config.yaml`: ```yaml # 是否启用自动清理(true/false) # 建议:初始测试时设为 false,确认无误后再启用 # enable_auto_cleanup: true # 自动清理超期草案 enable_auto_cleanup: false # 手动清理(推荐) ``` ### Technical Analysis The cleanup implementation reads `retention_days`, but it never reads or enforces `enable_auto_cleanup`. Calling the `cleanup` command therefore invokes `cleanup_expired_proposals` and permanently deletes every proposal file whose modification time exceeds the retention period, even when `enable_auto_cleanup` is explicitly set to `false`. This behavior conflicts with the documented safety model, which states that automa ...[truncated 1494 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
scripts/developer-self-improve-core.sh:411
Finding

Unvalidated Rule IDs Are Interpolated into Regex-Based File Mutations

Content
View full analysis
/dev/null; then proposal_file="$file" break fi done if [ -z "$proposal_file" ]; then echo "❌ 规则草案不存在" return 1 fi case $action in 同意) if grep -q "### 【规则 ID】$rule_id" "$RULES_FILE"; then echo "⚠️ 规则已存在,跳过确认" sed -i "/### 【规则 ID】$rule_id/,/USER_ACTION/d" "$proposal_file" return 0 fi # 提取规则内容并添加到长期规则库(更新状态为已确认) echo "" >> "$RULES_FILE" sed -n "/### 【规则 ID】$rule_id/,/USER_ACTION/p" "$proposal_file" | \ sed 's/状态:待审/状态:已确认/' | \ sed 's/处理期限:.*/确认时间:'$(date -Iseconds)'/' >> "$RULES_FILE" echo "---" >> "$RULES_FILE" # 从提案文件中删除已确认的规则 sed -i "/### 【规则 ID】$rule_id/,/USER_ACTION/d" "$proposal_file" ``` The command dispatcher exposes this function directly: ```bash confirm) shift confirm_rule "$@" ;; ``` ### Technical Analysis The direct `confirm` command accepts an arbitrary `rule_id` and inserts it into `grep` and `sed` regular expressions without validation or escaping. Consequently, metacharacters such as `.*`, character classes, anchors, and repetition operators are interpreted as regex syntax rather than as literal identifier characters. The `auto-confirm` path performs partial extraction using a constrained pattern, bu ...[truncated 1909 chars]
Remediation
View remediation
&2 return 1 fi ``` 2. Validate `action` before any file search or mutation and allow only the documented exact values. 3. Avoid interpolating identifiers into regular expressions. Parse exact fields with `awk`, or compare complete strings literally. 4. If regex tools remain necessary, escape every regex metacharacter before constructing a pattern. Do not reuse shell-escaped data as regex-escaped data. 5. Write modifications to a temporary file in the same directory, validate the resulting structure, and atomically rename it over the original file. 6. Back up or archive the original proposal and rules files before mutation so interrupted or incorrect updates can be recovered. 7. Add tests using identifiers containing `.`, `*`, `[`, `]`, `^`, `$`, `/`, backslashes, whitespace, and newlines. Each malformed identifier must be rejected without modifying any file. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (23)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

整体上,代码与“自检/防重/规则草案/清洗扫描”这一核心方向基本一致,但存在关键描述—行为不一致。首先,描述明确声称“绝不自动写入/修改/删除长期记忆”,而代码中的 confirm_rule 在接收到“同意”动作后会把提案追加写入长期规则库;虽然这里需要显式确认,符合“人类终审”,但仍然属于写入长期记忆,与绝对化表述冲突。其次,代码具有实际的删除与修改能力:会删除提案、清理超期文件、并修改平台配置,这些能力未在声明中体现。再次,声明中的“每天 9:30 钉钉推送待确认规则”是重要功能点,但代码里没有任何定时调度或钉钉推送实现,只是本地终端输出待确认提醒和从消息文本中解析确认意图。因此应判定为存在实质性不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

声明描述的是一个运行期自改进与自动提醒系统,核心行为应发生在每轮对话前后、按轮次累计、按周扫描,以及每日固定时间自动推送。而实际代码只是一个 setup 脚本:检查 config.yaml 中的 dingtalk_target 和 reminder_time 是否填写正确,然后打印 crontab 配置指引,让用户手动添加定时任务来运行另一个脚本。该代码的主要目的与声明的核心功能明显不一致,且没有实现所宣称的大部分关键能力。虽然它与“每天提醒”这一主题存在部分关联,但仅属辅助配置步骤,无法覆盖声明中的主体功能,因此应判定为描述与行为不匹配。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill documentation and usage instructions are presented only in Chinese, which effectively imposes a specific language on users. The policy allows locale constraints only when users are given a choice or the restriction is explicitly justified, neither of which is stated here.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

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.

Content

Scanner excerpt · SECURITY.md (reported line 174)May include surrounding context.

Important: Back up the skill directory before enabling automation:

bash
# Create backup
cp -r ~/.openclaw/workspace/skills/developer-self-improve-core \
        ~/.openclaw/workspace/skills/developer-self-improve-core.backup

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

The skill instructs the user to create a persistent cron job that will execute a script daily from a workspace path. Persistent scheduled execution increases risk because any later modification of that script or its directory contents can result in recurring code execution, and users may forget the job remains active. In the context of a skill installed under a writable workspace, this persistence is more dangerous than a one-time manual command.

Content

Scanner excerpt · SKILL.md (reported line 79)May include surrounding context.

  1. 配置 crontab:
    bash
    crontab -e
    # 添加以下行(每天 9:30 执行):
    30 9 * * * cd ~/.openclaw/workspace/skills/developer-self-improve-core && ./scripts/daily-check.sh
    

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This YAML file contains user-facing instructions, option descriptions, and examples exclusively in Chinese. That creates a language/locale restriction for users who do not read Chinese, and the file does not offer an alternative language or explain that the skill is intentionally region-specific.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script transmits aggregated rule contents, including scene, problem, suggestion, and confidence fields, to DingTalk via openclaw message send without any explicit consent check, data classification, redaction, or operator-facing warning at send time. Because proposal files may contain sensitive internal prompts, incidents, or policy text, this creates a real risk of unintended disclosure to an external messaging platform, especially when triggered automatically by cron.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

User-facing output, prompts, and usage instructions are consistently written in Chinese, including required reply formats such as 同意/修改/忽略. This imposes a specific language on users without any opt-in or documented locale constraint.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script automatically deletes proposal memory files based on age without an explicit approval step at deletion time. Even if proposals are not the confirmed long-term rules, they are still user-relevant memory artifacts, so this behavior conflicts with the skill’s stated safety model and can cause silent loss of audit/history data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script removes proposal files automatically once considered expired, without a just-in-time confirmation or user-visible warning at the deletion point. In a self-improvement/memory-management skill, silent deletion undermines user control and can erase evidence needed for review, rollback, or dispute resolution.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
91% confidence
Finding

The auto_confirm function infers approval actions such as 同意/忽略 from free-form message text and then performs persistent rule state changes. In a skill whose core safety promise is 'AI only proposes, human reviews,' intent parsing from ambient messages creates a risk of accidental or spoofed confirmation, especially when integrated with chat channels like DingTalk.

Content

Scanner excerpt · scripts/developer-self-improve-core.sh (reported line 542)May include surrounding context.

sh
}

# 9. 自动确认规则(从钉钉消息识别意图)
auto_confirm() {
    local user_input="$1"
    
    local action=""

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
89% confidence
Finding

Exposing auto-confirm as a top-level command enables autonomous state transitions from parsed message content, not from a deliberate interactive review flow. In this skill context, that weakens the intended human-in-the-loop control and increases the chance of unauthorized or accidental rule confirmation/deletion.

Content

Scanner excerpt · scripts/developer-self-improve-core.sh (reported line 602)May include surrounding context.

sh
check-and-notify-pending)
            check_and_notify_pending
            ;;
        auto-confirm)
            shift
            auto_confirm "$@"
            ;;

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
85% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · scripts/developer-self-improve-core.sh (reported line 604)May include surrounding context.

sh
;;
        auto-confirm)
            shift
            auto_confirm "$@"
            ;;
        help|*)
            echo "🛡️  developer-self-improve-core 安全可控自改进技能(多平台版)"

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
85% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · scripts/developer-self-improve-core.sh (reported line 609)May include surrounding context.

sh
help|*)
            echo "🛡️  developer-self-improve-core 安全可控自改进技能(多平台版)"
            echo ""
            echo "用法:$0 {init|pre-check|post-check|cleanup|confirm|switch-platform|view-rules|check-and-notify-pending|auto-confirm}"
            echo ""
            echo "命令说明:"
            echo "  init                    初始化记忆目录"

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
85% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · scripts/developer-self-improve-core.sh (reported line 620)May include surrounding context.

sh
help|*)
            echo "🛡️  developer-self-improve-core 安全可控自改进技能(多平台版)"
            echo ""
            echo "用法:$0 {init|pre-check|post-check|cleanup|confirm|switch-platform|view-rules|check-and-notify-pending|auto-confirm}"
            echo ""
            echo "命令说明:"
            echo "  init                    初始化记忆目录"

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

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.

Content

Scanner excerpt · README.md (reported line 57)May include surrounding context.

md
echo "📋 配置定时任务:"
echo ""
echo "1. 编辑 crontab:"
echo "   crontab -e"
echo ""
echo "2. 添加以下行:"
echo "   $REMINDER_TIME cd $SKILL_DIR && ./scripts/daily-check.sh"

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

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.

Content

Scanner excerpt · scripts/setup-automation.sh (reported line 47)May include surrounding context.

sh
echo "📋 配置定时任务:"
echo ""
echo "1. 编辑 crontab:"
echo "   crontab -e"
echo ""
echo "2. 添加以下行:"
echo "   $REMINDER_TIME cd $SKILL_DIR && ./scripts/daily-check.sh"

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

Line L024 specifies the confirmation options as "【同意/修改/忽略】", which imposes a specific language in user-facing interaction. The file does not indicate that users can choose another language or that this locale restriction is required for a region-specific workflow.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script's comments and all user-facing output strings are written exclusively in Chinese, with no indication that language is configurable or limited to a justified region-specific context. This creates a language policy concern because it effectively forces a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The initialization output states that short_term/ is automatically destroyed after the conversation ends, but there is no code anywhere in the script that clears or deletes that directory. This overstates the implemented privacy/retention behavior.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The inline documentation at check_and_notify_pending says it is for post-response invocation, but pre_check calls it before answering. This is a direct contradiction between documented intent and actual execution timing.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The switch_platform function uses sed -i to overwrite the config file directly. While this is part of the feature's purpose, the script does not clearly disclose in its help or comments that invoking this command persistently edits configuration on disk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

This shell script presents its user-facing comments and terminal messages in Chinese, and later output lines continue that pattern. For a general-purpose setup script, forcing a specific language without user opt-in is a natural-language locale policy concern under SQP-3.

Content

No source excerpt is available for this finding.