T09 · Insecure Skill Coding Practices
- Location
scripts/hot_scanner.py:22- Finding
Complete Process Environment Exposed to a Network-Capable Third-Party CLI
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This stock analysis skill is mostly purpose-aligned, but its optional social scanning handles session tokens and broad local access in ways users should review carefully.
Review before installing if you plan to use Twitter/X scanning. Prefer running hot scans with --no-social, do not grant Terminal Full Disk Access, avoid browser-cookie extraction when possible, keep AUTH_TOKEN and CT0 out of repositories and shared folders, and treat stored portfolio/watchlist JSON as private financial data.
scripts/hot_scanner.py:22Complete Process Environment Exposed to a Network-Capable Third-Party CLI
scripts/hot_scanner.py:363Unpinned Global Dependency and PATH-Resolved Executable Create a Supply-Chain Execution Risk
docs/HOT_SCANNER.md:132Setup Instructions Recommend Excessive Full Disk Access
scripts/portfolio.py:44Financial Portfolio and Watchlist Data Are Stored Without Explicit Restrictive Permissions
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).
GET /portfolios
POST /portfolios
PUT /portfolios/{id}
DELETE /portfolios/{id}
GET /portfolios/{id}/assets
POST /portfolios/{id}/assets
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).
GET /portfolios/{id}/assets
POST /portfolios/{id}/assets
PUT /portfolios/{id}/assets/{ticker}
DELETE /portfolios/{id}/assets/{ticker}
GET /portfolios/{id}/performance?period=weekly
GET /portfolios/{id}/summary
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).
GET /alerts
POST /alerts
DELETE /alerts/{id}
GET /user/subscription
POST /user/subscription/upgrade
The document states that the skill writes persistent portfolio data to a local path while no permissions are declared. Undeclared persistence is security-relevant because it can surprise users, retain sensitive financial positions on disk, and bypass least-privilege expectations for an analysis-oriented skill.
The document states that the skill writes persistent portfolio data to a local path while no permissions are declared. Undeclared persistence is security-relevant because it can surprise users, retain sensitive financial positions on disk, and bypass least-privilege expectations for an analysis-oriented skill.
The document states that the skill writes persistent portfolio data to a local path while no permissions are declared. Undeclared persistence is security-relevant because it can surprise users, retain sensitive financial positions on disk, and bypass least-privilege expectations for an analysis-oriented skill.
The document states that the skill writes persistent portfolio data to a local path while no permissions are declared. Undeclared persistence is security-relevant because it can surprise users, retain sensitive financial positions on disk, and bypass least-privilege expectations for an analysis-oriented skill.
The document states that the skill writes persistent portfolio data to a local path while no permissions are declared. Undeclared persistence is security-relevant because it can surprise users, retain sensitive financial positions on disk, and bypass least-privilege expectations for an analysis-oriented skill.
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.
- [ ] Add timeout per indicator (10s max)
- [ ] Test with multiple stocks in sequence
- [ ] Measure actual runtime improvement
- [ ] Update SKILL.md with new runtime (target: 3-4s)
**Expected Impact**:
- Reduce runtime from 6-10s to 3-4s per stock
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.
- [ ] Add timeout per indicator (10s max)
- [ ] Test with multiple stocks in sequence
- [ ] Measure actual runtime improvement
- [ ] Update SKILL.md with new runtime (target: 3-4s)
**Expected Impact**:
- Reduce runtime from 6-10s to 3-4s per stock
The documentation tells users to place Twitter/X auth secrets in a .env file inside the project directory, which is a common source of accidental disclosure via version control, backups, support bundles, or permissive filesystem access. Because the named values are session/authentication tokens rather than low-scope app credentials, exposure could allow direct abuse of the associated account.
Create .env file in the skill directory:
# /path/to/stock-analysis/.env
AUTH_TOKEN=your_auth_token_here
CT0=your_ct0_token_here
The code explicitly accesses a repository-adjacent .env file, which is a common location for API keys and tokens. In isolation this may be configuration handling, but in the context of subsequent subprocess invocation and network access it meaningfully raises the credential exposure risk.
from collections import defaultdict
from concurrent.futures import ThreadPoolExecutor, as_completed
# Load .env file if exists
ENV_FILE = Path(__file__).parent.parent / ".env"
if ENV_FILE.exists():
with open(ENV_FILE) as f:
Checking for and consuming .env content at startup indicates the skill is designed to ingest local credentials opportunistically. Because the skill also interacts with external services and passes environment variables to a subprocess, this behavior increases the potential for unauthorized credential access or leakage.
from concurrent.futures import ThreadPoolExecutor, as_completed
# Load .env file if exists
ENV_FILE = Path(__file__).parent.parent / ".env"
if ENV_FILE.exists():
with open(ENV_FILE) as f:
for line in f:
The scanner executes an external Twitter/X CLI and processes its output, which is a materially broader capability than simple finance-data retrieval. In an agent skill, invoking third-party binaries with ambient credentials creates a strong supply-chain and data-exfiltration risk if the binary is replaced, misconfigured, or behaves unexpectedly.
Copying the full process environment into the subprocess gives the external bird binary access to every loaded secret, including anything imported from .env. In this skill, that is especially dangerous because the binary is third-party and network-capable, so a compromise or malicious replacement could exfiltrate credentials without further barriers.
for category, query in searches:
try:
env = os.environ.copy()
result = subprocess.run(
[bird_bin, "search", query, "-n", "15", "--json"],
capture_output=True, text=True, timeout=30, env=env
Referencing a repository-adjacent .env file for runtime credentials is risky because such files are commonly mishandled, overbroad, or accidentally exposed, and they are later fed to an external process. In this skill, the danger is amplified by combining local secret loading with subprocess execution for third-party data collection.
# Bird CLI path
BIRD_CLI = "/home/clawdbot/.nvm/versions/node/v24.12.0/bin/bird"
BIRD_ENV = Path(__file__).parent.parent / ".env"
def load_env():
"""Load environment variables from .env file."""
The code actively reads the .env contents and imports every matching line into environment variables, which constitutes broad credential access without least privilege. This is more dangerous in context because the imported secrets are then available to downstream subprocesses and any imported libraries.
BIRD_ENV = Path(__file__).parent.parent / ".env"
def load_env():
"""Load environment variables from .env file."""
if BIRD_ENV.exists():
for line in BIRD_ENV.read_text().splitlines():
if '=' in line and not line.startswith('#'):
Copying the full process environment and passing it to a child process can expose unrelated secrets such as API keys, tokens, and credentials to the external Bird CLI. Since the script also preloads values from a local .env, the child process receives a much broader secret set than is necessary, increasing the blast radius if the CLI or its dependencies are compromised.
for query in queries[:4]: # Limit to avoid rate limits
try:
cmd = [BIRD_CLI, 'search', query, '-n', '10', '--json']
env = os.environ.copy()
result = subprocess.run(cmd, capture_output=True, text=True, timeout=30, env=env)
This second subprocess path has the same issue: it forwards the entire environment to an external executable during buzz searches. In a finance-analysis skill that may run in an automation context, broad environment inheritance materially raises the risk of credential exposure and unintended secret access.
for query in queries[:3]:
try:
cmd = [BIRD_CLI, 'search', query, '-n', '15', '--json']
env = os.environ.copy()
result = subprocess.run(cmd, capture_output=True, text=True, timeout=30, env=env)
This markdown file describes analytics and monitoring via Mixpanel/Amplitude, Sentry, and business KPI tracking, which can affect user privacy by collecting behavioral and error data. Although the document includes general security and compliance notes elsewhere, it does not warn users here that usage data and error telemetry may be collected or require consent/notice.
The README instructs users to obtain AUTH_TOKEN and CT0 directly from browser cookies and place them in a local .env file, but it does not warn that these are sensitive session credentials that can grant account access if exposed. In a skill intended for automation and social-media scraping, this increases the chance users mishandle high-value tokens, commit them to source control, or leak them through logs or support requests.
The skill advertises commands that invoke shell execution, network access, and persistent local storage, but it declares no explicit tool scope or permissions. This creates an authorization and transparency gap: a host may grant broader capabilities than users expect, and file/network actions can occur without clear consent boundaries.
The instructions tell users to place Twitter/X authentication tokens in a local .env file but do not warn about secrecy, file permissions, accidental commits, or reuse risk. This can lead to credential disclosure, account takeover of the linked social account, and unintended exposure through logs, backups, or version control.
This markdown file documents that the skill stores portfolio holdings, quantities, cost basis, target prices, and signals in portfolios.json and watchlist.json. Because this behavior affects user data and privacy, the skill description should clearly warn users that their financial data is persisted locally.
The documentation tells users how to obtain and use Twitter/X authentication material but does not warn that these values are effectively session secrets. Reusing browser-derived auth tokens in a local tool increases the chance of credential theft, account takeover, and unintended exposure through shell history, files, logs, or repository commits.