T09 · Insecure Skill Coding Practices
- Location
SKILL.md:114- Finding
Mandatory invoice and taxpayer identifiers are treated as optional
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 114–129
Vulnerability Type: Improper input validation
Risk Level: Highpython invoice_num = root.find('.//InvoiceNumber') if invoice_num is not None and invoice_num.text: result["invoice_number"] = invoice_num.text.strip() seller_id = root.find('.//SellerIdNum') if seller_id is not None and seller_id.text: result["seller_id"] = seller_id.text.strip() buyer_id = root.find('.//BuyerIdNum') if buyer_id is not None and buyer_id.text: result["buyer_id"] = buyer_id.text.strip()Technical Analysis
The documented validation requirements identify
InvoiceNumber,SellerIdNum, andBuyerIdNumas mandatory fields. The implementation, however, only processes these elements when they exist and contain text. It does not append an error when any of them is absent or empty.Consequently, an XML document can omit all three identifiers and still reach a successful result if the few other checked fields are present. The conditional validation of
InvoiceNumberalso means its 20-digit format is enforced only when a value has already been supplied.Attack Path
- An attacker creates an XML document with an
EInvoiceroot. - The attacker supplies a valid-looking 20-digit
EIid, anEInvoiceTag, a non-emptySignatureValue, and aTaxBureauName. - The attacker omits
InvoiceNumber,SellerIdNum, andBuyerIdNum, or leaves them empty. - The relevant conditional blocks are skipped without recording validation errors.
- The validator can return a successful result for an incomplete or fabricated invoice.
Impact Assessment
This issue does not grant operating-system privileges or code execution. Its impact is limited to the validator's trust boundary and systems that rely on its output. Incomplete or fabricated invoices may be classified as valid, potentially weakening accounting, compliance, ingestion, or fraud-detection workflows.
- An attacker creates an XML document with an
- Remediation
View remediation
Remediation Suggestions
- Add explicit errors for every missing or empty mandatory field.
- Validate
InvoiceNumberas exactly 20 digits regardless of whether the element is absent, empty, or malformed. - Define and enforce appropriate formats for seller and buyer taxpayer identifiers.
- Reject duplicate mandatory elements rather than silently accepting the first match.
- Add negative tests covering absent, empty, malformed, and duplicate fields.
- Derive the final result from a complete mandatory-field checklist rather than from the absence of errors generated by partial checks.
