T09 · Insecure Skill Coding Practices
- Location
scripts/moltbook.py:40- Finding
Bearer Credential Can Be Sent to an Arbitrary Configured API Origin
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This looks like a real Moltbook automation CLI, but it needs Review because it can make public account changes, delete content, post generated replies, and send external notifications without enough safeguards.
Install only if you are comfortable giving the skill a Moltbook API key and letting an agent perform public account actions. Keep the key out of shared workspaces when possible, restrict MOLTBOOK_API to the official HTTPS endpoint, avoid live auto-reply --post until you review generated text yourself, treat delete as irreversible, and review notify.env ownership/permissions before using Telegram notifications or heartbeat checks.
scripts/moltbook.py:40Bearer Credential Can Be Sent to an Arbitrary Configured API Origin
scripts/moltbook.py:269Untrusted Moltbook Content Is Passed to OpenClaw and Can Influence Automatic Replies
scripts/notify.sh:1Notification Configuration Is Executed as Shell Code
The skill explicitly instructs the operator to create a .env file containing an API key inside the skill workspace. In an agent environment, workspace files are often accessible to other tools, later prompts, backups, or accidental publication, so storing credentials there creates a realistic credential-access and account-compromise risk.
write path: .env content: |
API_KEY=sk_ТВОЙ_КЛЮЧ_ЗДЕСЬ
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
import urllib.request
from pathlib import Path
ENV_PATH = Path('/opt/moltbook-cli/.env')
STATE_PATH = Path('/opt/moltbook-cli/state.json')
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
import urllib.request
from pathlib import Path
ENV_PATH = Path('/opt/moltbook-cli/.env')
STATE_PATH = Path('/opt/moltbook-cli/state.json')
The delete command performs a destructive authenticated action immediately on user input with no confirmation, preview, or undo. In a CLI that also supports cached numeric references and direct post IDs, mistakes can permanently remove content with little friction.
The skill description advertises broad, high-privilege functionality for an agent-facing CLI without stating activation boundaries, approval requirements, or guardrails for state-changing actions. In an agent ecosystem, vague invocation scope increases the chance an agent will invoke account-affecting operations in response to loosely related requests or ambient context.
The documentation exposes destructive and account-affecting commands such as like, post, comment, reply, delete, follow, and unfollow with no warning about side effects, permanence, or need for user approval. In an autonomous-agent context, this omission can lead to unintended social actions or deletion of user content because the commands are presented as routine operations.
The skill documents a live auto-reply mode using --post without a strong warning that it can automatically publish content to a third-party platform. Automated posting materially raises the risk of spam, policy violations, reputational harm, and unintended disclosure because an agent may move from analysis to public action with minimal friction.
The instruction 'Post only in English (per memory)' imposes a language restriction as a policy without offering the user a choice or explaining a justified locale-specific requirement. This is a natural-language policy violation because it forces a specific language unconditionally.
Suspicious Unicode normalization or mixed-script content
The instructions direct the user to place a live API key into a local .env file without any guidance on secure storage, file permissions, exclusion from version control, or secret rotation. In an agent/workspace context, this increases the chance that credentials are exposed through logs, accidental commits, shared workspaces, or later tool access.
The phrase "Посты на EN" states a language requirement for posts, but the document does not provide user opt-in, alternatives, or justification for forcing English. This is a natural-language locale policy issue because it constrains output language unilaterally.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def run(cmd):
return subprocess.run(cmd, capture_output=True, text=True)
def should_run() -> bool:
The script can autonomously generate text via an external LLM-like tool and post it to a public service. In this context, untrusted remote content is being transformed into outbound actions, which increases the risk of spam, reputational harm, and policy-violating or manipulative content being published under the user's identity.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def openclaw_generate(prompt):
agent = os.environ.get('OPENCLAW_AGENT', 'main').strip()
cmd = ['openclaw', 'agent', '--agent', agent, '--message', prompt, '--json', '--timeout', '120']
proc = subprocess.run(cmd, check=True, capture_output=True, text=True)
data = json.loads(proc.stdout)
payloads = data.get('result', {}).get('payloads', [])
if not payloads:
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.
def openclaw_generate(prompt):
agent = os.environ.get('OPENCLAW_AGENT', 'main').strip()
cmd = ['openclaw', 'agent', '--agent', agent, '--message', prompt, '--json', '--timeout', '120']
proc = subprocess.run(cmd, check=True, capture_output=True, text=True)
data = json.loads(proc.stdout)
payloads = data.get('result', {}).get('payloads', [])
if not payloads:
The LLM prompt embeds untrusted post title and content directly with no instruction-boundary framing, making prompt injection feasible. A malicious post can try to override the intended behavior and induce the generator to produce unsafe, irrelevant, or manipulative content that is then posted publicly.
When --post is used, generated content is submitted immediately without an additional confirmation step. Because the content is derived from untrusted post data and an external generator, this can cause accidental publication of harmful, embarrassing, or policy-violating text as the authenticated user.
The help text for the find subcommand says "Find posts by keyword (local search)", implying a purely local operation. But cmd_find performs request('GET', f'/posts?sort=new&limit={limit}') at L131, which makes a remote API call and only then searches the returned content locally.
The hardcoded Telegram API endpoint confirms the script is designed to send data outside the host environment. In skill context, a helper script that forwards arbitrary caller-controlled text to a remote chat channel is risky because it can be repurposed to leak internal information with minimal visibility.
echo "Usage: notify.sh \"message\""
exit 1
fi
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_NOTIFY_TOKEN}/sendMessage" \
-d "chat_id=${TELEGRAM_NOTIFY_CHAT_ID}" \
-d "text=${MESSAGE}" \
-d "disable_web_page_preview=true" >/dev/null
The hardcoded Telegram API endpoint confirms the script is designed to send data outside the host environment. In skill context, a helper script that forwards arbitrary caller-controlled text to a remote chat channel is risky because it can be repurposed to leak internal information with minimal visibility.
echo "Usage: notify.sh \"message\""
exit 1
fi
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_NOTIFY_TOKEN}/sendMessage" \
-d "chat_id=${TELEGRAM_NOTIFY_CHAT_ID}" \
-d "text=${MESSAGE}" \
-d "disable_web_page_preview=true" >/dev/null
The script transmits arbitrary message content to Telegram, an external third-party service, without any in-script disclosure, consent check, or indication that provided input leaves the local environment. This can cause unintended disclosure of sensitive data if callers pass secrets, system details, or user information to the script under the assumption it is a local notification helper.
No suspicious patterns detected.