MugUp logoMugUp
HomeBrowseAboutBlog
LoginSign Up
MugUp

Plan your day, study, read, write and track your habits in one app.

Follow MugUp

Product

  • Features
  • Compare
  • Free Tools
  • Deck Library
  • MugUp for Discord

Community

  • Blog
  • Changelog
  • Feature Requests
  • Deck Requests

Company

  • Home
  • About
  • Contact

© 2026 MugUp. All rights reserved.

Terms of ServicePrivacy PolicyCookie Policy
  1. Browse decks
  2. Application Security: OWASP and Secure Coding
  3. Injection: SQL, Command and Template Injection
Public deck

Application Security: OWASP and Secure Coding

The common vulnerability classes in web applications and APIs, such as injection, XSS, CSRF, broken access control and SSRF, how each one works, and how to prevent it in code and in your build pipeline.

Engineering
AShared by Alex Chen
0PlaySign in to clone

You’re reading a free preview. Sign up to see every topic and question — and to play this deck as games.

See the whole deck

Injection: SQL, Command and Template Injection

How untrusted input ends up being run as part of a SQL query, a shell command or a template, and the coding habits that stop it.

Play topicBack to deck

Content

37 total questions

MCQ: 10
Fill-in: 7
Flashcards: 11
Pair match: 9
Injection: SQL, Command and Template Injection – Flashcards
Flashcards

Card #1

Injection (general idea)

Card #2

SQL injection

Card #3

Parameterised query (prepared statement)

8 more questions in this game

Showing 3 of 11. Sign up free to see the rest.

Sign up freeLog in
Injection: SQL, Command and Template Injection – MCQ
Multiple Choice Questions
  1. 1. A search endpoint builds its SQL by concatenating the search term, after replacing each single quote with two. A reviewer still flags it. What is the right fix?

    • Also strip semicolons and comment markers from the term before it is concatenated
    • Rewrite it as a parameterised query and bind the search term as a parameter
    • Base64-encode the search term so that no quote characters ever reach the query
    • Limit the search term to 50 characters so a long attack string cannot fit in it
  2. 2. An API lets clients choose the sort column with ?sort=name. Binding the column name as a query parameter fails. What should the code do instead?

    • Escape the column name with the driver's quoting function and then concatenate it
    • Wrap the column name in double quotes so the database reads it as an identifier
    • Accept the value only if it is shorter than the longest column name in the table
    • Map the value to one of a fixed set of known column names and reject anything else
  3. 3. Which of these does NOT prevent SQL injection?

    • Binding every user-supplied value as a parameter of a prepared statement
    • Using the ORM's query builder methods so values are passed as bound parameters
    • Hiding database error messages from users and showing a generic error page
    • Mapping user-chosen sort columns to a fixed allowlist of known column names
7 more questions in this game

Showing 3 of 10. Sign up free to see the rest.

Sign up freeLog in
Injection: SQL, Command and Template Injection – Fill-in-the-blank
Fill in the Blank
  1. 1. In Java JDBC, use a ___ instead of a plain Statement so values are bound with methods such as setString.

    Answer:PreparedStatementalso: prepared statement

    Hint: The class name starts with Prepared.

  2. 2. With Python's subprocess module, keep shell=___ (the default) and pass the command as a list.

    Answer:Falsealso: false

    Hint: A Boolean value.

  3. 3. In the CWE catalogue, SQL injection is entry CWE-___.

    Answer:89

    Hint: A two-digit number in the 80s.

4 more questions in this game

Showing 3 of 7. Sign up free to see the rest.

Sign up freeLog in
Injection: SQL, Command and Template Injection – Pair match
Pair Match
XPath injection↔Changes queries that select data from XML documents
LDAP injection↔Changes search filters sent to a directory service
CRLF injection↔Adds line breaks to split or forge HTTP response headers
6 more questions in this game

Showing 3 of 9. Sign up free to see the rest.

Sign up freeLog in