-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Description
Summary
The installSkillFiles() function in packages/cli/src/utils/installer.ts does not validate file paths before writing. A malicious skill repository can include files with ../ sequences in their paths, allowing writes to arbitrary locations on disk.
Affected Code
installer.ts:14
const filePath = join(skillDir, file.path);
// file.path is not validated — "../../../etc/crontab" resolves outside skillDirgithub.ts:127 — The source of these paths:
const relativePath = item.path.slice(skillPath.length + 1);
// No validation on relativePath before it becomes file.pathAttack Vector
- Attacker creates a GitHub repository with a skill directory containing a file like
my-skill/../../../.bashrc - The GitHub API tree filter at line 108 (
item.path.startsWith(skillPath + "/")) does NOT block this —my-skill/../../../.bashrcstarts withmy-skill/ relativePathbecomes../../../.bashrcpath.join(skillDir, "../../../.bashrc")resolves to a path outside skillDirwriteFile()overwrites the file with attacker-controlled content
Impact
- Arbitrary file write as the current user
- Can overwrite shell configs, SSH keys, or plant malicious code
- Triggered by installing any untrusted skill
Suggested Fix
- Use
path.resolve()instead ofpath.join()and verify the resolved path starts with the skill directory - Reject paths containing
..at download time as defense-in-depth
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels