T09 · Insecure Skill Coding Practices
- Location
scripts/package_skill.py:76- Finding
Time-of-Check to Time-of-Use Race Can Package Files Outside the Skill Root
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is a coherent skill-authoring helper with normal scaffold, validation, and packaging behavior, though users should package only trusted skill directories.
Install is reasonable for users who want Codex help authoring OpenClaw/AgentSkills. Run the packaging script only on skill directories you control, avoid shared or attacker-writable folders, and review generated .skill archives before publishing because the packager has a limited local race-condition risk around file replacement during archive creation.
scripts/package_skill.py:76Time-of-Check to Time-of-Use Race Can Package Files Outside the Skill Root
The skill's declared purpose understates that it covers archive handling, security-related packaging checks, and CLI-style build operations. Underdescribed operational behavior is risky because agents may invoke the skill based on broad editing language while being steered into performing more privileged or irreversible actions.
The skill's declared purpose understates that it covers archive handling, security-related packaging checks, and CLI-style build operations. Underdescribed operational behavior is risky because agents may invoke the skill based on broad editing language while being steered into performing more privileged or irreversible actions.
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.
1. Understand the skill with concrete examples
2. Plan reusable skill contents (scripts, references, assets)
3. Initialize the skill (run init_skill.py)
4. Edit the skill (implement resources and write SKILL.md)
5. Package the skill (run package_skill.py)
6. Iterate based on real usage
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.
If you used `--examples`, delete any placeholder files that are not needed for the skill. Only create resource directories that are actually required.
#### Update SKILL.md
**Writing Guidelines:** Always use imperative/infinitive form.
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.
# Print next steps
print(f"\n[OK] Skill '{skill_name}' initialized successfully at {skill_dir}")
print("\nNext steps:")
print("1. Edit SKILL.md to complete the TODO items and update the description")
if resources:
if include_examples:
print("2. Customize or delete the example files in scripts/, references/, and assets/")
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def test_skips_symlink_to_external_file(self):
skill_dir = self.create_skill("symlink-file-skill")
outside = self.temp_dir / "outside-secret.txt"
outside.write_text("super-secret\n")
link = skill_dir / "loot.txt"
out_dir = self.temp_dir / "out"
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def test_skips_symlink_to_external_file(self):
skill_dir = self.create_skill("symlink-file-skill")
outside = self.temp_dir / "outside-secret.txt"
outside.write_text("super-secret\n")
link = skill_dir / "loot.txt"
out_dir = self.temp_dir / "out"
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def test_skips_symlink_to_external_file(self):
skill_dir = self.create_skill("symlink-file-skill")
outside = self.temp_dir / "outside-secret.txt"
outside.write_text("super-secret\n")
link = skill_dir / "loot.txt"
out_dir = self.temp_dir / "out"
The skill instructs the agent to read and write files, invoke shell commands, and potentially use referenced scripts, but it declares no explicit tool scope or permission boundaries. In a skill that creates and edits other skills, missing scope increases the chance of unintended filesystem or command execution beyond what is necessary.
The trigger phrases are broad enough to match generic requests such as 'review', 'improve', 'clean up', or 'audit', which may cause unintended activation in unrelated contexts. Because this skill includes instructions for file mutation and shell-based workflows, accidental invocation can expose more powerful behavior than the user intended.
This code creates a new directory tree, writes SKILL.md, and may create additional example files under user-supplied locations. Although it prints status messages after actions occur, there is no prior warning, confirmation, or cautionary note in the docstring about making filesystem changes, which is the relevant disclosure for a scaffold-creation script.
No suspicious patterns detected.