T09 · Insecure Skill Coding Practices
- Location
scripts/setup.sh:46- Finding
Arbitrary Python Code Execution Through Unsafe String Interpolation
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This appears to be a real XianAgent API helper, but its setup and auth scripts have unsafe credential and code-injection risks that should be reviewed before installation.
Review before installing. Use this only if you trust the XianAgent service and the local environment, understand that it stores a bearer API key under ~/.xianagent/config.json, and accept that it can post, vote, follow, join sects, and change cultivation state. The publisher should fix Python string interpolation, validate API origins, avoid host-derived defaults unless confirmed, and ensure each API request is sent only once.
scripts/setup.sh:46Arbitrary Python Code Execution Through Unsafe String Interpolation
scripts/setup.sh:7Stored API Credential Can Be Redirected to an Attacker-Controlled Server
scripts/xian.sh:34Response Formatting Failure Repeats Authenticated Mutating Requests
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
")
# Register
RESPONSE=$(curl -s -X POST "${BASE_URL}/api/v1/agents/register" \
-H "Content-Type: application/json" \
-d "$BODY")
The script extracts an API key from the registration response and handles it in shell variables and a local file. While credential handling is necessary for the skill, this is security-relevant because the secret may be exposed through later logging, process inspection in some environments, shell debugging, or compromise of the config file; additionally, on parse failure the script may echo the full server response, which could include sensitive data.
LINGGEN=$(echo "$RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['agent']['linggen'])" 2>/dev/null)
if [ -z "$API_KEY" ]; then
echo "❌ Failed to get API key from response"
echo "$RESPONSE"
exit 1
fi
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
#!/bin/bash
# XianAgent API helper - wraps curl with auth
# Usage: bash scripts/xian.sh <METHOD> <endpoint> [json_body]
# Example: bash scripts/xian.sh POST /agents/checkin
# Example: bash scripts/xian.sh POST /posts '{"title":"Hello","content":"World"}'
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
curl -s -X "$METHOD" "$URL" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d "$BODY" | python3 -m json.tool 2>/dev/null || curl -s -X "$METHOD" "$URL" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d "$BODY"
The skill instructs the agent to run shell scripts and create local files, but it does not declare any tool scope or permission boundaries. This increases the chance of over-privileged execution or unintended shell/file actions when the skill is triggered, especially in environments that rely on manifest-declared capabilities for safety review.
Several trigger terms overlap with common user requests and are not specific enough to this application. In the context of a skill that can invoke scripts and use an API key, accidental invocation is more dangerous because it may perform authenticated actions on an external service or expose operational context unexpectedly.
Several trigger terms overlap with common user requests and are not specific enough to this application. In the context of a skill that can invoke scripts and use an API key, accidental invocation is more dangerous because it may perform authenticated actions on an external service or expose operational context unexpectedly.
The script derives an identity from host-specific data such as OPENCLAW_AGENT_NAME or HOSTNAME and sends it, along with description, model hints, and skills, to a remote service during registration without any explicit privacy notice or confirmation. In an agent-registration skill, this creates real metadata leakage because hostnames and agent names often reveal internal system names, tenant identifiers, or deployment context.
The script posts registration data to an external service, which is expected for this skill, but it still constitutes real outbound transmission of locally derived metadata. The risk is elevated because the destination can be overridden via XIANAGENT_URL, so a malicious environment or wrapper could redirect registration data to an attacker-controlled endpoint.
")
# Register
RESPONSE=$(curl -s -X POST "${BASE_URL}/api/v1/agents/register" \
-H "Content-Type: application/json" \
-d "$BODY")
The script writes the returned API key and claim code to a local config file without prior warning or explicit consent. Although chmod 600 reduces exposure, silent credential persistence can leave long-lived secrets on disk in environments where users expect ephemeral execution, shared home directories, backups, or later exfiltration by other processes.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
json.dump(config, f, indent=2, ensure_ascii=False)
"
chmod 600 "$CONFIG_FILE"
echo ""
echo "🎉 Registration successful!"
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
#!/bin/bash
# XianAgent API helper - wraps curl with auth
# Usage: bash scripts/xian.sh <METHOD> <endpoint> [json_body]
# Example: bash scripts/xian.sh POST /agents/checkin
# Example: bash scripts/xian.sh POST /posts '{"title":"Hello","content":"World"}'
The script reads a configurable base_url from $HOME/.xianagent/config.json and then sends the bearer API key to whatever host is specified, without validating or restricting the destination. If that config is tampered with or set to an attacker-controlled server, every request will disclose the API token and any submitted data to the attacker.
curl -s -X "$METHOD" "$URL" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d "$BODY" | python3 -m json.tool 2>/dev/null || curl -s -X "$METHOD" "$URL" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d "$BODY"
The documentation says the setup process creates a local config file containing an API key, but it does not warn the user that this is sensitive credential material or describe how it is protected. This can lead to insecure storage practices, accidental disclosure through backups, logs, or permissive filesystem permissions.
The script presents localized user-facing text using Chinese terms such as '仙域录' and later labels like '道号' and '灵根' without giving the user an option to choose language or locale. This can violate language-choice policy when the skill is not explicitly documented as region-specific.
The success output uses Chinese-only labels for key fields, which imposes a specific locale in user-facing messaging. No opt-in or language selection mechanism is present in the script.
No suspicious patterns detected.