Back to skill

Security audit

Fakturownik

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent Polish VAT invoice generator with some privacy and CSV-safety caveats, but no evidence of hidden access, exfiltration, or unsafe persistence.

Use this skill only with business data you are comfortable storing or exposing in generated invoice files. Be cautious with CSV exports from untrusted customer-supplied fields, and verify any PRO email/history version before giving it SMTP credentials or relying on local invoice retention.

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

T09 · Insecure Skill Coding Practices

Warning
Location
fakturator.py:237
Finding

CSV Formula Injection Through Unescaped Invoice Fields

Content
View full analysis

Vulnerability Details

File Location: fakturator.py:237-256
Vulnerability Type: CSV formula injection
Risk Level: Medium

Vulnerable Code

python
lines.append(f"Numer;{invoice['invoice_number']}")
lines.append(f"Data wystawienia;{invoice['invoice_date']}")
lines.append(f"Data sprzedaży;{invoice['sale_date']}")
lines.append(f"Termin płatności;{invoice['payment_date']}")
lines.append(f"Forma płatności;{invoice['payment_method']}")
lines.append("")
lines.append("SPRZEDAWCA")
lines.append(f"Nazwa;{invoice['seller']['name']}")
lines.append(f"Adres;{invoice['seller']['address']}")
lines.append(f"NIP;{invoice['seller']['nip']}")
lines.append("")
lines.append("NABYWCA")
lines.append(f"Nazwa;{invoice['buyer']['name']}")
lines.append(f"Adres;{invoice['buyer']['address']}")
lines.append(f"NIP;{invoice['buyer']['nip']}")
lines.append("")
lines.append("POZYCJE")
lines.append("Lp;Nazwa;Ilość;Cena jedn.;VAT %;Netto;Brutto")
for i, item in enumerate(invoice['items'], 1):
    lines.append(f"{i};{item.get('name','')};{item.get('quantity',1)};{item.get('amount',0)};{item.get('vat_pct',23)};{item.get('total',0)};{item.get('brutto',0)}")

Technical Analysis

The CSV formatter inserts invoice data directly into semicolon-delimited cells without applying CSV quoting or spreadsheet formula neutralization. Several of these values—including invoice numbers, payment fields, seller and buyer details, addresses, and item names—may originate from an external party.

Spreadsheet applications may treat a cell beginning with =, +, -, or @ as a formula rather than plain text. Consequently, a value such as:

text
=HYPERLINK("https://attacker.example","Open invoice")

can retain formula semantics in the generated output. The implementation also fails to escape semicolons, quotation marks, carriage returns, and line feeds, allowing attackers to alter the apparent row and column structure and place a formula at the beginning of a new cell.

Using Pyth ...[truncated 1522 chars]

Remediation
View remediation

Remediation Suggestions

  1. Serialize rows with Python's standard csv module instead of manually joining fields. Configure the intended semicolon delimiter and explicit newline handling.
  2. Treat every externally controlled text value as potentially dangerous, including invoice metadata, seller and buyer fields, payment fields, notes, and item names.
  3. Before CSV serialization, neutralize values whose first effective character is =, +, -, or @. Account for leading spaces, tabs, carriage returns, and line feeds that may be ignored by spreadsheet applications.
  4. Prefix dangerous values with an apostrophe or apply another documented safe-text convention appropriate for the supported spreadsheet applications.
  5. Preserve numeric fields as validated numeric types rather than accepting arbitrary strings.
  6. Add tests covering formula prefixes, leading whitespace, semicolons, quotation marks, embedded CR/LF characters, and multiline values.
  7. Document that CSV exports contain untrusted business data and should be imported as text where spreadsheet software supports explicit column typing.

A possible defensive helper is:

python
import csv
import io

FORMULA_PREFIXES = ("=", "+", "-", "@")

def safe_spreadsheet_text(value):
    text = str(value)
    if text.lstrip(" \t\r\n").startswith(FORMULA_PREFIXES):
        return "'" + text
    return text

def write_csv_rows(rows):
    output = io.StringIO(newline="")
    writer = csv.writer(
        output,
        delimiter=";",
        quotechar='"',
        quoting=csv.QUOTE_ALL,
        lineterminator="\n",
    )
    for row in rows:
        writer.writerow([safe_spreadsheet_text(value) for value in row])
    return output.getvalue()

Numeric fields should be handled separately where possible so that legitimate negative numbers are not unnecessarily converted to text.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (4)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill advertises invoice history and persistent storage of seller/buyer company data, but does not warn that these records may be written to files containing sensitive business and personal information such as names, addresses, and tax IDs. This creates a privacy and confidentiality risk because users may unknowingly store regulated or sensitive data on disk without understanding retention, access controls, or backup exposure.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The PRO feature states that invoices can be sent directly to clients via SMTP, but it does not warn users that this may transmit invoice data externally and require handling of email credentials and recipient information. That omission is risky because invoices often contain personal and financial data, and users may not realize the privacy, misdelivery, and credential exposure implications of enabling email delivery.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file’s docstring and command/output text consistently force Polish-language interaction, and there is no opt-in, language selection, or justification that this tool is intentionally limited to a Polish-only audience. This is a natural-language locale policy concern because the skill imposes a specific language on all users by default.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

In demo mode, the script silently creates /home/node/.openclaw/workspace/fakturownik/demo_faktura.txt and only informs the user after the write has already happened. For a code file, file writes should have some prior disclosure via a prompt, warning comment/docstring, or clearly stated user-facing notice before the operation occurs.

Content

No source excerpt is available for this finding.