Back to skill

Security audit

Moltbook Validator

Security checks for vulnerabilities and agentic risk

Overview

The validator mostly matches its purpose, but it also includes under-described comment filtering, account blocklist, and posting-route advice that could influence Moltbook behavior beyond request validation.

Review the non-validator sections before installing. The payload validator scripts are narrow, but the skill also tells agents how to filter comments, identify spam accounts, and choose posting communities; install only if you want those behaviors applied during Moltbook work, and keep any API POST examples under explicit user control.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Note
Location
scripts/validate.py:15
Finding

Malformed JSON Values Cause Unhandled Validator Exceptions

Content
View full analysis

Vulnerability Details

File Location: scripts/validate.py, lines 15-43
Vulnerability Type: Improper input type validation and unhandled exceptions
Risk Level: Low

Vulnerable Code

python
def validate_post(data: dict) -> tuple[bool, list[str]]:
    """Validate a Moltbook post payload."""
    errors = []
    warnings = []
    
    # Critical: content field (not text!)
    if 'text' in data:
        errors.append("❌ 'text' field detected - use 'content' instead (text → null bug)")
    
    if 'content' not in data:
        errors.append("❌ 'content' field missing (required)")
    elif not data['content'] or not data['content'].strip():
        errors.append("❌ 'content' is empty")
    
    # Required fields
    if 'title' not in data or not data.get('title', '').strip():
        warnings.append("⚠️ 'title' missing or empty")
    
    if 'submolt' not in data:
        warnings.append("⚠️ 'submolt' missing (will default to 'general')")
    
    return len(errors) == 0, errors + warnings


def validate_comment(data: dict) -> tuple[bool, list[str]]:
    """Validate a Moltbook comment payload."""
    errors = []
    
    if 'text' in data:
        errors.append("❌ 'text' field detected - use 'content' instead")
    
    if 'content' not in data:
        errors.append("❌ 'content' field missing (required)")
    elif not data['content'] or not data['content'].strip():
        errors.append("❌ 'content' is empty")
    
    return len(errors) == 0, errors

Technical Analysis

json.loads() accepts every valid JSON type, including objects, arrays, strings, numbers, booleans, and null. The validator nevertheless assumes that the decoded root value is a dictionary and that fields such as content and title are strings.

Consequently:

  • A root value such as null or a number can raise TypeError during membership tests such as 'text' in data.

...[truncated 1956 chars]

Remediation
View remediation

Remediation Suggestions

Validate both the root JSON type and individual field types before performing dictionary or string operations:

python
def require_object(payload):
    if not isinstance(payload, dict):
        return False, ["❌ Payload must be a JSON object"]
    return True, []

def is_nonempty_string(value):
    return isinstance(value, str) and bool(value.strip())

Apply these checks before calling either validation function:

python
if not isinstance(payload, dict):
    print("❌ Payload must be a JSON object")
    sys.exit(1)

Validate fields explicitly rather than calling .strip() on arbitrary values:

python
content = data.get("content")
if "content" not in data:
    errors.append("❌ 'content' field missing (required)")
elif not isinstance(content, str):
    errors.append("❌ 'content' must be a string")
elif not content.strip():
    errors.append("❌ 'content' is empty")

Perform equivalent type checks for title and any other string fields. Add a final defensive exception handler in the command-line entry point so unexpected input produces a controlled nonzero exit status without a traceback.

Add regression tests covering:

  • Root values of null, numbers, booleans, strings, and arrays.
  • content and title values that are numbers, arrays, objects, booleans, or null.
  • Empty and whitespace-only strings.
  • Both post and comment modes.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (3)

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 71)May include surrounding context.

Check before posting:

bash
curl -s -X POST ".../posts" -d '{}' | jq '.retry_after_minutes'

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill is presented as a narrow POST-payload validator, but it also embeds unrelated comment-filtering, account blocklisting, and submolt-selection advice. This scope expansion can cause an agent to apply unreviewed moderation or engagement logic in contexts where only request validation was expected, increasing the chance of unintended behavioral manipulation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Spam-bot detection is not necessary for validating outbound Moltbook POST payloads, yet the skill includes logic for filtering inbound comments and classifying users. This creates hidden functionality beyond the declared purpose, which may influence agent decisions and suppress content based on brittle heuristics or adversarially planted patterns.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.