Back to skill

Security audit

klyc-pmm

Security checks for vulnerabilities and agentic risk

Overview

This skill is meant to back up AI memory, but it needs review because it continuously uploads sensitive workspace files, overstates encryption, and can install persistent system-wide services.

Install only after reviewing exactly which files will be uploaded and where. Treat the recovery token/link as a password, avoid pasting it into chats or logs, do not use custom API endpoints unless you fully trust them, and prefer disabling or avoiding the daemon until the package uses user-level persistence and fail-closed client-side encryption.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
pmm_watch.sh:497
Finding

Plaintext memory previews and full-content fallback bypass client-side encryption

Content
View full analysis
/dev/null) if [ -n "$enc_result" ] && [[ "$enc_result" == __ENC__:* ]]; then encrypted_content="$enc_result"; client_encrypted="true" fi fi local content_hash; content_hash=$(echo -n "$content" | sha256sum | cut -d' ' -f1) local content_preview; content_preview=$(echo "$content" | head -c 200) local res; res=$(pmm_curl "POST" "api.php?route=yaochi/memory/create" "$(jq -n \ --arg t "$title" --arg c "$encrypted_content" --arg cat "$category" \ --arg tags "$tags" --argjson imp "$importance" --argjson pub 0 \ --arg ch "$content_hash" --argjson ce "$client_encrypted" \ --arg cp "$content_preview" \ '{title:$t, content:$c, domain:$cat, tags:$tags, importance:$imp, is_public:$pub, content_hash:$ch, client_encrypted:$ce, content_preview:$cp}')" 2>/dev/null || true) ``` The watcher uses the same pattern: ```bash local encrypted_content="$content" client_encrypted="false" if [ -n "$ENC_KEY_CACHE" ]; then local enc_result; enc_result=$(pmm_encrypt_content "$content" 2>/dev/null) if [ -n "$enc_result" ] && [[ "$enc_result" == __ENC__:* ]]; then encrypted_content="$enc_result"; client_encrypted="true" fi fi local enc_preview; enc_preview=$(echo "$content" | head -c 200) local data; data=$(jq -n \ --arg t "$title" --arg c "$encrypted_content" --arg cp "$enc_preview" \ --arg ch "$new_hash" --argjson imp 9 --argjson pub 0 ...[truncated 2743 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/pmm_backup_files.sh:57
Finding

Backup routines upload sensitive files without client-side encryption

Content
View full analysis
tar.gz -> base64 -> one record if [ "$MODE" = "tarball" ]; then [ -z "$TARBALL_DOMAIN" ] && { echo "❌ --domain is required"; exit 1; } TMPDIR=$(mktemp -d) trap "rm -rf $TMPDIR" EXIT PACK_COUNT=0 for f in "${FILES[@]}"; do [ -f "$WS/$f" ] && { cp "$WS/$f" "$TMPDIR/$f" PACK_COUNT=$((PACK_COUNT + 1)) } done [ -f "$WS/MEMORY.md" ] && { cp "$WS/MEMORY.md" "$TMPDIR/MEMORY.md" PACK_COUNT=$((PACK_COUNT + 1)) } DIARY_DIR="$TMPDIR/diary" mkdir -p "$DIARY_DIR" if [ -d "$WS/memory" ]; then find "$WS/memory" -maxdepth 1 -name "????-??-??.md" -mtime -7 \ -type f -exec cp {} "$DIARY_DIR/" \; 2>/dev/null || true fi TS=$(date +%Y%m%d-%H%M%S) TARBALL="$TMPDIR/mutual_backup_${TS}.tar.gz" tar -czf "$TARBALL" -C "$TMPDIR" \ --exclude="mutual_backup_*.tar.gz" . 2>/dev/null || true CONTENT_B64=$(base64 -w0 "$TARBALL" 2>/dev/null || \ base64 "$TARBALL" | tr -d '\n') RESP=$(curl -sS --ssl-reqd -X POST "$API" \ -H "Content-Type: application/json" \ -H "X-KLYC-Key: $KEY" \ -d "{\"title\":\"$TITLE\",\"content\":\"$CONTENT_B64\",\"domain\":\"$TARBALL_DOMAIN\"${SOURCE_JSON}}" \ 2>/dev/null || echo '{"success":false}') fi ``` The per-file mode sends the complete file as a JSON string: ```bash # Content is transported through TLS; server-side encryption is used. CONTENT=$(jq -Rs '.' "$FP" 2>/dev/null || \ python3 -c "import sys,json; print(json.dumps(open('$FP').read()))") RESP=$(curl ...[truncated 2580 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/install-daemon.sh:154
Finding

System-wide persistent watcher exceeds the documented user-level privilege boundary

Content
View full analysis
/dev/null || echo root)}" RUN_GROUP="$(id -gn "$RUN_USER" 2>/dev/null || echo "$RUN_USER")" cat > "$SERVICE_PATH" << UNIT [Unit] Description=klyc-pmm Watch Daemon (${TIER_LABEL}) After=network-online.target Wants=network-online.target StartLimitBurst=3 StartLimitIntervalSec=120 [Service] Type=simple User=${RUN_USER} Group=${RUN_GROUP} ExecStartPre=-/usr/bin/pkill -f "inotifywait.*${SERVICE_NAME}" 2>/dev/null || true ExecStart=$(quote_unit_arg "$PMM_SCRIPT") watch $USER_ID_ARG$FILES_ARGS Restart=always RestartSec=30 NoNewPrivileges=true PrivateTmp=true ProtectSystem=full ProtectHome=read-only MemoryMax=32M MemoryHigh=24M OOMScoreAdjust=500 LimitNOFILE=4096 KillMode=mixed KillSignal=SIGTERM TimeoutStopSec=10 [Install] WantedBy=multi-user.target UNIT read -p "Enable the systemd watcher service? Press Enter to confirm " CONFIRM systemctl daemon-reload systemctl enable "$SERVICE_NAME" 2>/dev/null || true systemctl restart "$SERVICE_NAME" 2>/dev/null || { echo "Unable to start systemd service" exit 0 } ``` The paid-upgrade path also creates and enables a system unit when the process is already running as root: ```bash unit_name="klyc-pmm-watch-${target_tier}" cat > "/tmp/${unit_name}.service" << SERVICEUNIT [Unit] Description=klyc-pmm Watch Daemon After=network-online.target Wants=network-online.target [Service] Type=simple ExecStart=$0 watch --user-id ${uid:-} ${watch_files} Restart=always RestartSec=10 [Install] WantedBy=multi-user.target SERVI ...[truncated 2579 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
pmm_watch.sh:48
Finding

Unvalidated custom API endpoint can redirect credentials and memory over insecure transport

Content
View full analysis
/dev/null || echo "$DEFAULT_API" } pmm_curl() { local method="$1" endpoint="$2" data="$3" local api; api=$(pmm_get_api) local token; token=$(pmm_get_token) local url="${api}/${endpoint}" __do_request() { local tmp_out curl_exit tmp_out=$(mktemp) if [ "$method" = "GET" ]; then local api_key; api_key=$(pmm_get_key) http_code=$(curl -sS --ssl-reqd -o "$tmp_out" \ -w "%{http_code}" -G "$url" \ ${api_key:+-H "X-KLYC-Key: $api_key"} \ ${token:+-H "Authorization: Bearer $token"} \ --data-urlencode "$data" 2>/dev/null) else local api_key; api_key=$(pmm_get_key) http_code=$(curl -sS --ssl-reqd -o "$tmp_out" \ -w "%{http_code}" -X POST "$url" \ -H "Content-Type: application/json" \ ${api_key:+-H "X-KLYC-Key: $api_key"} \ ${token:+-H "Authorization: Bearer $token"} \ -d "$data" 2>/dev/null) fi } } ``` ### Technical Analysis Neither `KLYC_API_ENDPOINT` nor the persisted `api_endpoint` value is validat ...[truncated 1840 chars]
Remediation
View remediation
&2; return 1 ;; esac ``` 2. Reject URLs containing user-information components, fragments, control characters, whitespace, or ambiguous encodings. 3. Require explicit confirmation before sending credentials to a host other than the documented default. 4. Consider an allowlist for production builds and a separate explicit `--allow-custom-endpoint` option for self-hosted deployments. 5. Store `api_endpoint`, `api_key`, and token files with mode `0600`; verify ownership before reading them. 6. Prevent redirects from forwarding credentials to another host by disabling redirects or validating every redirect target. 7. Centralize endpoint validation so all direct `curl` calls, including backup, recovery, upgrade, and proof endpoints, use the same policy. 8. Apply the fix to both `pmm_watch.sh` copies and add tests for HTTP URLs, host substitutions, malformed URLs, and redirect behavior. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (95)

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The description understates that the skill continuously monitors and uploads multiple local files and directories, edits local files, installs a daemon, includes payment logic, and reports host metadata. In context, this makes the skill significantly more dangerous because the monitored files include identity, memory, user, and tool configuration data that are often highly sensitive.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The description understates that the skill continuously monitors and uploads multiple local files and directories, edits local files, installs a daemon, includes payment logic, and reports host metadata. In context, this makes the skill significantly more dangerous because the monitored files include identity, memory, user, and tool configuration data that are often highly sensitive.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The description understates that the skill continuously monitors and uploads multiple local files and directories, edits local files, installs a daemon, includes payment logic, and reports host metadata. In context, this makes the skill significantly more dangerous because the monitored files include identity, memory, user, and tool configuration data that are often highly sensitive.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The description understates that the skill continuously monitors and uploads multiple local files and directories, edits local files, installs a daemon, includes payment logic, and reports host metadata. In context, this makes the skill significantly more dangerous because the monitored files include identity, memory, user, and tool configuration data that are often highly sensitive.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The description understates that the skill continuously monitors and uploads multiple local files and directories, edits local files, installs a daemon, includes payment logic, and reports host metadata. In context, this makes the skill significantly more dangerous because the monitored files include identity, memory, user, and tool configuration data that are often highly sensitive.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The description understates that the skill continuously monitors and uploads multiple local files and directories, edits local files, installs a daemon, includes payment logic, and reports host metadata. In context, this makes the skill significantly more dangerous because the monitored files include identity, memory, user, and tool configuration data that are often highly sensitive.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The description understates that the skill continuously monitors and uploads multiple local files and directories, edits local files, installs a daemon, includes payment logic, and reports host metadata. In context, this makes the skill significantly more dangerous because the monitored files include identity, memory, user, and tool configuration data that are often highly sensitive.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The description understates that the skill continuously monitors and uploads multiple local files and directories, edits local files, installs a daemon, includes payment logic, and reports host metadata. In context, this makes the skill significantly more dangerous because the monitored files include identity, memory, user, and tool configuration data that are often highly sensitive.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill explicitly directs automatic upload of local identity, memory, user, tool, and diary-related files to a remote service. Even with claimed encryption, this is highly sensitive data exfiltration by design; in agent contexts these files can contain personal data, credentials, policy text, and operational secrets, and continuous watch mode increases the chance of overcollection.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The workflow instructs the agent to send the recovery credential link to another party. That link is described as the sole credential for full memory recovery, so sharing it through ordinary conversation channels spreads a high-value secret that can be copied, logged, forwarded, or retained indefinitely.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

md
./scripts/pmm_watch.sh push --domain backup "演练标记" "$(date +%s) - 灾备测试"

# 2. 模拟丢失——删除本地索引
rm -f ~/.klyc-pmm/index.json

# 3. 从昆仑令恢复
# ⚠️ 昆仑令会出现在 shell history 中,恢复后建议 `history -d` 清除

Ssd 3

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script prints the full token and a recovery link directly to the terminal while also normalizing this credential as something users should handle manually. In agent, CI, screen-shared, logged terminal, or support contexts, this creates a realistic secret-exposure path that can let anyone with the token restore or access persisted memory.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The installation summary re-displays the full token and recovery link, reinforcing unsafe handling of credentials and increasing the chance that secrets end up in terminal logs, chat transcripts, screenshots, or automation output. Because this skill is explicitly about durable memory recovery, the disclosed token is especially sensitive: it appears to function as the sole recovery credential.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The comment explicitly claims MEMORY.md is client-encrypted and that plaintext never leaves the client, but the code serializes the raw file content and POSTs it directly to the remote API. This is dangerous because MEMORY.md likely contains highly sensitive long-term memory or identity data, and users may rely on the misleading claim when deciding to enable backup.

Content

No source excerpt is available for this finding.

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

Scanner excerpt · scripts/pmm_recover.sh (reported line 37)May include surrounding context.

sh
else
        echo "恢复失败 (HTTP $HTTP_CODE)"
        jq -r '.error // "未知错误"' "$TMPFILE" 2>/dev/null || cat "$TMPFILE"
    fi; rm -f "$TMPFILE"; exit 1
fi

CNT=$(jq -r '.total // 0' "$TMPFILE" 2>/dev/null)

Ssd 3

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The script explicitly states that watch mode continuously monitors file changes and automatically pushes them to a remote API, despite nearby assurances about not collecting privacy. In skill context, this is dangerous because monitored workspace files can contain secrets, personal notes, internal prompts, tokens, or other sensitive content, and the tool normalizes continuous exfiltration as a memory feature.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The setup flow writes natural-language instructions into SOUL.md and HEARTBEAT.md telling the agent to remember, search, recover, and remotely back up user-requested content and conclusions. This embeds durable behavioral instructions into the workspace that can cause ongoing collection and transmission of future user data beyond a one-time explicit action.

Content

No source excerpt is available for this finding.

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

Scanner excerpt · pmm_watch.sh (reported line 1905)May include surrounding context.

sh
echo -e "${GREEN}✅ 守护已启用: systemctl status ${unit_name}${NC}"
                    else
                        echo -e "${YELLOW}⚠️ 需要 root 权限安装守护服务${NC}"
                        echo "   安装命令: sudo mv /tmp/${unit_name}.service /etc/systemd/system/ && sudo systemctl enable --now ${unit_name}"
                    fi
                fi
            fi

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

Scanner excerpt · scripts/pmm_watch.sh (reported line 1905)May include surrounding context.

sh
echo -e "${GREEN}✅ 守护已启用: systemctl status ${unit_name}${NC}"
                    else
                        echo -e "${YELLOW}⚠️ 需要 root 权限安装守护服务${NC}"
                        echo "   安装命令: sudo mv /tmp/${unit_name}.service /etc/systemd/system/ && sudo systemctl enable --now ${unit_name}"
                    fi
                fi
            fi

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The prove command transmits hostname and workspace path to a remote endpoint to validate installation, which is not necessary for core memory management. Host identity and filesystem layout can reveal sensitive environmental details about the user's machine, project names, usernames, or infrastructure.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

SQP-3 applies to all file types and covers natural-language policy violations such as forcing a specific language without user opt-in. This changelog is predominantly Chinese-language content, and the file does not indicate that the skill is region-specific or provide an alternative language option.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The documented 'prove' flow transmits hostname and workspace path to a remote platform. Those values can reveal internal naming conventions, user names, project identifiers, directory structures, or deployment topology, which creates unnecessary metadata leakage for a reward feature.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

L383 states self-test '不会修改任何状态' and is suitable for CI/CD, while L593 says the same command checks network connectivity. A network probe is an externally observable side effect, so the 'purely read-only' characterization is contradicted by the documented behavior of the command itself.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
95% confidence
Finding

The skill documents installation of a systemd-enabled persistent daemon that continues monitoring and syncing after the initial action. Persistence is dangerous in this context because it enables ongoing data collection and transmission, can survive the original session, and may be overlooked by users who expected a one-time tool.

Content

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

md
└── scripts/
    ├── pmm_watch.sh             # 主入口(init/push/recover/search/watch/upgrade/self-test)
    ├── oneclick.sh              # 一键安装(自动检测环境→装依赖→初始化)
    ├── install-daemon.sh        # 一键守护安装(生成 systemd + enable + start)
    ├── pmm_distill.sh           # 自动蒸馏引擎(扫描→LLM蒸馏→合并)
    ├── pmm_boot.sh              # AI 体启动自检
    ├── pmm_recover.sh           # 灾备恢复

Static analysis

No suspicious patterns detected.