Back to skill

Security audit

Phy Social Post

Security checks for vulnerabilities and agentic risk

Overview

This skill has a coherent social-posting purpose, but its workflow can publish to connected accounts and includes an unsafe command pattern that could execute injected content locally.

Review before installing. Only use this skill when you intend to publish publicly through connected social accounts, and require a preview plus explicit confirmation before posting. Avoid pasting user-supplied content into the documented python -c command; use a fixed script, stdin, JSON, or argument-array execution so post text remains data rather than executable code.

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

Error
Location
SKILL.md:162
Finding

User-Controlled Social Post Content Embedded in Executable Python and Shell Code

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 162–176
Vulnerability Type: Command and Python code injection
Risk Level: High

The documented posting workflow instructs an agent to replace placeholder content directly inside a double-quoted python -c shell command:

bash
source venv/bin/activate && python -c "
from social_posting import SocialPostingClient
from dotenv import load_dotenv
load_dotenv()

client = SocialPostingClient()
result = client.post(
    content='''Your content here''',
    platforms=['platform1', 'platform2'],
    media_urls=['https://example.com/image.jpg']  # Optional
)
print(f'Success: {result.success}')
print(f'Provider: {result.provider}')
print(f'Post ID: {result.post_id}')
"

Technical Analysis

The workflow constructs executable source code by interpolating social-media content into a Python triple-quoted string. An attacker-controlled post containing ''' can terminate that string and append arbitrary Python statements.

The Python program is also enclosed in a double-quoted shell argument. If user-controlled content is substituted before the shell parses the command, shell constructs such as command substitutions can be evaluated independently of the Python string boundary. Escaping content for only Python or only the shell would therefore be insufficient.

The vulnerable behavior occurs when an agent follows the documented instruction by replacing Your content here with untrusted text and executes the resulting command. Although the file contains documentation rather than an implementation, it presents this unsafe construction as the operational workflow.

Attack Path

  1. An attacker submits a request to publish specially crafted social-media content.
  2. The agent follows the skill workflow and inserts that content in place of Your content here.
  3. The crafted content terminates the Python triple-quoted literal or introduce ...[truncated 1304 chars]
Remediation
View remediation

Remediation Suggestions

  • Do not construct Python source code or shell commands by inserting post content into python -c.
  • Provide a fixed, reviewed Python script whose code is never generated from user input.
  • Transfer post content through standard input, a structured JSON file, or a separately supplied process argument.
  • Invoke the fixed script with an argument array and without a shell, such as through subprocess.run([...], shell=False).
  • Parse structured input with a JSON library and pass the resulting string directly to client.post.
  • Validate platform names against an explicit allowlist and validate media URLs before posting.
  • Require a preview and explicit user confirmation before performing the externally visible posting action.
  • Run the posting client with least privilege and restrict access to .env and provider credentials.
  • Avoid printing credentials or including them in command-line arguments, logs, error messages, or generated source.
  • Add tests containing triple quotes, quotation marks, backticks, dollar-sign substitutions, newlines, and other metacharacters to verify that all content remains inert data.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (6)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
from social_posting import SocialPostingClient
from dotenv import load_dotenv
load_dotenv('[your-project-root]/social-posting-api/.env')

def post_to_social(content: str, platforms: list, media_urls: list = None):
    """Post content to specified platforms."""

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger condition is overly broad for an action-capable skill that can publish to external social platforms. Broad activation increases the chance the agent invokes posting behavior from ambiguous user requests, causing unintended public publication, reputational harm, or accidental data disclosure.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill description does not prominently warn that it performs irreversible external actions by posting content to third-party social accounts. Without a clear warning and confirmation expectation, users or upstream agents may treat it like a drafting tool and accidentally publish sensitive, private, or unreviewed content.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest description on L003 says the skill is for posting to Twitter, LinkedIn, Instagram, Facebook, TikTok, Threads, or Bluesky. However, the supported-platforms table also includes Pinterest and YouTube, which expands the apparent scope beyond the manifest's declared platform set.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

The supported-platforms table presents a concrete list of supported platforms, but later workflow guidance on L171 directs users to use a different skill for 小红书 content, implying adjacent platform-specific handling outside this skill. While not a code contradiction, the file's own intent documentation is inconsistent about what this skill's platform remit includes.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The guidance says "小红书: Use xiaohongshu-gtm skill for Chinese content," which directs a specific language/locale workflow based on content language. This is a natural-language policy concern because it forces a locale-specific handling path without presenting it as an optional choice or explaining a documented regional requirement.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.