T09 · Insecure Skill Coding Practices
- Location
SKILL.md:43- Finding
Generated Symbolic chmod Commands Fail to Remove Unrequested Permissions
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 43–48
Vulnerability Type: Inexact permission enforcement through additive chmod operations
Risk Level: MediumVulnerable Code Snippet:
markdown ### Symbolic chmod command format Build clauses for each entity with permissions set: - `u` = owner, `g` = group, `o` = others - Emit `{entity}+{perms}` for each entity that has any permissions - Special bits: `u+s` (setuid), `g+s` (setgid), `+t` (sticky)Technical Analysis
The Skill instructs the agent to generate symbolic
chmodcommands using additive (+) clauses and to omit entities that have no requested permissions. Additive clauses only enable specified permission bits; they do not remove permissions that are already present.As a result, the generated symbolic command does not necessarily produce the numeric mode or symbolic state advertised by the Skill. For example, the documented conversion for mode
640generates:shell chmod u+rw,g+r filenameIf the target begins with mode
777, this command leaves it at777rather than changing it to640. The command does not remove owner execute permissions or any permissions assigned to others. Existing setuid, setgid, and sticky bits may also remain enabled when they were not requested.This creates a security-relevant mismatch between the reported target state and the actual state produced by the symbolic command.
Attack Path
- A sensitive target file already has excessive permissions, such as mode
777, or has an enabled special permission bit. - The user asks the Skill to generate a restrictive permission setting, such as mode
640. - The Skill produces the additive symbolic command
chmod u+rw,g+r filename. - The user executes that command believing it will enforce the advertised mode.
- Existing group, other, execute, setuid, setgid, or sticky bits that were not explicitly removed remain active.
...[truncated 839 chars]
- A sensitive target file already has excessive permissions, such as mode
- Remediation
View remediation
Remediation Suggestions
Generate exact-state symbolic commands with assignment (
=) rather than additive (+) operations. Include all three entities even when an entity should have no permissions. For example, mode640should produce:shell chmod u=rw,g=r,o= filenameEnsure that unrequested special bits are explicitly cleared, or state that the numeric command is the authoritative exact-state command. If symbolic commands remain supported, document and implement deterministic handling for setuid, setgid, and sticky bits.
Add tests that apply generated commands to targets with pre-existing permissive and special modes, including transitions from
777,4755,2755, and1755to restrictive modes. Verify the resulting mode withstatrather than checking only the generated command text.
