T09 · Insecure Skill Coding Practices
- Location
scripts/audit-structure.sh:10- Finding
Arbitrary Shell Command Execution Through Unsafe Configuration Loading
- Content
View full analysis
Vulnerability Details
File Location:
scripts/audit-structure.sh, lines 10–14
Vulnerability Type: Unrestricted execution of a configuration file as Bash code
Risk Level: HighVulnerable Code
bash CONF="${AUDIT_CONFIG:-$SKILL_DIR/audit.conf}" # Load custom limits if config exists if [ -f "$CONF" ]; then # shellcheck source=/dev/null source "$CONF" fiTechnical Analysis
The script documents
audit.confas a data-only configuration file containing numeric size limits. However, Bash'ssourcecommand does not parse the file as data; it executes every statement in the file in the current shell process.Consequently, any command placed in the selected configuration file runs with the privileges and environment of the user or Agent invoking the audit. The risk is increased because the
AUDIT_CONFIGenvironment variable can select an arbitrary readable file. The script performs no path restriction, ownership or permission validation, key allowlisting, value validation, or rejection of executable shell syntax.This issue is classified as
T09: Insecure Skill Coding Practicesbecause an unsafe configuration-loading mechanism creates a direct command-execution vulnerability. There is no evidence that the project itself supplies a malicious configuration file.Attack Path
- An attacker gains the ability to create or modify the default
audit.confin the Skill directory, or influence theAUDIT_CONFIGenvironment variable used when the audit runs. - The attacker places arbitrary shell commands in the selected file, for example:
bash AGENTS_LIMIT=1000 attacker_controlled_command - A user or Agent runs
scripts/audit-structure.sh, directly or throughscripts/audit-all.sh. - The script confirms only that the selected path is a regular file.
source "$CONF"executes the attacker's commands in the audit process.- The commands inherit the invo ...[truncated 922 chars]
- An attacker gains the ability to create or modify the default
- Remediation
View remediation
Remediation Suggestions
- Remove
source "$CONF"and treat the configuration strictly as data. - Accept only an explicit allowlist of supported keys:
AGENTS_LIMITSOUL_LIMITUSER_LIMITIDENTITY_LIMITTOOLS_LIMITHEARTBEAT_LIMITMEMORY_LIMIT
- Validate every value against a strict decimal-integer expression such as
^[0-9]+$, then enforce reasonable minimum and maximum bounds. - Reject unknown keys, duplicate assignments, command substitutions, shell expansions, redirections, and other shell syntax.
- Prefer a non-executable format such as JSON parsed with Python's standard library, which is already a declared runtime requirement.
- If
AUDIT_CONFIGmust remain configurable, resolve it to a canonical path and restrict it to an approved directory. Validate that it is a regular file, is not a symbolic link, and has trusted ownership and permissions. - Run the audit under a least-privileged account without unnecessary secrets in its environment.
A safe parser should read each permitted assignment as text and assign validated values without
eval,source, or equivalent dynamic execution.- Remove
