T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/collect-photos.sh:31
- Finding
- Photo Collection Exceeds the Declared Monthly Date Range## Vulnerability Details **File Location**: `scripts/collect-photos.sh:31-36` and `SKILL.md:31-39` **Vulnerability Type**: Excessive collection of private media caused by an incomplete date constraint **Risk Level**: Medium ### Vulnerable Code ```bash # 1. Search for image messages in the group after the given date echo "[collect] Searching for images in $GROUP_JID after $AFTER_DATE..." >&2 MESSAGES_JSON=$(wacli messages search "*" \ --chat "$GROUP_JID" \ --type image \ --after "$AFTER_DATE" \ --limit 100 \ --json 2>/dev/null) ``` The documented invocation only supplies the first day of the previous month: ```bash YEAR_MONTH=$(date -v-1m +%Y-%m) AFTER_DATE="${YEAR_MONTH}-01" OUTPUT_DIR=~/mixtiles-queue/${YEAR_MONTH} bash <skill-dir>/scripts/collect-photos.sh "$MIXTILES_GROUP_JID" "$AFTER_DATE" "$OUTPUT_DIR" ``` ### Technical Analysis The Skill claims to collect photos from the previous month, but the search applies only a lower date bound through `--after`. It does not apply an upper bound corresponding to the first day of the current month. If the pipeline is run after the month changes, the query can return both previous-month images and images posted during the current month. Those additional images may then be downloaded, analyzed by the Agent's vision capability, and selected for upload to Cloudinary through the downstream Mixtiles cart Skill. This is a data-minimization and scope-enforcement flaw. The affected data consists of private images and associated WhatsApp metadata from the configured group. ### Attack Path 1. The monthly pipeline calculates only the first day of the previous month. 2. The collection script searches for every image after that date, without an upper date limit. 3. Group members post private images during the current month. 4. The unrestricted query includes those current-month images among its results. 5. The script downloads the imag ...[truncated 671 chars]
- Remediation
- ## Remediation Suggestions Calculate both the first day of the previous month and the first day of the current month, then pass both bounds to the collection script. Use a supported upper-bound option such as `--before` when invoking `wacli`. In addition, independently parse and validate every returned message timestamp before downloading it. Reject entries whose timestamp does not satisfy the intended half-open interval: ```text previous_month_start <= timestamp < current_month_start ``` The validation should use a consistent timezone and fail closed when a timestamp is absent or malformed. This prevents unexpected `wacli` behavior from expanding the collection scope.
