Back to skill

Security audit

Dataset Splitter

Security checks for vulnerabilities and agentic risk

Overview

This dataset splitter appears purpose-aligned, but its default split operation moves users' image and label files and can overwrite or partially relocate data without a clear warning.

Review this skill before installing if you care about preserving original datasets. Use `--copy`, run it on backups, and choose an empty output directory; otherwise the default split can move files out of the source folder and may leave a partially modified dataset if it fails.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/splitter.py:147
Finding
Destructive Default File Moves with Unchecked Destination Overwrites## Vulnerability Details **File Location**: `scripts/splitter.py:147-170` **Vulnerability Type**: Unsafe file operations and destructive default behavior **Risk Level**: Medium ```python def process_files(files, dest_dir, src_ann_dir=None, dest_ann_dir=None): count = 0 for img_path in files: img_name = Path(img_path).name if args.copy: dest_path = os.path.join(dest_dir, img_name) shutil.copy2(img_path, dest_path) else: dest_path = os.path.join(dest_dir, img_name) shutil.move(img_path, dest_path) # Process annotations if args.annotations and src_ann_dir and dest_ann_dir: ann_name = Path(img_path).stem + ".txt" src_ann = Path(src_ann_dir) / ann_name if src_ann.exists(): dest_ann = Path(dest_ann_dir) / ann_name if args.copy: shutil.copy2(src_ann, dest_ann) else: shutil.move(src_ann, dest_ann) count += 1 ``` ### Technical Analysis The split operation moves source images and associated annotations unless the user explicitly supplies the `--copy` option. The implementation performs no destination collision check, non-empty-directory check, overwrite confirmation, dry run, transactional staging, or rollback. Both `shutil.move()` and `shutil.copy2()` can replace an existing destination file when the destination resolves to an existing filename. Consequently, repeated executions, an incorrectly selected output directory, or pre-positioned files with matching names can cause existing output content to be silently replaced. Because files are processed sequentially, an exception during execution can leave the source and destination datasets in a partially modified state. ### Attack Path 1. A user invokes the documented split command without `--copy`, ...[truncated 1241 chars]
Remediation
## Remediation Suggestions - Make copying the safe default and require an explicit `--move` option for destructive behavior. - Before processing, validate that the source exists, the destination is distinct from the source, and every destination path remains inside the intended output directory. - Reject non-empty output directories by default. Add an explicit `--overwrite` option if replacement is intentionally required. - Precompute all source and destination paths and detect filename collisions before performing any mutation. - Add a `--dry-run` mode that lists planned copies, moves, and conflicts. - Stage files in a temporary output directory and atomically rename the completed dataset into place only after all operations succeed. - If moving files is supported, maintain an operation journal and implement rollback for failures. - Validate split ratios before file operations, requiring non-negative values whose sum is exactly 100. - Clearly warn users before destructive operations and request confirmation in interactive use.
Vulnerability Patterns
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (3)

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill documents `--copy` as an option, which implies the default behavior may move or reorganize files, but it does not clearly warn users that source datasets could be altered. In a data-preparation workflow, this can lead to unintended modification or loss of original training data, especially when users assume tools are non-destructive by default.

Intent-Code Divergence

Medium
Confidence
94% confidence
Finding
The script presents itself as a dataset splitter, but its default behavior modifies the source dataset by moving images and annotations rather than copying them. In an agent or automation context, this mismatch can cause unintended destruction or relocation of original training data, especially when users reasonably expect a non-destructive split operation.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
The CLI defaults to moving files unless --copy is supplied, yet there is no upfront warning that running the split command will alter the original dataset. This is dangerous because automated or unsuspecting users may permanently reorganize or partially lose source data, and downstream pipelines may fail when expected input paths disappear.

Static analysis

No suspicious patterns detected.