T09 · Insecure Skill Coding Practices
- Location
scripts/setup.sh:14- Finding
Root Command Injection Through Unsafe sed Interpolation
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a disclosed AICash miner, but it installs persistent root-level services and stores credentials insecurely.
Review this before installing. Use only on a dedicated machine where continuous mining, network traffic, and boot-persistent services are intended. Do not pass untrusted endpoint, API key, wallet, name, or instance values. Prefer fixing the scripts first so credentials are stored in a protected config, the service runs under a dedicated unprivileged user, instance counts and service names are validated, and start/stop operations target exact owned units.
scripts/setup.sh:14Root Command Injection Through Unsafe sed Interpolation
scripts/setup.sh:110Persistent Miner Service Runs With Unnecessary Root Privileges
scripts/setup.sh:42Plaintext API Key Is Persisted and Sent to an Unrestricted Endpoint
scripts/setup.sh:19Unbounded Creation of Boot-Persistent Mining Services
scripts/start.sh:2Lifecycle Scripts Can Control Unrelated Services Through Substring Matching
Referenced artifact was not completely inspected
scripts/setup.sh --api-key <KEY> --wallet <WALLET> --endpoint <ENDPOINT>
Referenced artifact was not completely inspected
scripts/setup.sh --api-key <KEY> --wallet <WALLET> --endpoint <ENDPOINT>
Referenced artifact was not completely inspected
scripts/setup.sh --api-key <KEY> --wallet <WALLET> --endpoint <ENDPOINT>
The script embeds the API key, wallet, and endpoint directly into /root/.openclaw/workspace/aicash/miner.js via string substitution, causing long-lived credential persistence on disk. Any later file read, backup, log collection, or compromise of the host exposes the secrets, and there is no warning or safer secret-handling path despite this running as root.
The skill advertises automation that will use environment-derived secrets and perform system-level actions, but it declares no tool scope or permission boundaries. In an agent setting, missing explicit permissions increases the chance that the skill can access credentials or execute setup behavior without clear user consent or policy enforcement.
The skill requests sensitive inputs including an API key, wallet address, and mining endpoint, but it does not include warnings about secure handling, storage, logging, or exposure risk. In combination with automated setup and 24/7 operation, poor credential hygiene could leak secrets, expose wallet-linked activity, or connect users to untrusted endpoints.
The skill instructs users to run a setup script that creates and starts persistent systemd mining services, but this side effect is not prominently disclosed as a warning. That is dangerous because users may unknowingly install long-running background processes that consume resources, survive session end, and are harder to notice or remove.
The script creates systemd unit files under /etc/systemd/system and immediately enables and starts them without any explicit confirmation. This establishes privileged, boot-persistent execution that can survive the initial setup and continue making network requests indefinitely, increasing the blast radius if the miner or endpoint is malicious or misconfigured.
The use of systemctl enable --now makes the miner auto-start immediately and on future boots, creating persistence. In the context of an unvetted crypto-mining skill running as root, persistence is more dangerous because it maintains ongoing resource consumption and network activity even after the user may think setup is complete.
for i in $(seq 1 "$INSTANCES"); do
SVC_NAME="${NAME}"
[[ $i -gt 1 ]] && SVC_NAME="${NAME}-${i}"
systemctl enable --now "${SVC_NAME}" 2>&1 | grep -v "Created symlink"
echo "Started: ${SVC_NAME}"
done
The script enumerates all systemd services whose unit names contain "aicash-miner" and runs systemctl enable --now on them, causing immediate execution and persistence across reboots. In the context of a crypto-mining skill, establishing automatic startup is a strong persistence mechanism that can keep unwanted mining or other payloads running continuously, especially if a similarly named rogue service already exists on the host.
#!/bin/bash
for svc in $(systemctl list-units --type=service --all --no-legend | grep "aicash-miner" | awk '{print $1}'); do
systemctl enable --now "$svc" 2>/dev/null
echo "Started: $svc"
done
No suspicious patterns detected.