AI & automation

How to threat-model a small AI application

Learn how to conduct an LLM threat modeling assessment for small firm workflows by mapping data flows, identifying injection points, and setting boundaries.

To threat-model a small AI application, map every step where external data enters your system and assign explicit boundaries around autonomous actions. Small firms must separate data ingestion from direct tool execution. By isolating input stages and inserting human verification before writing data or sending messages, you protect sensitive operational databases from untrusted external content.

Map data flows and identify primary attack surfaces

Begin your security assessment by detailing how data moves through your firm. Trace every document, email, and API payload from its origin to its final destination. AI applications introduce risks when models process untrusted text alongside system instructions NIST generative AI risk profile.

Draw a physical diagram of your pipeline. Identify each point where an external party controls the incoming text. If an automated script fetches emails or parses uploaded files, that ingestion point represents a primary attack surface. Document every downstream database write, web request, or file creation triggered by that input. Knowing exactly where untrusted text interacts with your processing scripts allows your team to apply targeted controls rather than relying on blanket assumptions.

Analyze a document processing workflow

Consider a synthetic client onboarding workflow designed to process incoming PDF application forms. The system operates across three distinct operational steps.

Step 1: Ingestion. A web server receives an application PDF from a client and extracts raw text.
Step 2: Analysis. An LLM reads the extracted text and outputs a structured summary.
Step 3: Storage. A script takes the structured output and writes it directly to the firm database.

In this setup, Step 2 is the primary injection surface. If a applicant embeds hidden malicious text inside the PDF, the model in Step 2 might execute those instructions. If Step 3 runs automatically, the untrusted input directly alters your database.

Recognize implicit trust and unverified execution failures

A common failure in small firm automation occurs when developers assume that structured outputs from a model are inherently safe. If a team configures an LLM to generate SQL queries or JSON payloads for direct database insertion, they bypass standard input validation.

When a model processes text containing hidden operational commands, it can return formatted JSON containing destructive parameters. If your application executes those commands without validating field lengths, data types, or permission levels, an attacker gains unauthorized influence over your storage layer. Never pass raw model output directly into internal API endpoints or database execution functions without strict schema validation.

Implement boundary controls and verification steps

To secure the document workflow, enforce strict architectural boundaries. Introduce programmatic sanitization between ingestion and model analysis. Strip binary objects, unexpected formatting, and hidden metadata before passing text to the LLM.

Next, place a mandatory human-in-the-loop checkpoint between analysis and storage. Instead of updating database records automatically, route the model summary to a staff queue. Require an employee to review the extracted fields before committing the data.

Verify this control by feeding synthetic test files containing hidden operational text through the pipeline. Ensure the workflow flags the file, blocks database writes, and alerts the reviewer.