Back to skill

Security audit

US Stock Analyst by leading AI LLM models with Bloomberg Data, Twitter Sentiment and Wall Street Equity Research Reports

Security checks for vulnerabilities and agentic risk

Overview

This skill is a cloud-backed stock analysis helper whose network and API-key use match its stated purpose, with some privacy and coding cautions but no evidence of hidden or malicious behavior.

Install only if you are comfortable using AIsa as a third-party cloud provider for your stock research. Avoid submitting confidential portfolios or proprietary investment theses, monitor API credit costs, and treat generated investment analysis as informational. Prefer fixing the unsanitized report filename and dependency pins before using it in automated or multi-user workflows.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/stock_analyst.py:536
Finding
Path Traversal Through Unsanitized Ticker in Report Filename<![CDATA[ ## Vulnerability Details **File Location**: `scripts/stock_analyst.py:536-537, 584-587`; duplicated in `US Stock Analyst 0210v1/stock_analyst.py:536-537, 584-587` **Vulnerability Type**: Path traversal and arbitrary file overwrite **Risk Level**: Medium ### Vulnerable Code ```python api_key = input("Enter your AIsa API key: ") ticker = input("Enter stock ticker (e.g., NVDA, AAPL): ").strip().upper() ``` ```python # Save report filename = f"{ticker}_analysis_{datetime.now().strftime('%Y%m%d')}.json" with open(filename, "w") as f: json.dump(report, f, indent=2) ``` ### Technical Analysis The application accepts the ticker as unrestricted user input and later embeds it directly into a filesystem path. Calling `strip()` and `upper()` does not remove path separators, `..` traversal components, absolute-path syntax, or platform-specific filename characters. The file is opened in write mode, which creates a new file or truncates an existing file. Consequently, a ticker containing traversal components can cause the report to be written outside the intended working directory. The data-gathering failures that may result from an invalid ticker do not reliably prevent exploitation because individual API errors are caught and converted into result objects. Report synthesis and file creation can therefore still occur. ### Attack Path 1. An attacker or untrusted caller runs the interactive script. 2. The caller supplies a ticker containing path traversal components, such as `../../target`. 3. The value is uppercased but remains a path containing `../`. 4. The script appends `_analysis_<date>.json` to the attacker-controlled path. 5. `open(filename, "w")` resolves the traversal and writes outside the current directory. 6. If the resolved destination already exists and the process can write to it, the destination is truncated and replaced with JSON report content. ### Impact Assessment Exploitation grants filesystem write capability under the privileges ...[truncated 455 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Validate ticker symbols against a strict allowlist pattern before making API requests or constructing filenames. For example: ```python import re if not re.fullmatch(r"[A-Z][A-Z0-9.-]{0,9}", ticker): raise ValueError("Invalid stock ticker") ``` - Reject `/`, `\`, `..`, null bytes, drive prefixes, and other platform-specific path syntax. - Store reports beneath a dedicated, explicitly configured output directory. - Resolve the final path and verify that it remains beneath the approved directory: ```python from pathlib import Path output_dir = Path("reports").resolve() output_dir.mkdir(parents=True, exist_ok=True) output_path = (output_dir / f"{ticker}_analysis_{date}.json").resolve() if output_dir not in output_path.parents: raise ValueError("Output path escapes the report directory") ``` - Consider exclusive file creation or an explicit overwrite confirmation where replacement is not intended. - Apply the correction to both duplicated implementations. ]]>

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding
Unnecessary and Insufficiently Constrained Third-Party Dependencies<![CDATA[ ## Vulnerability Details **File Location**: `requirements.txt:1-2`; duplicated in `US Stock Analyst 0210v1/requirements.txt:1-2`; associated installation guidance in `README.md:30-33` and `US Stock Analyst 0210v1/README.md:30-33` **Vulnerability Type**: Unnecessary package installation and non-reproducible dependency resolution **Risk Level**: Low ### Vulnerable Code ```text httpx>=0.24.0 asyncio ``` The documentation also instructs users to install these packages: ```bash pip install httpx asyncio pip install -r requirements.txt ``` ### Technical Analysis `asyncio` is included in the supported Python standard library and does not need to be installed from PyPI. Requesting a third-party package with that name unnecessarily expands the supply-chain trust boundary and may cause users to install code unrelated to the standard-library module they intend to use. The `httpx>=0.24.0` requirement has no upper bound or reviewed lock. A future installation may therefore resolve to a materially different release than the version reviewed during this audit. The manifests also do not provide hashes, preventing package-content verification and reproducible installation. This finding does not establish that the currently resolved packages are malicious. The risk arises from unnecessary package retrieval and mutable, insufficiently constrained dependency resolution. ### Attack Path 1. A user follows the README or installs the provided requirements. 2. `pip` contacts the configured package index. 3. It retrieves the unnecessary third-party `asyncio` distribution and the newest compatible `httpx` release. 4. Installation or later import executes code supplied by those external distributions under the user’s privileges. 5. A compromised, substituted, or unexpectedly changed distribution could affect the Skill environment. ### Impact Assessment A compromised dependency would execute with the same privileges as the Python environment performing installation or ...[truncated 310 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Remove `asyncio` from both requirements files and installation commands because it is supplied by Python. - Replace broad dependency ranges with reviewed, compatible versions. - Generate a reproducible lock file containing exact transitive versions. - Use package hashes, such as pip’s `--require-hashes` workflow, to verify downloaded artifacts. - Regularly scan the locked dependency set for known vulnerabilities. - Document the supported Python version so users know that the standard-library `asyncio` implementation is available. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/stock_analyst.py:291
Finding
Prompt Injection Through Untrusted News, Web, and Social-Media Content<![CDATA[ ## Vulnerability Details **File Location**: `scripts/stock_analyst.py:291-334, 347-380`; duplicated in `US Stock Analyst 0210v1/stock_analyst.py:291-334, 347-380` **Vulnerability Type**: Indirect prompt injection **Risk Level**: Medium ### Vulnerable Code ```python # Extract key data metrics = data.get("financial_metrics", {}).get("data", {}) news = data.get("stock_news", {}).get("data", [])[:5] web_results = data.get("web_search", {}).get("results", [])[:5] prompt = f"""Analyze {ticker} stock for investment purposes. Financial Metrics: {json.dumps(metrics, indent=2)} Recent News: {json.dumps(news, indent=2)} Market Analysis: {json.dumps(web_results, indent=2)} Provide a comprehensive investment summary covering: 1. Business performance and recent developments 2. Financial health and key metrics 3. Growth opportunities 4. Key risks and concerns 5. Overall investment thesis Be objective and data-driven. Limit response to 300 words.""" response = await self.client.post( f"{self.llm_base_url}/chat/completions", json={ "model": model, "messages": [ { "role": "system", "content": "You are a professional equity analyst providing objective investment analysis." }, { "role": "user", "content": prompt } ], "temperature": 0.3, "max_tokens": 1500 }, headers=self.headers ) ``` The sentiment workflow similarly incorporates untrusted tweet and news text: ```python twitter_data = data.get("twitter", {}) news_data = data.get("stock_news", {}).get("data", [])[:10] # Extract tweets tweets = [] if "data" in twitter_data and "tweets" in twitter_data["data"]: tweets = [t.get("text", "") for t in twitter_data["data"]["tweets"][:10]] prompt = f"""Analyze sentiment for {ticker} based on: Recent News Headlines: {json.dumps([n.get("title", "") for n in news_data], indent=2)} Recent Tweets: {jso ...[truncated 2501 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Place remote content inside explicit data delimiters and state in the system message that instructions contained within those delimiters are untrusted and must never be followed. - Separate trusted task instructions from retrieved evidence using distinct structured fields rather than one interpolated prompt. - Extract only necessary fields and limit the size and type of remote content passed to the model. - Detect or flag instruction-like phrases in retrieved content before model submission. - Require schema-constrained output and validate values against expected types and ranges. - Cross-check material claims and numeric conclusions against authoritative financial fields rather than accepting model output as authoritative. - Preserve source citations so users can inspect the evidence behind conclusions. - Warn users when retrieved sources contain suspicious instruction-like content or when model output conflicts with source data. - Apply equivalent protections to the duplicated implementation. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (82)

Tool Parameter Abuse

High
Category
Tool Misuse
Content
**Real-time Financial Metrics**
```bash
curl "https://api.aisa.one/apis/v1/financial/financial-metrics/snapshot?ticker=AAPL" \
  -H "Authorization: Bearer $AISA_API_KEY"
```
Confidence
60% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
**Real-time Financial Metrics**
```bash
curl "https://api.aisa.one/apis/v1/financial/financial-metrics/snapshot?ticker=AAPL" \
  -H "Authorization: Bearer $AISA_API_KEY"
```
Confidence
60% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Credential Access

High
Category
Privilege Escalation
Content
async def main():
    """Run basic stock analysis."""
    
    # Get API key from environment
    api_key = os.environ.get("AISA_API_KEY")
    if not api_key:
        print("Error: AISA_API_KEY environment variable not set")
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
async def main():
    """Run basic stock analysis."""
    
    # Get API key from environment
    api_key = os.environ.get("AISA_API_KEY")
    if not api_key:
        print("Error: AISA_API_KEY environment variable not set")
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Lp3

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The skill advertises use of environment secrets, network access, and a Python script, but does not declare an explicit permission or allowed-tools scope. That weakens least-privilege controls and makes it harder for a host agent or user to understand that prompts, tickers, and API-backed analysis may trigger outbound requests and local file writes.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
The skill encourages portfolio monitoring and free-form analysis prompts but does not warn users that their watchlists, prompts, and possibly derived investment context may be transmitted to third-party services including search, social, YouTube, and LLM endpoints. This is a real privacy and transparency issue because portfolio composition and research intent can be sensitive financial information.

External Transmission

Medium
Category
Data Exfiltration
Content
**Real-time Financial Metrics**
```bash
curl "https://api.aisa.one/apis/v1/financial/financial-metrics/snapshot?ticker=AAPL" \
  -H "Authorization: Bearer $AISA_API_KEY"
```
Confidence
90% confidence
Finding
The skill repeatedly relies on the external domain `api.aisa.one`, meaning user inputs and API-authenticated requests leave the local environment. That is expected functionality, but it is still a true egress risk because sensitive portfolio or prompt data could be shared with a third party without sufficiently prominent notice.

External Transmission

Medium
Category
Data Exfiltration
Content
**Real-time Financial Metrics**
```bash
curl "https://api.aisa.one/apis/v1/financial/financial-metrics/snapshot?ticker=AAPL" \
  -H "Authorization: Bearer $AISA_API_KEY"
```
Confidence
90% confidence
Finding
The skill repeatedly relies on the external domain `api.aisa.one`, meaning user inputs and API-authenticated requests leave the local environment. That is expected functionality, but it is still a true egress risk because sensitive portfolio or prompt data could be shared with a third party without sufficiently prominent notice.

External Transmission

Medium
Category
Data Exfiltration
Content
**Historical Stock Prices**
```bash
# Daily prices for last 30 days
curl "https://api.aisa.one/apis/v1/financial/prices?ticker=AAPL&start_date=2025-01-01&end_date=2025-01-31&interval=day&interval_multiplier=1" \
  -H "Authorization: Bearer $AISA_API_KEY"

# 5-minute intraday data
Confidence
90% confidence
Finding
Historical price lookups send analysis parameters to a third-party API and therefore create an outbound data path. While the payload appears low sensitivity in isolation, combined requests can reveal a user's holdings, timing, and research patterns.

External Transmission

Medium
Category
Data Exfiltration
Content
-H "Authorization: Bearer $AISA_API_KEY"

# 5-minute intraday data
curl "https://api.aisa.one/apis/v1/financial/prices?ticker=AAPL&start_date=2025-02-07&end_date=2025-02-07&interval=minute&interval_multiplier=5" \
  -H "Authorization: Bearer $AISA_API_KEY"
```
Confidence
90% confidence
Finding
Intraday price queries are another external transmission path and may reveal highly time-sensitive trading interest or monitoring behavior. In a finance context, even ticker plus time-window metadata can be sensitive when tied to a user's portfolio activity.

External Transmission

Medium
Category
Data Exfiltration
Content
**Financial Statements**
```bash
# All statements (income, balance, cash flow)
curl "https://api.aisa.one/apis/v1/financial/financial_statements/all?ticker=AAPL" \
  -H "Authorization: Bearer $AISA_API_KEY"
```
Confidence
90% confidence
Finding
Fetching financial statements from an external provider is expected, but it still exposes which companies and analyses the user is interested in. The risk is moderate because the skill combines many such data pulls into a detailed profile of user research behavior.

External Transmission

Medium
Category
Data Exfiltration
Content
**Analyst Estimates**
```bash
# EPS forecasts and ratings
curl "https://api.aisa.one/apis/v1/financial/analyst/eps?ticker=AAPL&period=annual" \
  -H "Authorization: Bearer $AISA_API_KEY"
```
Confidence
90% confidence
Finding
Analyst estimate queries are externally transmitted and contribute to a broader pattern of data egress. Although the endpoint itself is not suspicious, the skill context makes the aggregate profiling risk real because repeated use may disclose strategy and investment focus.

External Transmission

Medium
Category
Data Exfiltration
Content
**Insider Trading**
```bash
# Track insider buy/sell activity
curl "https://api.aisa.one/apis/v1/financial/insider/trades?ticker=AAPL" \
  -H "Authorization: Bearer $AISA_API_KEY"
```
Confidence
90% confidence
Finding
Insider trade requests send user-selected securities to an outside API. This is normal for the feature, but still a true security/privacy concern because the skill lacks strong user-facing warning that research inputs are exported.

External Transmission

Medium
Category
Data Exfiltration
Content
**Institutional Ownership**
```bash
# See who owns the stock
curl "https://api.aisa.one/apis/v1/financial/institutional/ownership?ticker=AAPL" \
  -H "Authorization: Bearer $AISA_API_KEY"
```
Confidence
89% confidence
Finding
Institutional ownership lookups are another external data transfer mechanism. The danger is not the endpoint itself but the undisclosed accumulation of user research metadata across repeated authenticated requests.

External Transmission

Medium
Category
Data Exfiltration
Content
**SEC Filings**
```bash
# Access 10-K, 10-Q, 8-K filings
curl "https://api.aisa.one/apis/v1/financial/sec/filings?ticker=AAPL" \
  -H "Authorization: Bearer $AISA_API_KEY"
```
Confidence
89% confidence
Finding
SEC filing retrieval requires outbound network access and reveals which issuers the user is investigating. In this skill, that behavior is central rather than malicious, but it remains a genuine egress risk due to missing transparency and permission scoping.

External Transmission

Medium
Category
Data Exfiltration
Content
**Company News**
```bash
curl "https://api.aisa.one/apis/v1/financial/news?ticker=AAPL&limit=10" \
  -H "Authorization: Bearer $AISA_API_KEY"
```
Confidence
92% confidence
Finding
News retrieval sends selected tickers to a third-party service and may expose ongoing research topics. Because the skill promotes portfolio monitoring, this can leak holdings or interests over time if users are unaware of the data sharing.

External Transmission

Medium
Category
Data Exfiltration
Content
**Web Search (News & Articles)**
```bash
curl -X POST "https://api.aisa.one/apis/v1/scholar/search/web?query=AAPL+stock+analysis&max_num_results=10" \
  -H "Authorization: Bearer $AISA_API_KEY"
```
Confidence
95% confidence
Finding
The web-search endpoint can transmit free-form analysis queries such as 'stock analysis' prompts to an external service, not just simple tickers. That increases sensitivity because users may include proprietary theses, portfolio context, or confidential reasoning in prompts that leave the local environment.

External Transmission

Medium
Category
Data Exfiltration
Content
**Academic Research**
```bash
curl -X POST "https://api.aisa.one/apis/v1/scholar/search/scholar?query=semiconductor+industry+analysis&max_num_results=5" \
  -H "Authorization: Bearer $AISA_API_KEY"
```
Confidence
94% confidence
Finding
Academic search also transmits free-form research queries externally. While useful, it expands the privacy surface by exporting potentially sensitive sector theses or investment themes beyond the user's environment.

External Transmission

Medium
Category
Data Exfiltration
Content
**Twitter Search**
```bash
curl "https://api.aisa.one/apis/v1/twitter/tweet/advanced_search?query=\$AAPL&queryType=Latest" \
  -H "Authorization: Bearer $AISA_API_KEY"
```
Confidence
92% confidence
Finding
Twitter search for cashtags sends user interests to an external provider and may involve collection of social-content-derived signals. In a finance workflow, this can reveal portfolio surveillance or strategy focus, especially when combined with other endpoints.

External Transmission

Medium
Category
Data Exfiltration
Content
**YouTube Search (Earnings Calls, Analysis)**
```bash
curl "https://api.aisa.one/apis/v1/youtube/search?engine=youtube&q=AAPL+earnings+call&gl=us&hl=en" \
  -H "Authorization: Bearer $AISA_API_KEY"
```
Confidence
91% confidence
Finding
YouTube search transmits company-related queries to an external service and adds another third-party data flow not prominently disclosed to users. The security issue is moderate because it broadens exposure of user interests and may involve locale-specific metadata.

External Transmission

Medium
Category
Data Exfiltration
Content
**LLM Gateway (OpenAI Compatible)**
```bash
curl -X POST "https://api.aisa.one/v1/chat/completions" \
  -H "Authorization: Bearer $AISA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
Confidence
98% confidence
Finding
The LLM gateway sends user prompts and analysis context to a remote model endpoint, which is materially more sensitive than simple ticker lookups because prompts can contain portfolio details, investment theses, or confidential instructions. This creates a significant data-exposure and third-party processing risk if users are not clearly informed and the host cannot constrain model egress.

External Transmission

Medium
Category
Data Exfiltration
Content
**Real-time Financial Metrics**
```bash
curl "https://api.aisa.one/apis/v1/financial/financial-metrics/snapshot?ticker=AAPL" \
  -H "Authorization: Bearer $AISA_API_KEY"
```
Confidence
88% confidence
Finding
The documented dependency on `https://api.aisa.one/` confirms that the skill relies on external network calls for core functionality. This is not inherently malicious, but it is a genuine security/privacy concern when users are not clearly warned that prompts, research queries, and metadata may be transmitted off-platform.

External Transmission

Medium
Category
Data Exfiltration
Content
**Real-time Financial Metrics**
```bash
curl "https://api.aisa.one/apis/v1/financial/financial-metrics/snapshot?ticker=AAPL" \
  -H "Authorization: Bearer $AISA_API_KEY"
```
Confidence
88% confidence
Finding
The documented dependency on `https://api.aisa.one/` confirms that the skill relies on external network calls for core functionality. This is not inherently malicious, but it is a genuine security/privacy concern when users are not clearly warned that prompts, research queries, and metadata may be transmitted off-platform.

External Transmission

Medium
Category
Data Exfiltration
Content
**Historical Stock Prices**
```bash
# Daily prices for last 30 days
curl "https://api.aisa.one/apis/v1/financial/prices?ticker=AAPL&start_date=2025-01-01&end_date=2025-01-31&interval=day&interval_multiplier=1" \
  -H "Authorization: Bearer $AISA_API_KEY"

# 5-minute intraday data
Confidence
88% confidence
Finding
Historical price lookups are performed against an external endpoint, meaning user-requested tickers, time ranges, and associated metadata are disclosed to a third party. In context this is expected behavior, but it still constitutes real data transmission risk if user interests or trading strategy are sensitive.

External Transmission

Medium
Category
Data Exfiltration
Content
-H "Authorization: Bearer $AISA_API_KEY"

# 5-minute intraday data
curl "https://api.aisa.one/apis/v1/financial/prices?ticker=AAPL&start_date=2025-02-07&end_date=2025-02-07&interval=minute&interval_multiplier=5" \
  -H "Authorization: Bearer $AISA_API_KEY"
```
Confidence
88% confidence
Finding
Intraday price requests also transmit query details to an external provider. Fine-grained intraday requests can reveal near-real-time trading interest or monitoring behavior, which may be sensitive in some environments.

Static analysis

No suspicious patterns detected.