Skip to content

Spot the Vulnerability

Run the Spot the Vulnerability MicroSim Fullscreen

About This MicroSim

Each card describes one piece of code in a few words. Your job is to say what is wrong with it. There are seven choices: SQL injection, cross-site scripting, cross-site request forgery, broken access control, CORS misconfiguration, missing security headers and prompt injection.

After you name the family, you pick one fix from three. Then the sim shows both answers and the reason. Picking the fix checks that you see how the flaw works, not just its name.

Several cards look alike on the surface. Two involve pasting text and two involve the browser. The summary at the end groups the cards by family, so you can see that pairs that looked different belong together.

Cards 4, 7 and 8 draw on the book's running example. The other seven are illustrative and are labeled that way on the card.

How to Use

  1. Read the card and pick the vulnerability. Your first answer is final.
  2. Pick one of the three fixes.
  3. Read the answer, the reason and what you picked. Press Next card.
  4. The dots along the bottom track your progress. Blue means fully correct, orange means not. Hover an answered dot to read that card again.
  5. After ten cards, the summary groups them by family. Hover a card to see its text and your answer. Press Start over to try again.

Iframe Embed Code

You can add this MicroSim to any web page by adding this to your HTML:

<iframe src="https://arunbatchu.github.io/good-enough-engineering/sims/spot-the-vulnerability/main.html"
        height="604px"
        width="100%"
        scrolling="no"></iframe>

Lesson Plan

Grade Level

Adult professional (Good Enough Engineering)

Duration

10-15 minutes

Prerequisites

Injection attack, SQL injection, parameterized query, cross-site scripting, cross-site request forgery, broken access control, CORS, security headers and prompt injection, from Chapter 16.

Learning Objective

Differentiate among seven common web vulnerabilities by assigning each of ten described code behaviors from the dating-safety app to the vulnerability it creates and choosing its fix.

Activities

  1. Exploration (5 min): Work through all ten cards.
  2. Guided Practice (5 min): Look at the pairs in the summary: cards 1 and 9, 2 and 10, 4 and 8. For each pair, name the one feature that puts both cards in the same family.
  3. Assessment (5 min): Run the curl header check from the chapter against a site you run, and say which card it matches.

Assessment

Mastery is 8 of 10 cards fully correct, family and fix, on the first attempt. Watch for these mistakes:

  • Believing React makes cross-site scripting impossible.
  • Believing CORS protects the API from all callers.
  • Treating a hidden button as access control.
  • Assuming every query built by an ORM is parameterized.
  • Trusting text because the app's own AI model wrote it.

References

  1. OWASP Top Ten - The most common web application security risks, including injection and broken access control.
  2. OWASP Top 10 for LLM Applications: Prompt Injection - How text fed to a model can act as instructions.
  3. MDN: Cross-Origin Resource Sharing (CORS) - What CORS does and does not protect.
  4. Chapter 16: Security as a Habit - The chapter this MicroSim supports.