T09 · Insecure Skill Coding Practices
- Location
scripts/build-claw-xiaoai-prompt.mjs:6- Finding
Raw User Requests Persisted in Plaintext Without Minimum-Permission Controls
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is mostly coherent as a character selfie generator, but it quietly saves recent user request details locally and exposes broad file-write behavior that should be reviewed before install.
Install only if you are comfortable with a persona skill that sends image prompts to ModelScope, saves continuity state under ~/.openclaw, and may generate images from broad conversational triggers; prefer clearing the state file, using narrowly scoped output paths, and avoiding private details in selfie requests.
scripts/build-claw-xiaoai-prompt.mjs:6Raw User Requests Persisted in Plaintext Without Minimum-Permission Controls
scripts/generate-selfie.mjs:14Unrestricted Output Path Allows Overwriting Arbitrary User-Writable Files
Referenced artifact was not completely inspected
printf '%s' "<prompt>" | node scripts/generate-selfie.mjs --prompt-stdin --out /tmp/claw-xiaoai-selfie.jpg
Referenced artifact was not completely inspected
printf '%s' "<prompt>" | node scripts/generate-selfie.mjs --prompt-stdin --out /tmp/claw-xiaoai-selfie.jpg
Referenced artifact was not completely inspected
printf '%s' "<prompt>" | node scripts/generate-selfie.mjs --prompt-stdin --out /tmp/claw-xiaoai-selfie.jpg
Referenced artifact was not completely inspected
printf '%s' "<prompt>" | node scripts/generate-selfie.mjs --prompt-stdin --out /tmp/claw-xiaoai-selfie.jpg
Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.
const sceneTag=detectSceneTag(text);
const mappedScene=sceneTag ? PROMPT_SCENE_BY_TAG[sceneTag] : undefined;
if(mappedScene) return mappedScene;
if(slotInfo.slot === 'weekend-day' && isWeekend) return PROMPT_SCENE_BY_TAG[resolveWeekendDaySceneTag(hour, text)];
if(hasRelativeInstruction(text)) return state.scene || slotInfo.scene;
return slotInfo.scene;
}
The retry prompt hard-codes a protected/sensitive demographic attribute ('East Asian ethnicity') and gender constraints into image-generation instructions. This is dangerous because it bakes demographic profiling and identity coercion into outputs without user awareness, increasing the risk of biased, non-consensual, or discriminatory content generation, especially in a persona-based companion skill.
The skill documents access to environment variables, local config, and a network-backed image generation flow, but it does not declare an explicit tool/permission scope. That creates an authorization transparency gap: a host or reviewer cannot easily tell what capabilities the skill expects, making overbroad execution or accidental secret exposure more likely.
The trigger mapping uses broad conversational phrases like 'What are you doing?' and 'Where are you?' to initiate photo/selfie behavior, which can cause the agent to generate and send images when the user may only want a text response. In a companion persona that simulates current activity, location, outfit, or mood, this increases the risk of unintended media generation and deceptive or privacy-sensitive behavior.
The instruction to "Prefer clean English prompt blocks for persona definitions" imposes a language preference as a policy choice in the skill's natural-language guidance. The file does not offer the user a language choice or explain why English is required for a region-specific or technical reason.
The examples prescribe output captions entirely in Chinese, while the file presents them as the target caption style without any opt-in or alternative language handling. This creates a natural-language locale policy concern because the skill appears to enforce a specific language rather than letting the user choose.
The prompt directs the persona to respond primarily in Chinese regardless of the user's language preference, which can override user intent and reduce transparency or safe use in multilingual contexts. While not a direct security exploit, hard-coded language behavior can degrade user control and make safety-critical guidance less accessible if the user expects another language.
The selfie trigger list is intentionally broad and maps ordinary phrases like 'what are you doing' or 'where are you' to image-generation behavior. In a live agent, this can cause unexpected modality switching and implicit consent issues, where normal conversational prompts are interpreted as requests for personal-looking images or location/context disclosures.
The code loads an API key-backed runtime and makes authenticated requests to a third-party image generation service. For a skill described only as an energetic intern companion, this networked media-generation capability is not an obvious or declared requirement.
The manifest description presents the skill as a character-style companion, not as an image-generation utility. This script submits prompts to a remote image generation API, polls task status, downloads the generated image, and writes it locally, which is a materially different operational scope from a conversational companion description.
The script creates directories and writes the generated image to the filesystem, but provides no prior warning, confirmation, or explanatory comment/docstring about this file write behavior. Under the code-file criteria, file writes should have some visible disclosure unless clearly documented elsewhere in the skill description, which is not present in this file.
The script persists conversational and inferred state to a file under the user's home directory without any user-facing notice, consent prompt, or protective controls. Because the saved state includes prior requests, scene, pose, clothing, and timestamps, it creates a privacy risk and unintended retention of potentially sensitive user interaction data on disk.
The script explicitly uses Intl.DateTimeFormat('en-GB', ...), which imposes a specific language/locale choice in behavior. Under the policy, locale constraints should be user-selectable or clearly justified as region-specific; neither is indicated here.