Back to skill

Security audit

alphaear-sentiment

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches financial sentiment analysis, but it includes broad database mutation and unpinned model/network behavior that should be reviewed before installing.

Review before installing. Use it only in a contained environment with a database you are comfortable letting the skill modify. Prefer a pre-cached, pinned, verified model and disable runtime model downloads. Treat database update helpers and arbitrary SQL access as administrative capabilities, not as a read-only sentiment analyzer.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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)

T08 · Insecure Dependencies

Warning
Location
scripts/sentiment_tools.py:48
Finding

Unpinned Remote Machine-Learning Model Retrieval

Content
View full analysis

Vulnerability Details

File Location: scripts/sentiment_tools.py, lines 48-65
Vulnerability Type: Unverified third-party model dependency
Risk Level: Medium

python
bert_model = os.getenv("BERT_SENTIMENT_MODEL", "uer/roberta-base-finetuned-chinanews-chinese")

# Prefer the local cache
try:
    tokenizer = AutoTokenizer.from_pretrained(bert_model, local_files_only=True)
    model = AutoModelForSequenceClassification.from_pretrained(bert_model, local_files_only=True)

    self.bert_pipeline = pipeline(
        "sentiment-analysis",
        model=model,
        tokenizer=tokenizer,
        device=-1
    )
    logger.info(f"✅ BERT pipeline loaded from local cache: {bert_model}")
except (OSError, ValueError, ImportError):
    # Download from the network if it is not available locally
    logger.info(f"📡 Downloading BERT model: {bert_model}...")
    tokenizer = AutoTokenizer.from_pretrained(bert_model)
    model = AutoModelForSequenceClassification.from_pretrained(bert_model)

Technical Analysis

When the requested model is unavailable in the local cache, the constructor automatically retrieves tokenizer and model artifacts from a remote model repository. The model identifier can also be changed through the BERT_SENTIMENT_MODEL environment variable.

The calls do not specify an immutable revision, validate artifact hashes, or restrict model identifiers to an approved allowlist. Consequently, the effective third-party component loaded by the Skill can change after the source code has been reviewed. A mutable or compromised model repository could provide altered weights or configuration files. An attacker who can influence the environment variable could also redirect retrieval to an attacker-selected repository.

Exploitability beyond model manipulation depends on the installed transformers version, supported artifact formats, repository contents, and loader behavior. The reviewed code ...[truncated 1850 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin the approved model to an immutable repository commit by passing an explicit revision to both AutoTokenizer.from_pretrained and AutoModelForSequenceClassification.from_pretrained.
  2. Maintain an allowlist of approved model identifiers instead of accepting an unrestricted environment-variable value.
  3. Verify downloaded artifacts against deployment-controlled cryptographic hashes before loading them.
  4. Require safe serialization formats such as safetensors and configure the loader to reject legacy unsafe formats where supported.
  5. Keep trust_remote_code=False explicit and do not enable it for untrusted repositories.
  6. Download, validate, and package model artifacts during a controlled build process. Run production inference with local_files_only=True and network access disabled.
  7. Fail closed when the approved local model is unavailable rather than automatically downloading a mutable dependency during runtime.
  8. Run model loading in a sandboxed, least-privileged process with limited filesystem access, no unnecessary credentials, and restricted outbound network access.
  9. Record the resolved model repository, immutable revision, artifact hashes, and library versions for auditability.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (29)

Context-Inappropriate Capability

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

The execute_query method accepts arbitrary SQL and executes both read and write statements, enabling any caller with access to the class to modify, delete, or exfiltrate all stored data. In the context of a sentiment-analysis skill, this is unjustified high-risk functionality because it bypasses all intended business logic and turns the module into a general-purpose database control surface.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Database write access, batch processing of news items, and model download behavior introduce persistence, bulk data handling, and network activity not clearly represented by the skill description. This is dangerous because a seemingly simple analysis skill could modify records at scale or pull remote artifacts, creating integrity and supply-chain risks.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Database write access, batch processing of news items, and model download behavior introduce persistence, bulk data handling, and network activity not clearly represented by the skill description. This is dangerous because a seemingly simple analysis skill could modify records at scale or pull remote artifacts, creating integrity and supply-chain risks.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

Database write access, batch processing of news items, and model download behavior introduce persistence, bulk data handling, and network activity not clearly represented by the skill description. This is dangerous because a seemingly simple analysis skill could modify records at scale or pull remote artifacts, creating integrity and supply-chain risks.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

Database write access, batch processing of news items, and model download behavior introduce persistence, bulk data handling, and network activity not clearly represented by the skill description. This is dangerous because a seemingly simple analysis skill could modify records at scale or pull remote artifacts, creating integrity and supply-chain risks.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Database write access, batch processing of news items, and model download behavior introduce persistence, bulk data handling, and network activity not clearly represented by the skill description. This is dangerous because a seemingly simple analysis skill could modify records at scale or pull remote artifacts, creating integrity and supply-chain risks.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

This database manager implements broad persistence for news, search caches, stock prices, and investment signals, which exceeds the declared sentiment-analysis purpose of the skill. Capability overreach increases attack surface and creates opportunities for misuse, especially when combined with mutable storage and cross-domain data handling unrelated to simple text sentiment classification.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The signals table stores investment-signal artifacts such as confidence, impact tickers, transmission chains, and user IDs, which is materially broader and more sensitive than sentiment classification. In a skill advertised as sentiment analysis, hidden investment-signal functionality creates an undeclared decision-support surface that may influence financial actions and retain sensitive user-associated records.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
74% confidence
Finding

The skill advertises operational capabilities that may rely on environment access but does not declare any explicit tool scope or permission boundaries. In agent environments, this creates ambiguity about what the skill is allowed to access and increases the risk of unintended secret or configuration exposure through implicit env reads.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill instructs the agent to update the database after analysis without warning the user that persistent data will be modified. This can lead to silent integrity changes, accidental overwrites, and user surprise in environments where analysis tools are expected to be read-only by default.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The embedded prompt is entirely in Chinese and implicitly requires analysis/output in that language, but the skill description does not state that the skill is Chinese-only or provide any language opt-in. This creates a locale policy issue because it imposes a specific language without user choice or justification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

Documenting a helper that saves sentiment directly to the database without caution normalizes silent state changes from an analysis workflow. In agent systems, such hidden writes can be chained with prompt injection or misclassification to corrupt stored records at scale.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

Deletion and content-mutation methods allow stored news records to be removed or altered after ingestion, which exceeds what is necessary to determine sentiment. These operations can be abused to tamper with historical data, poison downstream analytics, or erase evidence of prior content without any integrity protections.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The execute_query method accepts and executes any caller-provided SQL, including non-SELECT statements, and commits changes automatically. Although the docstring says it executes custom SQL, there is no confirmation prompt, visible user disclosure, or warning that this can modify or damage stored data.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest says this skill analyzes financial text sentiment using FinBERT or an LLM, but this file implements generic LLM capability probing for native tool-calling support and model registry caching. Testing whether a model can call tools or loading provider/model settings is not part of determining sentiment or sentiment scores for finance text.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill performs active tool-calling capability probes against an LLM even though the advertised purpose is finance sentiment analysis. This unnecessary agent execution can trigger unintended tool behavior, outbound requests, provider-side logging, or prompt-injection exposure during initialization or capability checks, increasing attack surface without a business need tied to the skill's stated function.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The docstrings, tool description, and agent instruction are written entirely in Chinese, and the test input at L25 also assumes a Chinese-speaking user context. This creates a language/locale constraint in the skill logic without any opt-in or justification, which matches the policy-violation category for forced language behavior.

Content

No source excerpt is available for this finding.

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 · scripts/llm/factory.py (reported line 75)May include surrounding context.

python
return OpenAIChat(
            id=model_id,
            base_url="https://api.z.ai/api/paas/v4",
            api_key=api_key,
            timeout=60,
            role_map=role_map,

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file includes Chinese-only natural-language comments and docstrings describing core behavior, which imposes a specific language without any user opt-in or documented regional justification. Under the policy, forcing a specific language or locale in skill-facing text is a natural-language policy violation unless choice or justification is provided.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manifest describes a skill for analyzing financial text sentiment with FinBERT or an LLM, returning polarity and score. This file instead implements broad infrastructure for routing between generic reasoning models and tool-capable models for agents, including capability checks for native tool calling, which is not obviously required for simple sentiment inference.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file’s natural-language comments and docstrings are written in Chinese and describe the tool as operating in Chinese sentiment-analysis modes, without offering any language or locale choice. This can violate a language/locale policy when users or maintainers are not given an explicit opt-in or alternative.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The class docstring states that the tool supports both LLM and BERT modes, including automatic fallback to LLM. In the current code, internal LLM logic has been removed and analyze_sentiment only returns an error instructing the caller to perform LLM analysis externally when BERT is unavailable.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

When the model is not cached locally, the code fetches model artifacts from the network at runtime based on an environment-controlled model identifier. This introduces supply-chain and integrity risk, because unpinned remote dependencies can change unexpectedly or be replaced with malicious or unsafe artifacts, and it also expands network capability beyond the stated skill scope.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest frames this skill as a sentiment analysis tool for determining sentiment and score of financial text. However, this file includes persistence behavior that writes analysis outputs into the daily_news table, which goes beyond pure analysis and into database mutation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manifest describes determining sentiment of financial text, but this method retrieves news records and bulk-updates stored sentiment scores and reasons in a database. That is a materially broader operational role than text analysis alone.

Content

No source excerpt is available for this finding.