[{"id":"websecurityintermediate-001","courseId":"web-security-intermediate","domain":"injection-and-input","topic":"Stored procedures and their limits","prompt":"An application uses stored procedures for all of its data access. For least privilege, its database account should also be granted SELECT directly on the underlying tables.","hint":"Think about how the account reaches the data when every query goes through procedures.","explain":"Least privilege means each database account gets only the rights its job needs. Think about which database objects an account must touch directly, and which it only reaches through a procedure.","source":"https://cheatsheetseries.owasp.org/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html","interaction":{"type":"true-false"},"options":[{"id":"a","text":"True","whyNot":"Direct reads are harmless, so the account can have them. This is a misconception: the guidance says not to grant any rights directly on the tables."},{"id":"b","text":"False","why":"The account should only be allowed to execute the procedures it needs, with no direct rights on the tables."}],"answer":"b","explanation":"Accounts that call only stored procedures should be able to execute those procedures, with no direct rights on the underlying tables.","concept":"Accounts that call only stored procedures should be able to execute those procedures, with no direct rights on the underlying tables.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["Grant EXECUTE on the procedures an account needs, not table rights behind them."]},{"id":"websecurityintermediate-002","courseId":"web-security-intermediate","domain":"injection-and-input","topic":"Allow-listed table and column names","prompt":"A report lets users pick a table by name. The query needs that name in its FROM clause, where a bind variable can't go. What is the recommended defense?","hint":"Placeholders work for some parts of a query but not others.","explain":"Bind variables protect values, but some parts of a query, such as identifiers, cannot be bound. Those parts need a different kind of defense than a placeholder.","source":"https://cheatsheetseries.owasp.org/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html","interaction":{"type":"single"},"options":[{"id":"a","text":"Map the user's choice to a fixed table name in code, and reject any other value","why":"Validation picks from table names the code already defines, so no user text reaches the SQL."},{"id":"b","text":"Escape the name with the database's string-escape function","whyNot":"The guidance strongly discourages escaping; it is fragile and cannot guarantee that injection is prevented."},{"id":"c","text":"Pass the name as a ? placeholder, the same as any other value","whyNot":"Placeholders bind values, and table names can't use bind variables, so the name still has to be checked."},{"id":"d","text":"Strip quotes and semicolons from the name, then append it","whyNot":"Removing some characters misses other tricks; the guidance calls for validating against legal names instead."}],"answer":"a","explanation":"Table and column names can't be bound as parameters, so they must be validated against a fixed set of legal names defined in code.","concept":"Table and column names can't be bound as parameters, so they must be validated against a fixed set of legal names defined in code.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["Identifiers can't be bound; map user choices to fixed names in code."]},{"id":"websecurityintermediate-003","courseId":"web-security-intermediate","domain":"injection-and-input","topic":"Least-privilege database accounts","prompt":"A team is tightening the database accounts its web apps use. Which TWO of these choices follow least-privilege guidance?","hint":"Ask what each account needs to do, and who should be able to connect with it.","explain":"Least privilege starts from what each account actually needs, and works by taking away rights the account does not use. Think about who connects, and which operations and data each connection requires.","source":"https://cheatsheetseries.owasp.org/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html","interaction":{"type":"multiple","tellCount":true},"options":[{"id":"a","text":"Give each web application its own database user, limited to the rights it needs","why":"The guidance says each separate application should have a designated DB account, for granular access control."},{"id":"b","text":"Grant a view with only the needed columns, instead of the base table","why":"A view can limit access to part of a table, so the account is granted the view rather than the table."},{"id":"c","text":"Connect every web app with the database owner account","whyNot":"The guidance says applications should avoid one shared owner or admin account for every app."},{"id":"d","text":"Grant CREATE and DELETE rights so the app can manage its own rows","whyNot":"Create and delete access should rarely, if ever, be granted to database accounts."},{"id":"e","text":"Run the database server as root or system so it can reach every file","whyNot":"The DBMS should run under a restricted OS account, never as root or system."},{"id":"f","text":"Give the app DBA rights during development, then remove them before release","whyNot":"Application accounts should never get DBA or admin access; the guidance calls that very dangerous."}],"answer":"ab","explanation":"Each application should have its own least-privilege DB account, and views can narrow access to only the columns or rows needed.","concept":"Each application should have its own least-privilege DB account, and views can narrow access to only the columns or rows needed.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["Give each app its own database account with only the rights it needs."]},{"id":"websecurityintermediate-004","courseId":"web-security-intermediate","domain":"injection-and-input","topic":"LDAP search filter escaping","prompt":"A login form puts the username into an LDAP search filter like (uid=USER). Which set lists the special characters that must be escaped in that value?","hint":"Search filters use prefix notation, and their syntax has its own symbols.","explain":"LDAP has two kinds of names: distinguished names, which identify an entry, and search filters, which match attributes. Each has its own special characters, so escaping must fit the context.","source":"https://cheatsheetseries.owasp.org/cheatsheets/LDAP_Injection_Prevention_Cheat_Sheet.html","interaction":{"type":"single"},"options":[{"id":"a","text":"The asterisk, parentheses, backslash and NUL","why":"The guidance lists the asterisk, parentheses, backslash and NUL as special characters that must be escaped in search filters."},{"id":"b","text":"Backslash, #, +, <, >, comma, semicolon, quotes and equals signs","whyNot":"That is the distinguished-name list; search filter values need their own escaping set."},{"id":"c","text":"Single quotes and semicolons, as in SQL","whyNot":"Those are SQL concerns; LDAP filters use prefix notation with their own special characters."},{"id":"d","text":"None, since the brackets around each condition keep the value separate","whyNot":"The brackets are themselves special, and a value containing a closing parenthesis can end the condition early."}],"answer":"a","explanation":"Search filter values must escape the asterisk, parentheses, backslash and NUL; distinguished name values need the separate DN escaping set.","concept":"Search filter values must escape the asterisk, parentheses, backslash and NUL; distinguished name values need the separate DN escaping set.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["Match escaping to the context: a search filter value and a DN value need different encodings."]},{"id":"websecurityintermediate-005","courseId":"web-security-intermediate","domain":"injection-and-input","topic":"Allow-listing bindable model fields","prompt":"A profile form binds every request field onto a User object. An attacker adds isAdmin=true to the form post, along with a new email. What is the best fix?","hint":"Think about which properties binding may write, not which fields the form shows.","explain":"Some frameworks copy every request parameter into matching object properties, including ones the form never displays. The question is which properties the binding is allowed to write.","source":"https://cheatsheetseries.owasp.org/cheatsheets/Mass_Assignment_Cheat_Sheet.html","interaction":{"type":"single"},"options":[{"id":"a","text":"Bind only an explicit allowlist of editable fields, or use a DTO with just those fields","why":"Only the listed fields can be written, so a sensitive property such as isAdmin stays out of reach."},{"id":"b","text":"Add setDisallowedFields for isAdmin and leave other fields bindable","whyNot":"A block-list names only known fields, so any new or overlooked sensitive field remains bindable."},{"id":"c","text":"Put isAdmin in the form as a hidden input set to false","whyNot":"Field names can be guessed, and a crafted request can send isAdmin whatever the form shows."},{"id":"d","text":"Validate the email value, since that is the only field users edit","whyNot":"Checking the values of allowed fields does not stop a field the caller shouldn't write from being set."}],"answer":"a","explanation":"Mass assignment happens when binding writes fields the caller shouldn't control; allow-list bindable fields or use DTOs with only editable fields.","concept":"Mass assignment happens when binding writes fields the caller shouldn't control; allow-list bindable fields or use DTOs with only editable fields.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["Bind only fields users may edit; a block-list misses sensitive fields added later."]}]