Web security

The attacks every web service must fend off: SQL injection, XSS, CSRF, session theft, badly stored passwords, and the protections that really work. Mechanisms, scenarios and defences, every answer explained.

  • 34 cards
  • 4 topics
  • Free

The outline, topic by topic

Each topic is weighted the way the exam weighs it.

  1. Injections
  2. XSS
  3. CSRF and sessions
  4. Passwords and privileges

A few cards from the deck

  • What is “SQL injection”?

    Show the answer

    An attack where data sent by the user is interpreted as SQL code

    It happens when a query is built by pasting outside text into it: the attacker can then read, change or delete data.

  • What is the real defence against SQL injection?

    • Parameterised queries, where data is passed separately from the SQL code
    • Removing apostrophes from fields
    • Hiding error messages
    • Limiting field length
    Show the answer

    Parameterised queries, where data is passed separately from the SQL code

    With parameters, the database knows the value is data and never code, whatever it contains. Filtering characters by hand always lets some case through.

  • An attack where data sent by the user is interpreted as SQL code: what is this called?

    Show the answer

    SQL injection

    It happens when a query is built by pasting outside text into it: the attacker can then read, change or delete data.

  • A search field builds its query by pasting the typed text. An attacker types “' OR '1'='1”. What may happen?

    • The condition becomes always true and the query returns every row
    • The search returns nothing
    • The server updates itself
    • The browser closes
    Show the answer

    The condition becomes always true and the query returns every row

    The text closes the string and adds an always-true condition: the query filters nothing any more. Variants allow reading other tables.