Back to skill

Security audit

News Sentiment

Security checks for vulnerabilities and agentic risk

Overview

This skill matches its advertised crypto sentiment purpose, but users should be cautious about third-party API sharing and unvalidated trading-style signals.

Install only if you are comfortable configuring Twitter/6551 and Dashscope API credentials and having coin symbols plus retrieved social/news text processed by those services. Treat the generated buy/sell-style signals as informational only, because public posts can manipulate LLM sentiment results and the skill does not robustly validate model output. Also note that some advertised features, such as alerts, Reddit/news breadth, and pro functionality, are not implemented in the inspected 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

Warning
Location
sentiment_analyzer.py:57
Finding

Untrusted Social-Media Content Can Manipulate AI-Generated Trading Signals

Content
View full analysis

Vulnerability Details

File Location: sentiment_analyzer.py, lines 57-89 and 127-150
Vulnerability Type: Indirect prompt injection and insufficient validation of LLM output
Risk Level: Medium

Vulnerable Code

python
prompt = f"""分析以下加密货币相关新闻的情绪,只返回 JSON:
{{
  "sentiment": "bullish" 或 "bearish" 或 "neutral",
  "score": 0-1 之间的数字,
  "confidence": 0-1 之间的数字,
  "keywords": ["关键词 1", "关键词 2"]
}}

新闻内容:{text[:500]}"""

data = json.dumps({
    "model": "qwen-turbo",
    "input": {"messages": [{"role": "user", "content": prompt}]},
    "parameters": {"temperature": 0.1}
}).encode('utf-8')

req = urllib.request.Request(
    DASHSCOPE_API,
    data=data,
    headers={
        "Authorization": f"Bearer {DASHSCOPE_KEY}",
        "Content-Type": "application/json"
    }
)

try:
    with urllib.request.urlopen(req, timeout=10) as response:
        result = json.loads(response.read().decode())
        # Parse LLM response
        content = result.get('output', {}).get('choices', [{}])[0].get('message', {}).get('content', '{}')
        return json.loads(content)
except:
    return simple_sentiment_analysis(text)
python
sentiments = []
for i, tweet in enumerate(tweets[:10], 1):
    text = tweet.get('text', '')
    analysis = analyze_sentiment_llm(text)
    sentiments.append(analysis.get('score', 0.5))

    emoji = "🚀" if analysis.get('sentiment') == 'bullish' else "📉" if analysis.get('sentiment') == 'bearish' else "➡️"
    print(f"{i}. {emoji} Score: {analysis.get('score', 0.5):.2f}")
    print(f"   {text[:80]}...")
    print()

# Calculate average
avg_score = sum(sentiments) / len(sentiments) if sentiments else 0.5

print("=" * 60)
print(f"📊 {coin_symbol} 情绪分析结果:")
print(f"   平均分数:{avg_score:.2f}/1.00")

if avg_score > 0.7:
    print(f"   情绪:🚀 非常看涨 (Very Bullish)")
    print(f"   信号:💰 考虑买入")
elif avg_score > 0.5:
    print(f"   情绪:📈 
...[truncated 3208 chars]
Remediation
View remediation

Remediation Suggestions

  1. Establish an explicit trust boundary for source content. Place the sentiment-analysis policy in a system message and pass tweet content in a separately delimited data field. Explicitly state that instructions, JSON examples, and requests inside source content must be treated only as quoted material.
  2. Use structured output controls. If supported by the model API, require a JSON schema or tool/function response rather than accepting unrestricted text.
  3. Validate every model response before use. Require an object with:
    • sentiment restricted to bullish, bearish, or neutral;
    • score and confidence restricted to finite numeric values from 0.0 through 1.0;
    • keywords restricted to a bounded list of strings.
  4. Reject invalid results safely. Do not silently accept out-of-range or incorrectly typed fields. Discard invalid analyses or replace them with a clearly identified local fallback result.
  5. Reduce the influence of individual posts. Apply duplicate detection, source-quality controls, robust aggregation, and per-source weighting so one or a few attacker-controlled posts cannot dominate the result.
  6. Treat output as untrusted even when JSON parsing succeeds. JSON syntax validation alone does not provide semantic validation or protection against indirect prompt injection.
  7. Add adversarial tests. Test posts containing instruction overrides, forged JSON, extreme and non-finite values, strings in numeric fields, nested objects, and contradictory sentiment/score combinations.
  8. Avoid presenting model output as actionable financial guidance without safeguards. Clearly label confidence and provenance, surface invalid or insufficient data, and require corroboration before generating buy- or sell-oriented messages.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (13)

Tainted flow: 'req' from os.environ.get (line 70, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · sentiment_analyzer.py (reported line 42)May include surrounding context.

python
)
    
    try:
        with urllib.request.urlopen(req, timeout=15) as response:
            result = json.loads(response.read().decode())
            return result.get('data', [])
    except Exception as e:

Tainted flow: 'req' from os.environ.get (line 70, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · sentiment_analyzer.py (reported line 80)May include surrounding context.

python
)
    
    try:
        with urllib.request.urlopen(req, timeout=10) as response:
            result = json.loads(response.read().decode())
            # Parse LLM response
            content = result.get('output', {}).get('choices', [{}])[0].get('message', {}).get('content', '{}')

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The declared behavior understates or misrepresents the actual external API usage and data flow, including contacting Twitter-related and DashScope services without clearly declaring that access. Behavior mismatches are dangerous because they defeat informed consent, bypass policy expectations, and can expose user queries or trading-related interests to third parties unexpectedly.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · sentiment_analyzer.py (reported line 17)May include surrounding context.

python
TWITTER_API = "https://ai.6551.io/open/twitter_search"
DASHSCOPE_API = "https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation"

# Get API keys from environment
TWITTER_TOKEN = os.environ.get("TWITTER_TOKEN", "")
DASHSCOPE_KEY = os.environ.get("DASHSCOPE_API_KEY", "")

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill's natural-language instructions, headings, usage guidance, and disclaimer are presented almost entirely in Chinese, with no indication that users can choose another language or that the skill is intended only for a Chinese-speaking audience. This can violate a language/locale policy when a specific language is effectively forced without user opt-in or documented justification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The README states that the skill uses external data sources and an external AI model, but it does not clearly warn users that news/social content and possibly query terms may be transmitted to third-party services. In a crypto-trading context, user queries, watched assets, and analysis targets can reveal trading interests or strategies, so the missing disclosure creates a meaningful privacy and data-sharing risk.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill advertises capabilities that require environment access and outbound network use, but it does not declare any explicit tool scope or permissions. This creates a transparency and control gap: users and platforms cannot accurately assess or constrain data access, including transmission of queries or secrets to third-party services.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill lacks a user-facing warning that inputs and searches may be sent to external social-media and LLM providers. In a trading-signal context, user queries can reveal sensitive market interests or strategies, so silent transmission to third parties creates privacy and operational-risk concerns.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The manifest describes a sentiment-analysis skill that scans Twitter, news sites, and social media for bullish/bearish signals. While network access is expected, directly reading secrets from environment variables introduces a credential-handling capability that is not justified by the stated purpose and is explicitly called out as context-inappropriate for this rule family.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The code sends tweet/news text to a third-party LLM service without any explicit consent, notice, or configuration gate. Even if the content is public, it may still contain personal data, proprietary monitoring targets, or regulated content, creating privacy, compliance, and unexpected data-sharing risk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file includes Chinese-only prompt instructions to the LLM and multiple Chinese user-facing status/result messages, but it does not give users an option to choose another language. This can violate a language/locale policy when a skill imposes a specific language by default without documented justification or user opt-in.

Content

No source excerpt is available for this finding.

Ssd 1

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Untrusted tweet text is interpolated directly into an LLM instruction prompt, allowing prompt injection from tweet content to alter the model's behavior or output format. In this skill, that can skew sentiment scores and downstream trading signals, and may also cause malformed JSON or hidden instruction-following behavior that defeats the intended analysis.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The file presents user-facing descriptions in both English and Chinese, including pricing descriptions and the title, but does not explain whether the skill responds in one language, both, or according to user preference. This can violate language/locale policy expectations when no opt-in or explicit choice is provided.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.