T09 · Insecure Skill Coding Practices
- Location
scripts/bootstrap.sh:3- Finding
Executable credential file loaded through Bash source
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This MQTT skill has a real purpose, but it overreaches by subscribing to every broker topic, printing full message contents, and loading credentials through an unsafe shell-sourced .env file.
Review before installing. Use only with a dedicated least-privileged MQTT account, avoid production brokers until the subscription honors a narrow topic, disable raw payload logging, require TLS for non-local connections, and replace shell-sourcing of .env with safe parsing of named configuration keys.
scripts/bootstrap.sh:3Executable credential file loaded through Bash source
scripts/run.py:12Global MQTT subscription exposes and logs unrelated message data
scripts/run.py:10MQTT credentials and messages can be transmitted without TLS
The declared purpose says the skill is a simple MQTT client, but the detected behavior goes beyond connecting: it authenticates with credentials from the environment, subscribes broadly, and receives or logs broker message contents. This mismatch is dangerous because it can conceal sensitive data collection and network activity behind an understated description, preventing informed consent and increasing the risk of overbroad message exposure.
Referencing and sourcing a .env file in a bootstrap script strongly suggests credential material may be loaded from disk at runtime, and because it is sourced, those contents are also executable in the shell. This creates both credential exposure risk and command-execution risk if secrets or the file itself are mishandled, especially in an MQTT client where broker usernames, passwords, or tokens are likely to be present.
#!/usr/bin/env bash
source /home/jc/.openclaw/workspace/skills/mqtt-client/venv/bin/activate
source /home/jc/.openclaw/workspace/skills/mqtt-client/.env
python3 /home/jc/.openclaw/workspace/skills/mqtt-client/scripts/run.py
The skill declares no explicit tool scope or permissions even though it relies on environment-provided connection details. That omission reduces transparency and control, making it easier for the skill to access sensitive configuration implicitly and for users or orchestrators to invoke it without understanding its environmental dependencies.
The activation and usage description is vague about when the skill should run and what actions it performs once started. Ambiguous invocation guidance is dangerous for a background networked skill because it can lead to accidental execution, persistent broker subscriptions, and unintended monitoring of message traffic.
The documentation omits a clear warning that running bootstrap.sh will automatically load connection details from .env and initiate a live MQTT connection. This is risky because users may trigger external network access and credential use unintentionally, which can expose secrets or connect to production infrastructure without meaningful notice.
The script executes source on a .env file, which treats the file as shell code rather than as passive key/value configuration. If the .env file is modified by an attacker or contains unexpected shell syntax, arbitrary commands will run with the privileges of the script, and any secrets loaded from the file may also be exposed implicitly. In a skill/bootstrap context this is more dangerous because startup scripts are often run automatically and trusted by users.
The skill claims to be a simple MQTT client, but it ignores scoped topic configuration and subscribes to '#', which captures all broker topics. In a skill context, this turns the client into a broad message monitor that can collect unrelated or sensitive data from the broker and materially exceeds the stated behavior.
The code defines MQTT_TOPIC but never uses it, instead always subscribing to all topics via '#'. This mismatch is dangerous because operators may believe they have constrained the client's visibility when in reality it still receives every message on the broker.
The message handler logs every received payload in plaintext, which can expose secrets, personal data, or operational telemetry to stdout and any downstream log aggregation systems. Combined with the wildcard subscription, this can create large-scale unintended data capture from the entire broker.
The script accesses MQTT_USERNAME and MQTT_PASSWORD from environment variables to authenticate to the broker. There is no accompanying comment, docstring, or documentation warning that the skill consumes credentials from the environment.
No suspicious patterns detected.