Back to skill

Security audit

Portfolio

Security checks for vulnerabilities and agentic risk

Overview

This is a local portfolio-tracking skill with disclosed file storage and no evidence of hidden network, credential, or persistence behavior beyond its own data files.

Install only if you are comfortable with a skill that can create and modify persistent local portfolio files under ~/.portfolio. Review commands before running remove operations, keep backups of important portfolio data, and avoid importing untrusted ticker values into CSV exports until validation and CSV escaping are improved.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/script.sh:201
Finding

Spreadsheet Formula Injection in CSV Export

Content
View full analysis
portfolio.csv ``` 4. The resulting file contains a formula-like cell: ```csv ticker,quantity,avg_price,value,date_added =1+1,10.0,100.0,1000.0,2026-09-12 ``` 5. When the CSV file is opened in compatible spreadsheet software, the ticker cell may be evaluated as a formula. 6. A more capable spreadsheet formula ...[truncated 856 chars]
Remediation
View remediation
&2 return 1 fi ``` 2. Generate CSV output with Python's standard `csv` module instead of manual string interpolation: ```python import csv import sys writer = csv.writer(sys.stdout) writer.writerow(['ticker', 'quantity', 'avg_price', 'value', 'date_added']) ``` 3. Neutralize spreadsheet formulas in every textual CSV field. Prefix values beginning with `=`, `+`, `-`, or `@` with an apostrophe: ```python def spreadsheet_safe(value): text = str(value) if text.startswith(('=', '+', '-', '@')): return "'" + text return text ``` 4. Apply neutralization to all attacker-controlled textual fields, including values loaded from pre-existing or manually modified JSON files. 5. Add regression tests covering formula prefixes, commas, quotation marks, line breaks, and ordinary ticker symbols. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/script.sh:63
Finding

Missing Numeric Validation Allows Portfolio Data Corruption

Content
View full analysis
Remediation
View remediation
h['quantity']: raise SystemExit("Removal quantity exceeds the current holding.") ``` 3. Define clear behavior for a removal quantity equal to the current holding, treating it as a complete removal without relying on an ambiguous fallback branch. 4. Check the weighted-average denominator before division and reject any operation that would produce a non-positive resulting quantity. 5. Consider using `decimal.Decimal` instead of binary floating-point values for financial quantities and prices. 6. Validate all records loaded from the JSON files before performing calculations so manually modified or previously corrupted records cannot propagate invalid values. 7. Write updates atomically by serializing to a securely created temporary file in the same directory, flushing it, and replacing the destination with `os.replace()` only after all validation and calculations succeed. 8. Add tests for zero, negative, non-numeric, `NaN`, infinity, oversized removal quantities, and quantities that exactly cancel an existing position. ]]>
Vulnerability Patterns
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (17)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 60)May include surrounding context.

md
bash scripts/script.sh add AAPL 100 150.50 --date 2024-01-15

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 63)May include surrounding context.

md
bash scripts/script.sh add AAPL 100 150.50 --date 2024-01-15

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 66)May include surrounding context.

md
bash scripts/script.sh add AAPL 100 150.50 --date 2024-01-15

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 69)May include surrounding context.

md
bash scripts/script.sh add AAPL 100 150.50 --date 2024-01-15

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 72)May include surrounding context.

md
bash scripts/script.sh add AAPL 100 150.50 --date 2024-01-15

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 75)May include surrounding context.

md
bash scripts/script.sh add AAPL 100 150.50 --date 2024-01-15

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 78)May include surrounding context.

md
bash scripts/script.sh add AAPL 100 150.50 --date 2024-01-15

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 81)May include surrounding context.

md
bash scripts/script.sh add AAPL 100 150.50 --date 2024-01-15

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 84)May include surrounding context.

md
bash scripts/script.sh add AAPL 100 150.50 --date 2024-01-15

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 87)May include surrounding context.

md
bash scripts/script.sh add AAPL 100 150.50 --date 2024-01-15

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 90)May include surrounding context.

md
bash scripts/script.sh add AAPL 100 150.50 --date 2024-01-15

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 93)May include surrounding context.

md
bash scripts/script.sh add AAPL 100 150.50 --date 2024-01-15

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 96)May include surrounding context.

md
bash scripts/script.sh add AAPL 100 150.50 --date 2024-01-15

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 108)May include surrounding context.

md
bash scripts/script.sh add AAPL 100 150.50 --date 2024-01-15

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 109)May include surrounding context.

md
bash scripts/script.sh add AAPL 100 150.50 --date 2024-01-15

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill describes filesystem write behavior (~/.portfolio/ JSON storage) and implies use of environment/filesystem capabilities, but it does not declare any permissions or allowed-tools scope. This creates a least-privilege gap: an agent may invoke a skill that can read environment context and write local files without any explicit tool contract, making review, sandboxing, and policy enforcement weaker.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The remove command performs destructive changes to the portfolio state immediately, with no confirmation prompt, dry-run mode, or safety interlock. In an agent-driven or automated context, a mistaken ticker, bad parsing, or unintended invocation can silently delete or reduce holdings data, causing integrity loss and potentially incorrect downstream portfolio analysis or advice.

Content

No source excerpt is available for this finding.