No single measure can fully prevent prompt injection. The realistic approach is to make attacks less likely to succeed through input checks, and to limit the damage when they do succeed through permissions, output destinations, and approvals. This article organizes where to place each measure along the flow of what an AI reads and what it can execute. For definitions and the overall risk picture, see our guide to generative AI security.
Entry points: what the AI reads and what it can execute
OWASP's LLM01:2026 describes prompt injection as a problem in which not only direct user input but also retrieved content, tool outputs, images, audio, video, and memory can cause model behavior the developer did not intend. Entry points for indirect injection include web pages, documents, email, text retrieved by RAG, MCP server output, and database rows (OWASP LLM01:2026). NIST distinguishes direct attacks, in which the attacker provides input as the primary user, from indirect attacks, in which a third party alters external resources the model ingests (NIST AI 100-2 E2025, §3.3–3.4).
Before choosing measures, list what your AI can read (web, email, RAG, MCP or APIs) and what it can execute (external transmission, access to confidential data). This makes it easier to decide where each measure belongs.
Six layers where defenses belong
The six layers below are this article's own organization; no public document defines a six-layer framework.

A. Checks before sending and before ingestion
Check not only user input but also retrieved documents and tool responses. Japan's Ministry of Internal Affairs and Communications (MIC) guideline lists validation of input prompts and external reference data (MIC guideline, Japanese, §3.4). Masking or blocking confidential and personal information before it is sent is a data-leak measure, not the same as detecting injection. Verify what the detection covers and its false-positive rate on real data.
B. Model and prompt
Make roles and prohibitions clear, and distinguish the source and trust level of external text (OWASP LLM01:2026). However, do not treat delimiters or the system prompt alone as an enforceable boundary (OWASP Cheat Sheet).
C. Output and downstream systems
Before passing a response to downstream systems, validate its structure, allowed values, sensitive information, and links or HTML in trusted application code. OWASP recommends strict schemas and application-side validation, while noting that semantically malicious content can remain even when the format is correct (OWASP LLM01:2026). The MIC guideline lists checking outputs for information that must not be disclosed, and the OWASP Cheat Sheet lists sanitizing HTML and Markdown before rendering (MIC guideline, Japanese, §3.4; OWASP Cheat Sheet).
D. Tools and permissions
Do not give credentials to the model; for each operation, have downstream code check the user's permissions, the target, and the arguments. Prefer read-only and short-lived permissions, and have a person review and approve the exact action for irreversible or external operations (OWASP LLM01:2026, OWASP Cheat Sheet, Microsoft Learn).
E. Logging and auditing
Make detection results, block reasons, tool calls, permission decisions, and approval results traceable. The MIC guideline lists keeping audit logs (MIC guideline, Japanese, §3.5). Avoid copying credentials and unnecessary sensitive inputs and outputs into logs (OWASP Cheat Sheet).
F. Red teaming and re-evaluation
Test direct and indirect attacks under realistic conditions, including actual tool permissions, RAG, supported languages, and images. OWASP recommends testing against attackers who know the deployed defenses (OWASP LLM01:2026). Japan's AI Safety Institute (J-AISI) guide recommends setting the criteria for judging an attack successful and the number of runs, and logging the test conditions and results. It also notes that the failure of the attacks tried does not guarantee that every attack will fail (J-AISI guide, Japanese, §2.5). Re-evaluate after changes.
Boundaries revealed by researchers' demonstrations
For GitLab Duo, researchers reported an experiment in which instructions embedded in code or issues caused Duo's responses to emit external image tags that sent private code. According to the researchers, they notified GitLab on February 12, 2025, and GitLab fixed the issue (Legit Security report). For Copilot Chat in VS Code, a demonstration showed an agent ingesting instructions from an issue and sending a local token externally; URL checks and confirmation for first-seen URLs were fixed (GitHub blog). Both are researchers' demonstrations, not reports of harm to users. The fixes that the published write-ups confirm are a restriction on the external HTML tags Duo's responses can render (GitLab Duo) and a confirmation before a tool opens a new URL (VS Code); both sit at downstream boundaries, namely output destinations and tool approvals.
Assume it cannot be fully prevented
The U.K. NCSC says products alone cannot completely remove the residual risk, which must be managed through design, build, and operation (NCSC). The MIC guideline likewise says that, given the nature of AI, completely eliminating the underlying causes is difficult even with countermeasures in place (MIC guideline, Japanese, §3.1).
What Japanese companies should check before adopting AI
Based on the primary sources above, this article sums up four points to check when deciding on adoption. They are our own summary, not a checklist defined by a public document.
- Have you listed what information the AI can read and what operations it can execute?
- Even if a check is bypassed, does downstream code verify permissions and arguments?
- Do irreversible operations require human approval?
- Do you test attacks and re-evaluate after each change?
Reduce success through detection, and reduce damage through permissions and approvals. In light of the OWASP and NCSC materials, we consider combining the two to be the core of prompt injection countermeasures.
At Elith, we offer GENFLUX Security, which detects, warns about, and blocks confidential and personal information that employees are about to send to external AI services; GENFLUX RedTeam, which, within a scope authorized by the customer, tries attacks on AI to check whether malicious instructions cause unintended answers or operations; and GENFLUX Evaluation, which evaluates the answer quality, safety, and resistance to attack cases of generative AI, RAG, and AI agents. They cover pre-send control of information, attack testing, and ongoing evaluation, respectively. The scope of GENFLUX RedTeam is arranged individually according to the target and how it is connected.
For testing AI weaknesses against malicious instructions such as prompt injection, see Elith's GENFLUX RedTeam.

