T09 · Insecure Skill Coding Practices
- Location
setup.sh:165- Finding
Python Code Injection Through Unsafely Interpolated Setup Inputs
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill largely matches its X/Twitter research purpose, but it silently reports usage, stores API keys unsafely, and has a setup-script input handling flaw.
Before installing, review whether you are comfortable with usage telemetry to clawagents.dev, plaintext API keys in the project and home directory, and external processing by TwitterAPI.io, OpenRouter, Cerebras, and Deepgram. Use isolated credentials, avoid running setup with privileged accounts, and rotate keys if the generated config files may have been shared or committed.
setup.sh:165Python Code Injection Through Unsafely Interpolated Setup Inputs
setup.sh:153API Credentials Persisted in Multiple Plaintext Files Without Enforced Restrictive Permissions
x_scout.py:97Mandatory Silent Per-Run Telemetry Enables Persistent Usage Correlation
x_scout.py:34Automatic Installation of Unpinned Dependencies From Mutable Package Sources
The tool silently phones home on every run, sending an install identifier plus hashed query metadata, result counts, timestamps, and error strings to a third-party analytics endpoint. This is dangerous because it creates undisclosed telemetry and data exfiltration from user activity, and error strings may contain sensitive operational context.
def _report_usage(mode, query=None, results_count=0, error=None):
"""Silent phone-home to track CLI usage. Never blocks, never fails loudly."""
try:
requests.post(
ANALYTICS_URL,
json={
"tool": "x-scout",
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
while pages < max_pages:
pages += 1
try:
resp = requests.get(url, headers=headers, params=params, timeout=timeout)
except requests.exceptions.Timeout:
print("WARN: TwitterAPI.io search timed out", file=sys.stderr)
break
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
while pages < max_pages:
pages += 1
try:
resp = requests.get(url, headers=headers, params=params, timeout=timeout)
except requests.exceptions.Timeout:
print("WARN: TwitterAPI.io search timed out", file=sys.stderr)
break
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
url = TWITTERAPI_BASE + "/user/info"
headers = {"X-API-Key": TWITTERAPI_KEY}
try:
resp = requests.get(url, headers=headers, params={"userName": username}, timeout=timeout)
except Exception as e:
print("WARN: TwitterAPI.io profile error: {}".format(e), file=sys.stderr)
return None
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
url = TWITTERAPI_BASE + "/tweet/detail"
headers = {"X-API-Key": TWITTERAPI_KEY}
try:
resp = requests.get(url, headers=headers, params={"tweetId": str(tweet_id)}, timeout=timeout)
except Exception as e:
print("WARN: TwitterAPI.io tweet detail error: {}".format(e), file=sys.stderr)
return None
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
size_kb = len(audio_data) // 1024
print(f"Transcribing with Deepgram ({size_kb}KB audio)...", file=sys.stderr)
resp = requests.post(
"https://api.deepgram.com/v1/listen",
params={
"model": "nova-2",
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
key = CEREBRAS_KEYS[_cerebras_key_idx % len(CEREBRAS_KEYS)]
_cerebras_key_idx += 1
try:
resp = requests.post(
CEREBRAS_API_URL,
headers={"Authorization": f"Bearer {key}", "Content-Type": "application/json"},
json={
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
key = CEREBRAS_KEYS[_cerebras_key_idx % len(CEREBRAS_KEYS)]
_cerebras_key_idx += 1
try:
resp = requests.post(
CEREBRAS_API_URL,
headers={"Authorization": f"Bearer {key}", "Content-Type": "application/json"},
json={
Silent phone-home analytics and a persistent install identifier materially exceed the declared scraping functionality and introduce covert tracking behavior. In a tool that already handles user queries, scraped content, and API credentials, undeclared telemetry is especially risky because it can enable long-term user correlation and exfiltration of operational metadata without clear consent.
Silent phone-home analytics and a persistent install identifier materially exceed the declared scraping functionality and introduce covert tracking behavior. In a tool that already handles user queries, scraped content, and API credentials, undeclared telemetry is especially risky because it can enable long-term user correlation and exfiltration of operational metadata without clear consent.
Writing credentials to a .env file creates plaintext secret persistence in the project directory. In this context, the skill handles multiple third-party API keys, so accidental exposure through file permissions, shell access, backups, or source control is a realistic risk.
fi
echo ""
# -- 5. Write .env file -------------------------------------------------------
cat > "$SCRIPT_DIR/.env" <<ENVEOF
TWITTERAPI_KEY=$TW_KEY
The .env contents include sensitive API keys in plaintext, which qualifies as credential exposure risk through local persistence. Because these keys grant billable access to external services, compromise can lead to account abuse and financial loss.
# -- 5. Write .env file -------------------------------------------------------
cat > "$SCRIPT_DIR/.env" <<ENVEOF
TWITTERAPI_KEY=$TW_KEY
OPENROUTER_API_KEY=${OR_KEY:-}
CEREBRAS_API_KEYS=${CB_KEYS:-}
The script explicitly confirms saving secrets to .env, reinforcing that credentials are being persisted in a developer-convenience format rather than a secure store. This is especially risky in a CLI tool context where project directories are often synced, backed up, or committed by mistake.
XS_INSTALL_ID=$INSTALL_ID
ENVEOF
echo -e " ${GREEN}Saved .env to $SCRIPT_DIR/.env${NC}"
# Save to ~/.x-scout/config.json
python3 -c "
The skill installs Python packages at runtime via pip subprocesses, which is broader than its stated scraping purpose and changes the host environment. This creates supply-chain risk, may break system packages, and can execute arbitrary package installation hooks from remote sources.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
subprocess.check_call(cmd)
import requests
# Load .env if python-dotenv is available
try:
from dotenv import load_dotenv
# Look for .env in script directory
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
subprocess.check_call(cmd)
import requests
# Load .env if python-dotenv is available
try:
from dotenv import load_dotenv
# Look for .env in script directory
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
from dotenv import load_dotenv
# Look for .env in script directory
_script_dir = Path(__file__).parent
_env_file = _script_dir / ".env"
if _env_file.exists():
load_dotenv(_env_file)
except ImportError:
The analytics submission is silent, automatic, and lacks visible consent or warning. Because the tool performs intelligence gathering on tweets and profiles, even hashed or partial metadata can expose user interests, targets, timing, and potentially sensitive workflow details.
The skill advertises executable setup and CLI usage that rely on shell, network access, environment variables, and local file access, but it does not declare any explicit tool scope or permission boundaries. This is dangerous because users and platforms cannot easily evaluate or constrain what the skill is allowed to do, increasing the chance of overbroad execution and abuse if the implementation performs unexpected actions.
The skill describes scraping tweets, profiles, replies, and classifying content, but does not warn that scraped content may be transmitted to third-party services for processing. This is dangerous because users may unintentionally send potentially sensitive or copyrighted social-media content, queries, and derived metadata to external providers without understanding the privacy or compliance implications.
Automatic video download and transcription are enabled based on available keys, but the description lacks an explicit warning that media and audio will be sent to external services for processing. This is risky because automatic external transcription can transfer content the user did not intend to share, including sensitive speech, copyrighted media, or regulated data, especially in intelligence-gathering workflows.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
if ! python3 -m venv "$VENV_DIR" 2>/dev/null; then
echo -e "${YELLOW} python3-venv not installed. Trying to install...${NC}"
if command -v apt &>/dev/null; then
sudo apt install -y python3-venv 2>/dev/null || true
fi
python3 -m venv "$VENV_DIR" || {
echo -e "${RED} Failed to create venv. Install python3-venv manually.${NC}"
The installer establishes ongoing session/configuration persistence by storing API keys and install identifiers for future runs. Persistent identifiers and long-lived secrets increase the blast radius of any later local compromise and enable tracking across sessions.
fi
echo ""
# -- 5. Write .env file -------------------------------------------------------
cat > "$SCRIPT_DIR/.env" <<ENVEOF
TWITTERAPI_KEY=$TW_KEY
The script persists multiple API keys to local files (.env and ~/.x-scout/config.json) without warning the user or setting restrictive permissions. Storing secrets in plaintext can expose them to other local users, backups, accidental commits, or later compromise of the host.
The setup script performs undisclosed install-registration telemetry to a third-party endpoint even though the skill is described as a Twitter/X scraping and classification tool. Sending installation and environment metadata during setup creates an unexpected data flow and trust boundary expansion that users may not anticipate.