---
id: post/demiliani-com/17609
type: post
title: "AI and prompt injections: the invoice that approves itself."
summary: "Demonstrates indirect prompt injection against an external AI invoice extraction pipeline (.NET with Azure OpenAI) that creates payment records in Business Central: hidden white text in a PDF swaps the IBAN and marks the invoice as approved. Presents a five-layer defense: hidden text detection, sending rendered page images to the model, strict schemas, no approval field, and deterministic IBAN checks against vendor master data."
tier: community
language: en
tags:
  - prompt injection
  - ai security
  - document processing
  - invoice processing
  - payment fraud
  - indirect injection
  - threat modeling
system: integration
review:
  state: reviewed
  by: opus
  at: "2026-11-15T00:47:30.781Z"
  flags: []
generated:
  at: "2026-11-15T00:17:15.357Z"
  pipeline: 0.2.0
  prompts:
    extract-post: 1
  input_hash: 313fbc77d1121523880aeed0754d918d2daecea2c1451b912b80c8c250b0d7dd
evidence:
  - kind: blog
    url: https://demiliani.com/2026/11/13/ai-and-prompt-injections-the-invoice-that-approves-itself/
    title: "AI and prompt injections: the invoice that approves itself."
    date: "2026-11-13"
    commit: null
    t: null
    quote: null
  - kind: blog
    url: https://demiliani.com/2026/11/13/ai-and-prompt-injections-the-invoice-that-approves-itself/
    title: "AI and prompt injections: the invoice that approves itself."
    date: "2026-11-13"
    commit: null
    t: null
    quote: Your AI will believe anything a document tells it. Build a system that doesn't.
  - kind: blog
    url: https://demiliani.com/2026/11/13/ai-and-prompt-injections-the-invoice-that-approves-itself/
    title: "AI and prompt injections: the invoice that approves itself."
    date: "2026-11-13"
    commit: null
    t: null
    quote: Prompt injection isn't a bug you patch in the prompt. It's a trust problem you solve in the design.
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
post_id: "17609"
source_id: demiliani-com
source_name: Stefano Demiliani
url: https://demiliani.com/2026/11/13/ai-and-prompt-injections-the-invoice-that-approves-itself/
published_at: "2026-11-13T10:22:58.000Z"
author: Stefano Demiliani
full_text: false
words: 3346
quotes:
  - text: Your AI will believe anything a document tells it. Build a system that doesn't.
    why_it_matters: "Core principle: security must be in the system design and architecture, not relying on AI behavior or prompts alone"
  - text: Prompt injection isn't a bug you patch in the prompt. It's a trust problem you solve in the design.
    why_it_matters: Reframes the security challenge as an architectural issue requiring deterministic controls, not just better instructions
code_objects_mentioned: []
systems:
  - integration
  - finance
versions_mentioned: []
cautions:
  - kind: warning
    quote: Prompt injection happens when text supplied by someone other than the developer changes what the model does.
    objects: []
    events: []
    versions: []
  - kind: warning
    quote: Indirect injection is the dangerous one for business applications, because the attacker only needs to get a document into your workflow.
    objects: []
    events: []
    versions: []
  - kind: warning
    quote: Never ask the model for a decision the document could influence.
    objects: []
    events: []
    versions: []
preview:
  embeddable: true
  frame_url: https://demiliani.com/2026/11/13/ai-and-prompt-injections-the-invoice-that-approves-itself/embed/
  image: https://i0.wp.com/demiliani.com/wp-content/uploads/2026/11/aipdfinjection_00.png?fit=1200%2C675&ssl=1
  image_alt: null
  image_w: 1200
  image_h: 675
  site_name: Stefano Demiliani
  favicon: https://demiliani.com/wp-content/uploads/2022/09/sd_wordpress_logo.png?w=32
  probed_at: "2026-11-15T00:42:41.115Z"
---

# AI and prompt injections: the invoice that approves itself.

[Read the post](https://demiliani.com/2026/11/13/ai-and-prompt-injections-the-invoice-that-approves-itself/) · Stefano Demiliani (Stefano Demiliani, MVP) · 2026-11-13 · 3346 words · tier community · reviewed (checked by Opus)

> Demonstrates indirect prompt injection against an external AI invoice extraction pipeline (.NET with Azure OpenAI) that creates payment records in Business Central: hidden white text in a PDF swaps the IBAN and marks the invoice as approved. Presents a five-layer defense: hidden text detection, sending rendered page images to the model, strict schemas, no approval field, and deterministic IBAN checks against vendor master data.

## Key points

- Indirect prompt injection occurs when untrusted documents contain hidden instructions that manipulate AI model behavior, posing risk to invoice processing and payment automation
- PDFs are effective attack vectors because text extractors capture invisible content (white text, tiny fonts, hidden metadata) that humans cannot see
- A vulnerable pipeline allows the AI model to extract data, make approval decisions, and directly influence business transactions without validation
- Defense requires five layered controls: hidden text detection, rendering pages as images for vision models, strict output schemas, removing decision fields, and deterministic validation against master data
- The architecture and design determine security more than the prompt; payment decisions must come from internal workflow and verified data, never from document content

## Quotes

- "Your AI will believe anything a document tells it. Build a system that doesn't." (Core principle: security must be in the system design and architecture, not relying on AI behavior or prompts alone)
- "Prompt injection isn't a bug you patch in the prompt. It's a trust problem you solve in the design." (Reframes the security challenge as an architectural issue requiring deterministic controls, not just better instructions)

## Heads up

- warning: "Prompt injection happens when text supplied by someone other than the developer changes what the model does."
- warning: "Indirect injection is the dangerous one for business applications, because the attacker only needs to get a document into your workflow."
- warning: "Never ask the model for a decision the document could influence."

## Context

- Features: Invoice extraction with AI, Document intake automation, Prompt injection detection, Hidden text analysis, Vision model-based document processing, Structured outputs with strict schemas, Master data validation, Payment approval workflow

Source: Stefano Demiliani, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.
