Back to skill

Security audit

dup-finder

Security checks for vulnerabilities and agentic risk

Overview

This duplicate-file skill is review-worthy because its optional cleanup can permanently delete files while the documentation incorrectly suggests backups, and its install command uses an unpinned external CLI.

Install only if you are comfortable reviewing Chinese-language instructions and using a local duplicate-file tool that can permanently delete files. Run dry-run first, avoid broad locations like a whole home directory, make independent backups before --apply, and prefer a pinned or manually reviewed install source rather than the unpinned npx command.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/dup_finder.py:3
Finding
Irreversible File Deletion Without Collision-Resistant Equality Verification or Backup<![CDATA[ ## Vulnerability Details **File Location**: `scripts/dup_finder.py:3-6, 31-50`; related inaccurate backup claim at `SKILL.md:54` **Vulnerability Type**: Unsafe destructive file operation and weak duplicate verification **Risk Level**: High ### Vulnerable Code ```python def sha_of(path, full): h = hashlib.sha1() with open(path, "rb") as f: h.update(f.read(65536) if not full else f.read()) return h.hexdigest() ``` ```python for ps in cand: by_head = {} for p in ps: by_head.setdefault(sha_of(p, False), []).append(p) for ps2 in by_head.values(): if len(ps2) > 1: by_full = {} for p in ps2: by_full.setdefault(sha_of(p, True), []).append(p) for ps3 in by_full.values(): if len(ps3) > 1: groups.append(sorted(ps3)) waste = sum(os.path.getsize(g[i]) for g in groups for i in range(1, len(g))) removed = 0 if a.apply: for g in groups: for p in g[1:]: try: os.remove(p); removed += 1 except OSError: pass ``` The documentation additionally states: ```markdown - 涉及写盘的操作默认 **dry-run 预览**,加 `--apply` 才执行(text-replace/dup-finder 还会先备份) ``` ### Technical Analysis The implementation considers two files identical solely because their sizes, first-block SHA-1 hashes, and complete SHA-1 hashes match. SHA-1 is collision-broken and is not suitable as the final proof that files are byte-for-byte identical. No final binary comparison is performed before deletion. There is also a time-of-check-to-time-of-use window between hashing and `os.remove()`. A file can be changed or replaced after it has been hashed but before deletion. The script neither revalidates the file identity and contents nor protects against path replacement immediately before removal. When `--apply` is supplied, duplicate candidates are permanently removed with `os.remove()`. No backup, quarantine, recycl ...[truncated 1453 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace SHA-1 with a collision-resistant digest such as SHA-256 or BLAKE2 for candidate grouping. 2. Treat hashes only as an optimization. Before deletion, compare every candidate against the retained file byte-for-byte using bounded chunks. 3. Immediately before removal, reopen and revalidate both files. Record and compare stable identity information where supported, including device, inode, size, modification time, and file type. 4. Avoid permanent deletion by default. Move candidates into a user-controlled quarantine directory or use an appropriate recoverable trash mechanism. 5. If backup behavior is promised, create and verify a backup before removing the original. Abort deletion if the backup cannot be completed. 6. Require explicit confirmation or a reviewed manifest for destructive operations, especially when processing broad directory trees. 7. Report every failed deletion and return a nonzero status for partial failure rather than silently suppressing `OSError`. 8. Correct `SKILL.md:54` until backup functionality is actually implemented and verified. ]]>

T08 · Insecure Dependencies

Warning
Location
SKILL.md:81
Finding
Unpinned Third-Party CLI Execution in Installation Instructions<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:81` **Vulnerability Type**: Unpinned package execution and supply-chain exposure **Risk Level**: Medium ### Vulnerable Code ```bash npx skills add zhaoxinghua09-cell/agent-skills -g ``` ### Technical Analysis The documented installation command invokes `npx` with the unversioned package name `skills`. Depending on the local environment and cache state, `npx` may retrieve and execute the package version currently resolved by the package registry. No reviewed version, integrity digest, or immutable artifact is specified. Consequently, the code executed during installation can differ from the code covered by this audit. The global installation option further increases the scope of resulting changes within the user's environment. The audited Python implementation itself has no third-party runtime dependencies; this finding concerns the separate installation path documented by the Skill. ### Attack Path 1. The package version resolved for the unpinned `skills` name is compromised, maliciously updated, or otherwise changes after this audit. 2. A user follows the documented `npx skills ... -g` installation command. 3. `npx` retrieves and executes the newly resolved third-party CLI code. 4. That code runs with the invoking user's privileges and can perform actions beyond copying the reviewed Skill, including modifying user-accessible files or global user-level package locations. ### Impact Assessment Exploitation would grant malicious installation code the same privileges as the user running `npx`. It could read or modify files available to that account, alter development configuration, install additional components, or tamper with globally installed user tooling. This command does not itself demonstrate privilege escalation to an administrator or root account; impact remains bounded by the privileges under which it is executed. ]]>
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin the installer CLI to a specific reviewed version, for example by using an explicit `package@version` reference. 2. Publish and verify an integrity digest or signature for the expected package artifact. 3. Document the expected registry and publisher identity so users can validate the package source. 4. Avoid global installation unless it is strictly necessary; prefer a scoped, temporary, or isolated environment. 5. Offer an immutable installation method based on a reviewed release archive or pinned repository commit. 6. Explain that the installer CLI is external to this audited package and must be assessed separately before execution. ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (10)

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
The attestation content is primarily written in Chinese, with only the title partially bilingual, and does not indicate that users may choose another language. This can violate language/locale policy when a skill artifact imposes a specific language without opt-in or justification.

Vague Triggers

Medium
Confidence
86% confidence
Finding
The phrase "One command for daily file/text chores" is very broad and overlaps with many common file-related requests rather than narrowly describing duplicate-file detection. In a skill-discovery or invocation context, this wording could cause unintended activation because it does not clearly constrain when this skill should be used versus other utilities.

Lp3

Medium
Category
MCP Least Privilege
Confidence
84% confidence
Finding
The skill defines operational behavior that reads local files, but it does not declare any explicit tool scope such as permissions or allowed-tools. In agent environments, missing scope boundaries can cause the agent to use broader file-access capabilities than intended, increasing the risk of over-reading sensitive directories when the skill is invoked.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The skill advertises a destructive `--apply` mode for deleting duplicates, but the warning is not sufficiently explicit about permanent deletion semantics and the exact retention rule under failure or edge cases. In a file-management skill, ambiguous destructive behavior can lead users or agents to remove the wrong files, causing data loss.

Rp1

Medium
Category
MCP Rug Pull
Confidence
78% confidence
Finding
The installation instructions reference `npx skills` without pinning a specific version, which creates a supply-chain risk because future or compromised package versions could change behavior or execute untrusted code during installation. This is especially relevant for agent skills because users may copy-paste install commands directly from the documentation.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The argument parser description and help text are written in Chinese, and the tool's runtime messages continue in Chinese-only output. This imposes a specific language on users without opt-in or any indication that the skill is intentionally limited to a Chinese-speaking context.

Description-Behavior Mismatch

Low
Confidence
87% confidence
Finding
The manifest and Chinese README describe a duplicate file finder that uses dry-run by default and deletes extras only with --apply. In contrast, the English README line says 'One command for daily file/text chores,' which suggests a broader text-processing utility rather than a duplicate-file finder, creating a mild intent/behavior mismatch in the documented scope.

Intent-Code Divergence

Low
Confidence
87% confidence
Finding
The manifest description and summary state concrete runtime behavior: duplicate detection via size→first block→full SHA1 and optional deletion with --apply. However, the analyzed file is only documentation and contains no code implementing those operations, so the embedded claims are not supported by this file's actual contents.

Natural-Language Policy Violations

Low
Confidence
93% confidence
Finding
The natural-language instructions, warnings, and operational guidance are all in Chinese, while the skill does not state that it is intended only for Chinese-speaking users or offer an alternative language. This can violate language/locale policy where user-facing skills should not force a specific language without opt-in.

Natural-Language Policy Violations

Low
Confidence
86% confidence
Finding
The manifest sets the category to the Chinese label "效率工具", which is a language-specific user-facing value. There is no indication in this file that the skill is region-specific or that users can opt into this locale, so it may violate language/locale policy expectations.

Static analysis

No suspicious patterns detected.