T09 · Insecure Skill Coding Practices
- Location
SKILL.md:211- Finding
Predictable Temporary Files Expose Manifests to Disclosure and Symlink-Based File Clobbering
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 211–213
Vulnerability Type: Predictable and insecure temporary-file handling
Risk Level: MediumVulnerable Code
bash # Extract rendered manifests argocd app manifests <app-name> --source live > /tmp/live-manifests.yaml argocd app manifests <app-name> --source git > /tmp/git-manifests.yamlTechnical Analysis
The documented commands write rendered Kubernetes manifests to fixed paths in the shared
/tmpdirectory. They do not securely create the files, restrict their permissions, verify that the destinations are regular files, or remove them after use.Shell output redirection opens the destination with truncation and ordinarily follows symbolic links. A local attacker able to create files in
/tmpcan therefore pre-create/tmp/live-manifests.yamlor/tmp/git-manifests.yamlas a symbolic link to another file writable by the account running the Skill. When the command executes, the linked file may be truncated and replaced with manifest data.Rendered manifests may contain Kubernetes
Secretobjects, environment variables, internal service addresses, repository details, security settings, or other operationally sensitive configuration. Depending on the process umask and local environment, fixed output files may also be readable by other users and remain available after the analysis ends.Attack Path
- A local attacker predicts the fixed temporary path, such as
/tmp/live-manifests.yaml. - Before the analysis runs, the attacker creates that path as a symbolic link to a file writable by the Skill's operating-system account.
- The operator follows the Skill instructions and runs the manifest extraction command.
- Shell redirection follows the symbolic link and truncates or overwrites the linked target with rendered Kubernetes manifests.
- Alternatively, if the resulting temporary file has permissive permis ...[truncated 1015 chars]
- A local attacker predicts the fixed temporary path, such as
- Remediation
View remediation
Remediation Suggestions
- Create a private temporary directory with
mktemp -drather than using predictable filenames. - Set
umask 077before creating files so only the current operating-system user can access them. - Register a cleanup trap to remove the directory and its contents on normal exit, interruption, or failure.
- Avoid storing rendered manifests when possible; stream command output directly into the required analysis tool.
- Run the analysis under a dedicated, least-privileged account and avoid running it as
root. - Treat all rendered manifests as sensitive because they may include Secret resources or credentials.
- If files must be retained, use a protected directory with explicit ownership and mode
0600, and establish a defined retention policy.
Example hardened pattern:
bash umask 077 tmpdir="$(mktemp -d)" || exit 1 trap 'rm -rf -- "$tmpdir"' EXIT HUP INT TERM argocd app manifests "$app_name" --source live > "$tmpdir/live-manifests.yaml" argocd app manifests "$app_name" --source git > "$tmpdir/git-manifests.yaml"- Create a private temporary directory with
