Back to skill

Security audit

Sectors Financial Agents

Security checks for vulnerabilities and agentic risk

Overview

This skill coherently connects to the Sectors market-data API using a user-provided API key, with no hidden destructive behavior found.

Install only if you trust the Sectors API provider and are comfortable giving the agent access to SECTORS_API_KEY for market-data queries. Prefer a protected secret store or session-scoped environment variable over putting the key in shell history, .bashrc, or repository .env files, and consider installing requests in an isolated environment with pinned versions.

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 (2)

T08 · Insecure Dependencies

Warning
Location
SKILL.md:52
Finding
Unpinned Third-Party Dependency Installation<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 52-56 **Vulnerability Type**: Unpinned and integrity-unverified package installation **Risk Level**: Medium ### Vulnerable Code ```markdown ### 2. Install the dependency ```bash pip install requests ``` ``` ### Technical Analysis The setup instructions install `requests` from the package index without specifying a reviewed version, lock file, package hash, or trusted index. Dependency resolution is therefore mutable: a future installation may retrieve a different package version or dependency graph than the one reviewed during this audit. Python package installation can execute package build or installation logic. If the selected release, one of its transitive dependencies, the configured package index, or the package-resolution environment is compromised, installation can result in arbitrary code execution. The Skill also declares broad `Bash(pip:*)` permission. This allows more pip operations than the Skill's market-data functionality inherently requires and weakens least-privilege enforcement around dependency installation. No evidence was found that the legitimate `requests` package is currently malicious. The vulnerability is the absence of version and integrity controls around executable third-party content. ### Attack Path 1. A user or agent follows the documented setup procedure. 2. The agent invokes `pip install requests` using the broadly permitted pip tool. 3. Pip dynamically resolves the package and its dependencies from the configured package index. 4. An attacker compromises an applicable package release, transitive dependency, index, mirror, or package-resolution configuration. 5. Pip downloads and processes the attacker-controlled distribution. 6. Malicious build or installation code executes with the privileges of the user running the agent. ### Impact Assessment Successful exploitation could execute arbitrary code with the current user's privileges. Depending on ...[truncated 292 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin `requests` and all transitive dependencies to reviewed versions in a lock file. 2. Require package hashes, for example through a hash-locked requirements file and `pip install --require-hashes`. 3. Use an explicitly trusted package index and disable unintended extra indexes. 4. Prefer `python -m pip` so installation uses the intended Python interpreter. 5. Install dependencies inside an isolated virtual environment with no elevated privileges. 6. Replace broad `Bash(pip:*)` authorization with the narrowest command permission supported by the host. 7. Add automated dependency scanning and a controlled process for reviewing and updating pinned versions. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:37
Finding
API Key Exposed Through Plaintext Persistence and Command Arguments<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 37-49 **Vulnerability Type**: Insecure credential-handling guidance **Risk Level**: Medium ### Vulnerable Code ```markdown ```bash # Option A: Set in your current shell export SECTORS_API_KEY="your-api-key-here" # Option B: Add to your shell profile (~/.bashrc, ~/.zshrc) for persistence echo 'export SECTORS_API_KEY="your-api-key-here"' >> ~/.bashrc # Option C: Use a .env file in the project root (see .env.example) ``` For agent-specific configuration: - **Claude Code**: `claude config set env SECTORS_API_KEY your-api-key-here` - **OpenCode**: Set in `~/.config/opencode/config.json` under `env` - **Cursor**: Settings > Features > Environment Variables ``` ### Technical Analysis The instructions encourage storing the API key in plaintext shell profiles and agent configuration files. These files may be readable by other local processes, included in workstation backups, collected in diagnostic archives, or accidentally copied and shared. The `echo` and `claude config set` examples also place the credential directly in an interactive command. Depending on the shell and operating system, the key may be retained in shell history or temporarily exposed through process command-line inspection. The `.env` option does not include guidance on restrictive file permissions, source-control exclusion, or secret rotation. The referenced `.env.example` is also absent from the audited project, increasing the chance that users will create an incorrectly protected file. The API key's transmission in the `Authorization` header to `https://api.sectors.app/v1` is necessary for the declared functionality and is not itself unauthorized exfiltration. The identified weakness concerns local storage and handling of that credential. ### Attack Path 1. A user replaces `your-api-key-here` with a real Sectors API key and runs one of the documented commands. 2. The key is stored in shell history, a plaintext shell ...[truncated 859 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Prefer an operating-system credential manager, encrypted secret store, or the platform's protected secret facility. 2. Avoid placing real secrets directly in command-line arguments or commands likely to be retained in shell history. 3. If file-based configuration is unavoidable, store the secret outside the repository and require owner-only permissions, such as mode `0600` on supported systems. 4. Add `.env` and other secret-bearing configuration files to `.gitignore`; provide only a placeholder `.env.example` with no real credentials. 5. Document how to suppress or remove relevant shell-history entries safely. 6. Ensure agent configuration files containing credentials have restrictive ownership and permissions. 7. Document API-key rotation and immediate revocation procedures for suspected exposure. 8. Use narrowly scoped, short-lived credentials where the Sectors API supports them. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (18)

Tainted flow: 'headers' from os.environ.get (line 50, credential/environment) → requests.get (network output)

Critical
Category
Data Flow
Content
headers = {"Authorization": api_key}

    try:
        resp = requests.get(url, headers=headers, timeout=15)
    except requests.exceptions.ConnectionError:
        print(f"[!!] Cannot reach {BASE_URL}. Check your network connection.")
        sys.exit(3)
Confidence
90% confidence
Finding
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Content
user to set it: `export SECTORS_API_KEY="your-api-key-here"` or run the setup check script at `scripts/check_setup.py`.

## Setup

### 1. Set the API key

The API key must be available as the `SECTORS_API_KEY` environment variable.

```bash
# Option A: Set in your current shell
export SECTORS_API_KEY="your-api-key-here"

# Option B: Add to your shell profile (~/.bashrc, ~/.zshrc) for persistence
echo 'export SECTORS_API_KEY="your-api-key-here"' >> ~/.bashrc

# Option C: Use a .env file in the project root (see .env.example)
```

For agent-specific configuration:
- **Claude Code**: `claude config set env SECTORS_API_KEY your-api-key-here`
- **OpenCode**: Set in `~/.config/opencode/config.json` under `env`
- **Cursor**: Settings > Features > Environment Variables

### 2. Install the dependency

```bash
pip install requests
```

### 3. Verify setup (optional)

```bash
python scripts/check_setup.py
```

### Making requests

```python
import os
import requests

API_KEY = os.environ["SECTOR
Confidence
75% confidence
Finding
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Credential Access

High
Category
Privilege Escalation
Content
# Option B: Add to your shell profile (~/.bashrc, ~/.zshrc) for persistence
echo 'export SECTORS_API_KEY="your-api-key-here"' >> ~/.bashrc

# Option C: Use a .env file in the project root (see .env.example)
```

For agent-specific configuration:
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Lp1

High
Category
MCP Least Privilege
Confidence
88% confidence
Finding
This skill performs network access to an external API, but that capability is reportedly not covered by declared permissions. In permissioned agent environments, undeclared network behavior is a real governance and security issue even when the destination is legitimate, because it bypasses least-privilege expectations.

Lp1

High
Category
MCP Least Privilege
Confidence
88% confidence
Finding
This skill performs network access to an external API, but that capability is reportedly not covered by declared permissions. In permissioned agent environments, undeclared network behavior is a real governance and security issue even when the destination is legitimate, because it bypasses least-privilege expectations.

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Content
_VAR = "SECTORS_API_KEY"
BASE_URL = "https://api.sectors.app/v1"
TEST_ENDPOINT = "/subsectors/"


def main():
    # 1. Check environment variable
    api_key = os.environ.get(ENV_VAR)
    if not api_key:
        print(f"ERROR: {ENV_VAR} environment variable is not set.")
        print()
        print("Set it with one of:")
        print(f'  export {ENV_VAR}="your-api-key-here"')
        print(f'  echo \'export {ENV_VAR}="your-api-key-here"\' >> ~/.bashrc')
        print()
        print("Get your API key at: https://sectors.app/api")
        sys.exit(1)

    print(f"[ok] {ENV_VAR} is set ({len(api_key)} characters)")

    # 2. Check requests is installed
    try:
        import requests
    except ImportError:
        print("[!!] 'requests' library is not installed.")
        print("     Install it with: pip install requests")
        sys.exit(3)

    print("[ok] requests library is available")

    # 3. Test API connectivity
    url = f"{BASE_URL}{TEST_ENDPOINT}"
    headers = {"Author
Confidence
75% confidence
Finding
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

External Transmission

Medium
Category
Data Exfiltration
Content
import sys

ENV_VAR = "SECTORS_API_KEY"
BASE_URL = "https://api.sectors.app/v1"
TEST_ENDPOINT = "/subsectors/"
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
import sys

ENV_VAR = "SECTORS_API_KEY"
BASE_URL = "https://api.sectors.app/v1"
TEST_ENDPOINT = "/subsectors/"
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
import sys

ENV_VAR = "SECTORS_API_KEY"
BASE_URL = "https://api.sectors.app/v1"
TEST_ENDPOINT = "/subsectors/"
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
import sys

ENV_VAR = "SECTORS_API_KEY"
BASE_URL = "https://api.sectors.app/v1"
TEST_ENDPOINT = "/subsectors/"
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
import sys

ENV_VAR = "SECTORS_API_KEY"
BASE_URL = "https://api.sectors.app/v1"
TEST_ENDPOINT = "/subsectors/"
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
import sys

ENV_VAR = "SECTORS_API_KEY"
BASE_URL = "https://api.sectors.app/v1"
TEST_ENDPOINT = "/subsectors/"
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
import sys

ENV_VAR = "SECTORS_API_KEY"
BASE_URL = "https://api.sectors.app/v1"
TEST_ENDPOINT = "/subsectors/"
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
import sys

ENV_VAR = "SECTORS_API_KEY"
BASE_URL = "https://api.sectors.app/v1"
TEST_ENDPOINT = "/subsectors/"
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
import sys

ENV_VAR = "SECTORS_API_KEY"
BASE_URL = "https://api.sectors.app/v1"
TEST_ENDPOINT = "/subsectors/"
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
import sys

ENV_VAR = "SECTORS_API_KEY"
BASE_URL = "https://api.sectors.app/v1"
TEST_ENDPOINT = "/subsectors/"
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Low
Confidence
88% confidence
Finding
This is a markdown file, so missing-warning checks apply to documented behaviors affecting privacy or system integrity. The file states that requests require an `Authorization: <api_key>` header but provides no caution about protecting the API key, which could lead users to embed or expose credentials insecurely when following the reference.

Missing User Warnings

Low
Confidence
89% confidence
Finding
This markdown file documents requests to an external API and explicitly requires an Authorization header containing an API key. Under the markdown-specific warning rule, the description lacks any caution about credential handling, external transmission, or protecting the key from logs and sharing.