T09 · Insecure Skill Coding Practices
- Location
scripts/ima_image_create.py:148- Finding
IMA API Key Exposed Through URL Query Parameters
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill mostly matches its image-generation purpose, but it needs review because confirmed implementation choices can expose API keys, prompts, image references, and local preferences more broadly than users are told.
Install only if you are comfortable sending prompts, selected input images, and an IMA API key to IMA services. Use a scoped or low-quota test key, avoid sensitive prompts or private images, do not set custom base URLs unless you control them, and review or clear ~/.openclaw logs and preferences after use.
scripts/ima_image_create.py:148IMA API Key Exposed Through URL Query Parameters
scripts/ima_image_create.py:1278Unrestricted Endpoint Overrides Permit Credential and Image Exfiltration
scripts/ima_image_create.py:714Sensitive Prompts and Image References Can Be Persisted in Error Logs
scripts/ima_image_create.py:1208User Preferences Are Persisted Without the Declared Explicit-Consent Condition
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
"Check the IMA dashboard for status."
)
resp = requests.post(url, json={"task_id": task_id},
headers=headers, timeout=30)
resp.raise_for_status()
data = resp.json()
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
**Data control:**
- ✅ **View stored data**: `cat ~/.openclaw/memory/ima_prefs.json`
- ✅ **Delete preferences**: `rm ~/.openclaw/memory/ima_prefs.json` (resets to defaults)
- ✅ **Delete logs**: `rm -rf ~/.openclaw/logs/ima_skills/` (auto-cleanup after 7 days anyway)
### ⚠️ Advanced Users: Fork & Modify
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
**Data control:**
- ✅ **View stored data**: `cat ~/.openclaw/memory/ima_prefs.json`
- ✅ **Delete preferences**: `rm ~/.openclaw/memory/ima_prefs.json` (resets to defaults)
- ✅ **Delete logs**: `rm -rf ~/.openclaw/logs/ima_skills/` (auto-cleanup after 7 days anyway)
### ⚠️ Advanced Users: Fork & Modify
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
**Data control:**
- ✅ **View stored data**: `cat ~/.openclaw/memory/ima_prefs.json`
- ✅ **Delete preferences**: `rm ~/.openclaw/memory/ima_prefs.json` (resets to defaults)
- ✅ **Delete logs**: `rm -rf ~/.openclaw/logs/ima_skills/` (auto-cleanup after 7 days anyway)
### ⚠️ Advanced Users: Fork & Modify
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
**Data control:**
- ✅ **View stored data**: `cat ~/.openclaw/memory/ima_prefs.json`
- ✅ **Delete preferences**: `rm ~/.openclaw/memory/ima_prefs.json` (resets to defaults)
- ✅ **Delete logs**: `rm -rf ~/.openclaw/logs/ima_skills/` (auto-cleanup after 7 days anyway)
### ⚠️ Advanced Users: Fork & Modify
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.
### ⚠️ Advanced Users: Fork & Modify
If you need to modify this skill for your use case:
1. **Fork the repository** (don't modify the original)
2. **Update your fork** with your changes
3. **Test thoroughly** with limited API keys
This code does not perform the declared primary function of AI image generation. Instead, it provides ancillary logging functionality, including creating directories, writing rotating log files, and deleting old logs. Those file-system behaviors are not reflected in the declared permissions, and the actual behavior shown is materially different from the advertised end-user capability. While logging can be a supporting detail in a larger image-generation skill, the supplied code chunk itself does not implement or demonstrate any image generation functionality, so the description does not accurately represent what this code actually does.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
args = build_parser().parse_args()
base = args.base_url
# Get API key from args or environment variable
apikey = args.api_key or os.getenv("IMA_API_KEY")
if not apikey:
logger.error("API key is required. Use --api-key or set IMA_API_KEY environment variable")
The keyword list is extremely broad and repetitive, with many generic triggers such as 'AI image generator', 'thumbnail generator', and 'image generator' that can match a wide range of unrelated user intents. In a routing or invocation system, this can cause the skill to be selected too often, overshadow more appropriate skills, and increase the chance that image-generation capabilities are invoked in unintended contexts.
The instruction 'Match the user's language (Chinese/English)' imposes a language constraint in the skill's natural-language behavior. Because it does not offer a broader language choice or explain a justified region-specific limitation, it can violate the language/locale policy requirement.
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
**v1.3 enhancement:**
- Step 3 caption now includes original image URL
- Users can easily copy/share the link without asking
---
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
**Both domains are owned by IMA Studio**, but if you're concerned about credential exposure:
✅ **Best practices:**
- Use a **test/scoped API key** for initial testing (create at https://imastudio.com/api-keys)
- Set a low quota (e.g., 100 credits) for the test key
- Rotate your key after testing if needed
- Contact IMA support to confirm domain ownership: support@imastudio.com
The documentation makes a strong privacy claim that user_id is never transmitted to IMA servers while simultaneously instructing agents to pass --user-id into the bundled script. Without code in this file proving local-only handling, operators may be misled about what identifiers are shared, creating a privacy and trust risk if the script forwards or logs that value remotely.
The manifest describes a unified tool for AI image and photo generation, specifically text-to-image and image-to-image workflows. In the FAQ, the skill instructs users to use video models such as Wan 2.6 and extract the first frame as an image, which is a materially different capability outside the described image-generation scope.
An image generator skill can reasonably upload images, poll tasks, and return generated images, but advising use of separate video models introduces a new modality and workflow not necessary for the skill's declared purpose. This is context-inappropriate because the manifest does not claim any video-generation support.
This code performs external transmission of prompts, model parameters, and authenticated requests to a third-party service. In context, that is the skill's intended function, but it is still security-relevant because sensitive user content and API credentials leave the local environment and are exposed to an external provider.
"parameters": nested_params,
}],
}
r = requests.post(f"{BASE_URL}/open/v1/tasks/create", headers=HEADERS, json=body)
r.raise_for_status()
return r.json()["data"]["id"]
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
def poll(task_id: str, interval: int = 3, timeout: int = 300) -> dict:
deadline = time.time() + timeout
while time.time() < deadline:
r = requests.post(f"{BASE_URL}/open/v1/tasks/detail", headers=HEADERS, json={"task_id": task_id})
r.raise_for_status()
task = r.json()["data"]
medias = task.get("medias", [])
Without declared permissions the skill's intent is opaque and cannot be validated.
Line L164 hard-codes x_app_language: en, which imposes a specific language/locale behavior. The file does not state that this is optional, user-selected, or required for a region-specific purpose, so it conflicts with the policy against forcing a language without opt-in.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
f"credit={credit}, attribute_id={attribute_id}")
try:
resp = requests.post(url, json=payload, headers=headers, timeout=30)
resp.raise_for_status()
data = resp.json()
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
f"credit={credit}, attribute_id={attribute_id}")
try:
resp = requests.post(url, json=payload, headers=headers, timeout=30)
resp.raise_for_status()
data = resp.json()
User preference data is written to disk without any user-facing notice in this file, which can violate expectations about data handling in an image-generation tool. In agent or shared-system deployments, silent persistence may expose usage history and model choices tied to a user identifier, increasing privacy and compliance risk.
The dependency is specified as requests>=2.25.0, which allows installation of many different future or environment-dependent versions rather than a known-reviewed release. This weakens build reproducibility and can inadvertently pull in a vulnerable or incompatible version of requests, especially given the package's history of advisories.
# Python dependencies for ima-ai-image-photo-generator skill
# Install with: pip install -r requirements.txt
requests>=2.25.0
Because the manifest does not pin the requests version, it is impossible to verify whether deployments will receive a release affected by one of the known advisories. In a network-facing skill that likely fetches remote resources or interacts with external services, an affected requests version could expose credentials, weaken TLS-related guarantees, or introduce other client-side request handling issues.
The code defines a persistent preferences path under the user's home directory and later reads/writes it for convenience features unrelated to strict task execution. This broadens the skill's data footprint beyond core image generation and can expose user-associated metadata to other local processes or users if filesystem permissions are weak.
Detected: suspicious.destructive_delete_command