T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:122
- Finding
- Unreliable Reference Image Discovery Can Expose Unrelated Private Media<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:122-130` **Vulnerability Type**: Reference confusion and unintended data disclosure **Risk Level**: Medium ### Vulnerable Code ```markdown **Also capture local file paths of the reference images:** ```bash ls -t1 ~/.openclaw/media/inbound/ | head -20 ``` The N most recently listed files (where N = number of images the user sent) are the reference images. Store their full absolute paths in `CREATIVE_BRIEF.reference_images`. Example entry: `/Users/inimene/.openclaw/media/inbound/file_6---abc123.jpg` ``` ### Technical Analysis The skill determines which images belong to the current request by listing a shared inbound-media directory and selecting its most recently modified entries. File modification order does not establish that a file belongs to the current user, message, or pipeline session. Concurrent uploads, stale files with updated timestamps, or files deliberately placed in the inbound directory can therefore be mistaken for current reference images. The selected paths are subsequently passed to the image-generation workflow. The resulting generated image may also be sent to the external Gemini critique API, potentially propagating visual information derived from the incorrectly selected reference. There is no documented validation of file ownership, session association, expected filename, MIME type, or canonical path. ### Attack Path 1. A victim submits an image-generation request containing one or more reference images. 2. Before the skill runs its directory listing, another process or user places a sensitive or attacker-selected image in `~/.openclaw/media/inbound/`, or updates an existing file's timestamp. 3. The command sorts the directory by modification time and treats the newest entries as the victim's references. 4. The unrelated image path is stored in `CREATIVE_BRIEF.reference_images`. 5. The image is sent to the configured generation service as an input. 6. A generated deriva ...[truncated 472 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Obtain attachment paths exclusively from trusted metadata associated with the current message and session. - Do not infer attachment identity from directory modification times. - Bind each selected file to a user, conversation, and request identifier. - Canonicalize each path and require it to reside within the expected media directory. - Validate that each reference is a regular, non-symlink image file with an allowed MIME type and size. - Reject files that are not explicitly associated with the current request. - Present the selected references for confirmation before transmitting them to an external service when reliable attachment metadata is unavailable. - Clearly disclose which external services receive image data and obtain user consent where required. ]]>
