T09 · Insecure Skill Coding Practices
- Location
scripts/report.py:365- Finding
Stored HTML and Script Injection in Generated Financial Reports
- Content
View full analysis
Top Merchants\n \n" html += " \n" for m in report["top_merchants"]: html += f" " html += f"\n" html += "
\n" # Largest transactions if report["largest_transactions"]: html += "Merchant Amount Transactions {m['merchant']} {m['total_formatted']} {m['count']} Largest Transactions
\n \n" html += " \n" for l in report["largest_transactions"]: html += f" " html += f"\n" html += "
\n" ``` ### Technical Analysis Merchant names and transaction descriptions originate from imported CSV or OFX/QFX statements. These values are persisted in SQLite and later interpolated directly into HTML without HTML entity escaping. Because characters such as `<`, `>`, `"`, `'`, and `&` are not escaped, a crafted transaction description can break out of the intended table cell and introduce arbitrary HTML or JavaScript-capable elements. For example, a description containing an image element with an event handler would be emitted as active markup rather than displayed as text. This is a stored injection vulnerability: the malicious value is first saved in the transaction database and can execute later whenever an HTML report containing that transaction is generated and opened. ### Attack Path 1. An attacker creates or modifies a CSV, OFX, or QFX statement containing a transaction description with malicious HTML. 2. T ...[truncated 1221 chars]Date Description Amount Category {l['date']} {l['description']} {l['amount_formatted']} {l['category'] or ''} - Remediation
View remediation
