Back to skill

Security audit

Colorlab

Security checks for vulnerabilities and agentic risk

Overview

ColorLab is a coherent color utility, but its shell script has a verified command-injection weakness in numeric arguments.

Review before installing or using with untrusted color/count input. The skill appears intended as a normal local color helper and shows no persistence or data exfiltration, but the shell script should validate decimal integer arguments and bound counts before release.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/script.sh:79
Finding

Command Injection Through Unvalidated Numeric Arguments

Content
View full analysis
255)v=255; print v }") ng=$(awk "BEGIN { v = int($g + ($i * (255 - $g) / ($count + 1))); if(v<0)v=0; if(v>255)v=255; print v }") nb=$(awk "BEGIN { v = int($b + ($i * (255 - $b) / ($count + 1))); if(v<0)v=0; if(v>255)v=255; print v }") ``` ```bash # Lines 204–209 local count="${1:-1}" echo -e "${BOLD}Random Colors (${count}):${NC}" echo "" local i for (( i = 0; i < count; i++ )); do ``` ### Technical Analysis The `rgb-to-hex`, `palette`, and `random` commands accept arguments that are intended to be decimal integers but do not validate their lexical format before using them in Bash arithmetic contexts. The comparison operators inside `[[ ... ]]` and expressions inside `(( ... ))` interpret their operands as arithmetic expressions. Bash may recursively resolve variable names and evaluate array subscripts in such expressions. Consequently, quoting the parameter expansion does not guarantee that a malicious value is treated as inert text. An input containing an arithmetic expression with a command substitution, such as an array-subscript expression, may cause the command substitution to execute when Bash evaluates the value. The palette implementation also embeds `count` di ...[truncated 1967 chars]
Remediation
View remediation
maximum )); then err "$name must be between 0 and $maximum" exit 1 fi } ``` Apply validation before arithmetic use: ```bash validate_uint "$r" "Red value" 255 validate_uint "$g" "Green value" 255 validate_uint "$b" "Blue value" 255 ``` Define conservative limits for generated output, such as: ```bash validate_uint "$count" "Palette count" 100 validate_uint "$count" "Random color count" 1000 ``` Use the `10#` prefix after validation when performing Bash arithmetic so values are interpreted as decimal rather than octal: ```bash r=$((10#$r)) g=$((10#$g)) b=$((10#$b)) count=$((10#$count)) ``` Do not interpolate values directly into AWK program text. Pass them as data with `-v`: ```bash nr=$(awk -v r="$r" -v i="$i" -v count="$count" 'BEGIN { v = int(r + (i * (255 - r) / (count + 1))) if (v < 0) v = 0 if (v > 255) v = 255 print v }') ``` Add automated negative tests covering nonnumeric strings, arithmetic expressions, array-subscript expressions, negative values, leading-zero values, excessive counts, and values above the documented bounds. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep

Static analysis

No suspicious patterns detected.