LLM Application Security interview questions

30 questions from the LLM Application Security course, each with the correct answer and an explanation. Try to answer before you open the answer.

Why LLM Apps Need Their Own Security Thinking

1. What is the core reason prompt injection is possible?

  1. Prompts are too short
  2. Models run on weak hardware
  3. The model receives instructions and untrusted data as one stream of text
  4. Because of slow networks
Show answer

Answer: The model receives instructions and untrusted data as one stream of text

There is no reliable boundary between code and data inside a prompt.

Lesson: What Is Different About LLM Applications

2. Which is an entry point where untrusted text can reach the prompt?

  1. A retrieved web page or document
  2. The GPU driver version
  3. The Wi-Fi password
  4. The monitor brightness
Show answer

Answer: A retrieved web page or document

Any content the model reads is a potential instruction source.

Lesson: Assets, Attackers and Trust Boundaries

3. Which combination is the "lethal trifecta"?

  1. Logging + metrics + dashboards
  2. Fast GPU + big RAM + cheap storage
  3. Short prompt + low temperature + small model
  4. Private data + untrusted content + external communication
Show answer

Answer: Private data + untrusted content + external communication

With all three, an injection can read secrets and send them out.

Lesson: Blast Radius: What Can a Compromised Model Do

4. Which principle underlies most of the fixes?

  1. Using longer prompts
  2. Least privilege and validating everything that crosses a boundary
  3. Hiding the model name
  4. Using more GPUs
Show answer

Answer: Least privilege and validating everything that crosses a boundary

Classic security principles still apply and do most of the work.

Lesson: A Map of the Main Risk Families

Prompt Injection and Jailbreaks

5. Why is indirect injection often more dangerous?

  1. It needs a bigger model
  2. The victim never sees the malicious text and the assistant may hold the victim's privileges
  3. It only affects logs
  4. It is always blocked by HTTPS
Show answer

Answer: The victim never sees the malicious text and the assistant may hold the victim's privileges

Attackers can plant text anywhere the assistant will later read.

Lesson: Direct and Indirect Prompt Injection

6. What is the right role for injection filters?

  1. Useless in every case
  2. The complete solution
  3. A replacement for access control
  4. One layer and a monitoring signal, not the only defence
Show answer

Answer: One layer and a monitoring signal, not the only defence

Combine filters with architectural limits on what the model can do.

Lesson: Why Keyword Filters Are Not Enough

7. Where should access rules be enforced instead of in the system prompt?

  1. In application code and the data layer
  2. In a longer system prompt
  3. In the user's browser
  4. Nowhere
Show answer

Answer: In application code and the data layer

Prompts can be extracted or overridden; code-level checks cannot be talked around.

Lesson: System Prompt Leakage and Canary Tokens

8. Which layer is generally the strongest against injection?

  1. A longer system prompt
  2. Asking the model politely to be careful
  3. Limiting what the model can do (capabilities and permissions)
  4. A keyword blocklist alone
Show answer

Answer: Limiting what the model can do (capabilities and permissions)

Capability limits bound the damage even when manipulation succeeds.

Lesson: Defence in Depth Against Injection

Insecure Output Handling

9. How should model output be treated when it is used to build a database query?

  1. As raw SQL to execute
  2. As trusted because the model wrote it
  3. As untrusted input passed through parameterised queries
  4. As a password
Show answer

Answer: As untrusted input passed through parameterised queries

Origin in a model does not make text safe.

Lesson: The Rule: Treat Model Output Like User Input

10. Which design is safest for "ask questions about the database"?

  1. Model fills parameters of fixed queries, or runs read-only SQL with strict limits
  2. Run any SQL the model writes as admin
  3. Disable authentication
  4. Store passwords in the prompt
Show answer

Answer: Model fills parameters of fixed queries, or runs read-only SQL with strict limits

Constrain the model to parameters and least-privilege access.

Lesson: SQL Injection Through Model Output

11. How can a rendered Markdown image leak data?

  1. It cannot
  2. Images always contain viruses
  3. Images change the model weights
  4. The browser fetches the image URL, and the URL itself can carry a secret to the attacker
Show answer

Answer: The browser fetches the image URL, and the URL itself can carry a secret to the attacker

No click is needed: rendering triggers the request.

Lesson: Cross-Site Scripting and Markdown/Link Exfiltration

12. Why is calling a program with an argument list safer than shell=True?

  1. It runs faster on GPUs
  2. Each value stays a single argument and is never interpreted as shell syntax
  3. It hides the output
  4. Shells are illegal
Show answer

Answer: Each value stays a single argument and is never interpreted as shell syntax

Without a shell, characters like ; and && have no special meaning.

Lesson: Command Injection and Path Traversal

13. Why compare the parsed hostname rather than check whether the URL "contains" an allowed domain?

  1. Substring checks are slower
  2. Tricks like docs.example.com.evil.test contain the allowed name but go elsewhere
  3. Hostnames are not case sensitive only
  4. There is no difference
Show answer

Answer: Tricks like docs.example.com.evil.test contain the allowed name but go elsewhere

Parse first, then compare the real host exactly.

Lesson: Tools That Fetch URLs: SSRF and Allow-Lists

Excessive Agency and Tool Security

14. Which is an example of excess permissions?

  1. A human approval step
  2. A tool that reads one order for the current user
  3. A tool with a clear schema
  4. An admin database login used for a read-only lookup
Show answer

Answer: An admin database login used for a read-only lookup

Credentials broader than the task widen the blast radius.

Lesson: Over-Broad Tools, Permissions and Autonomy

15. What should happen to a tool the policy does not know?

  1. Deny by default
  2. Allow because the model asked
  3. Allow once, then ask
  4. Ignore the policy
Show answer

Answer: Deny by default

Default-deny means new or injected tool names cannot slip through.

Lesson: A Policy Engine Outside the Model

16. Why bind the approval to the exact action?

  1. To avoid logging
  2. To make approvals slower
  3. So the amount or target cannot be changed after the human said yes
  4. Approvals do not need binding
Show answer

Answer: So the amount or target cannot be changed after the human said yes

An unbound "yes" can be reused for a different, harmful action.

Lesson: Human Approval That Cannot Be Tampered With

17. What is a "confused deputy" in an LLM app?

  1. A missing comma
  2. A slow model
  3. A privileged assistant tricked into doing something the requesting user is not allowed to do
  4. A type of GPU
Show answer

Answer: A privileged assistant tricked into doing something the requesting user is not allowed to do

Authorise as the end user so the assistant cannot exceed the user's rights.

Lesson: Per-User Authorisation and Audit Logging

Protecting Data: Disclosure, RAG and Poisoning

18. What is the strongest control against sensitive data leaking through an LLM app?

  1. Not sending sensitive data to the model or logs in the first place
  2. Asking the model not to repeat it
  3. A longer system prompt
  4. Using more tokens
Show answer

Answer: Not sending sensitive data to the model or logs in the first place

Data that never enters the prompt cannot be repeated.

Lesson: Sensitive Information Disclosure and Redaction

19. Where must RAG permissions be enforced?

  1. Nowhere
  2. Only by asking the model to hide secrets
  3. Only in the UI
  4. In the retrieval query, so forbidden text never enters the prompt
Show answer

Answer: In the retrieval query, so forbidden text never enters the prompt

Once text is in the prompt, you cannot rely on the model to keep it private.

Lesson: RAG Access Control and Vector Store Security

20. Why store provenance (source, author, date) with each chunk?

  1. To make chunks larger
  2. To trace, cite and remove poisoned or outdated content
  3. Because models require it
  4. There is no benefit
Show answer

Answer: To trace, cite and remove poisoned or outdated content

You can only clean up what you can trace.

Lesson: Data Poisoning and Untrusted Knowledge Sources

Supply Chain, Abuse and Cost Attacks

21. Why is loading a pickle file from an unknown source risky?

  1. Pickle files are always too large
  2. Unpickling can execute arbitrary code during loading
  3. Pickle cannot store numbers
  4. It only slows down training
Show answer

Answer: Unpickling can execute arbitrary code during loading

Prefer data-only formats and verify the source of any model file.

Lesson: Models, Packages and Plugins as Dependencies

22. What is a "rug pull" for a tool?

  1. It is a type of cache
  2. It runs very slowly
  3. It is deleted by the user
  4. It changes its behaviour or description after you approved it
Show answer

Answer: It changes its behaviour or description after you approved it

Re-review third-party tools whenever they update.

Lesson: Plugins, MCP Servers and Agent Tool Trust

23. What does a spend cap with alerts protect against?

  1. A surprise bill from abuse, bugs or runaway loops
  2. Spelling mistakes
  3. Slow typing
  4. Missing semicolons
Show answer

Answer: A surprise bill from abuse, bugs or runaway loops

Budgets and rate limits bound the damage of abuse.

Lesson: Unbounded Consumption: Rate Limits and Denial of Wallet

Testing, Monitoring and Response

24. Why keep every discovered bypass as a permanent test?

  1. Because tests are free to write
  2. To make the suite look big
  3. So the same weakness cannot silently return later
  4. It is not useful
Show answer

Answer: So the same weakness cannot silently return later

Regression tests protect fixes across prompt, model and tool changes.

Lesson: Red-Teaming and Security Regression Tests

25. A canary token from the system prompt appears in a reply. What does it indicate?

  1. The model is faster
  2. Everything is fine
  3. The system prompt was leaked and the response should be blocked and reviewed
  4. The user is a developer
Show answer

Answer: The system prompt was leaked and the response should be blocked and reviewed

Canaries turn silent leakage into a detectable event.

Lesson: Monitoring, Detection and Logging

26. After an incident, what is usually the right kind of fix?

  1. Adding the missing control (permissions, validation, limits) and a regression test
  2. Only rewording the system prompt
  3. Hoping it does not recur
  4. Deleting the logs
Show answer

Answer: Adding the missing control (permissions, validation, limits) and a regression test

Controls outside the model are more reliable than wording.

Lesson: Incident Response and Secure Development Habits

Putting It Together

27. Which design choice breaks the "lethal trifecta" in this assistant?

  1. Using more logging
  2. Using a larger model
  3. Using a longer prompt
  4. The assistant drafts emails and a human sends them, so it has no free outbound channel
Show answer

Answer: The assistant drafts emails and a human sends them, so it has no free outbound channel

Removing one leg of the trifecta prevents exfiltration through that route.

Lesson: Case Study: Securing a Customer-Support Assistant

28. A retrieved web page tells the assistant to email the customer list to an outsider. Which control most reliably prevents harm?

  1. A polite system prompt
  2. The assistant has no unrestricted email tool and cannot access the whole customer list
  3. A keyword blocklist alone
  4. A bigger context window
Show answer

Answer: The assistant has no unrestricted email tool and cannot access the whole customer list

Capability limits bound damage even when manipulation succeeds.

Lesson: Revision: Cheat Sheet and Self-Check

29. Model output is placed into an SQL string. What is the correct fix?

  1. Ask the model to avoid quotes
  2. Use parameterised queries (and least-privilege database access)
  3. Remove the database
  4. Use uppercase
Show answer

Answer: Use parameterised queries (and least-privilege database access)

Parameters keep values from being interpreted as SQL.

Lesson: Revision: Cheat Sheet and Self-Check

30. Why must RAG permission filtering happen in the retrieval query?

  1. It is only cosmetic
  2. It makes retrieval slower on purpose
  3. Models cannot read permissions
  4. Text that reaches the prompt can leak, whatever the model is told to hide
Show answer

Answer: Text that reaches the prompt can leak, whatever the model is told to hide

Keep forbidden content out of the prompt entirely.

Lesson: Revision: Cheat Sheet and Self-Check

← Back to the course