nerdexam
(ISC)2

CSSLP · Question #291

You work as a Security Manager for Tech Perfect Inc. You want to save all the data from the SQL injection attack, which can read sensitive data from the database and modify database data using some…

The correct answer is B. Use an encapsulated library for accessing databases. C. Create parameterized stored procedures. D. Create parameterized queries by using bound and typed parameters. To protect against SQL injection attacks, it is essential to use encapsulated database access libraries, create parameterized stored procedures, and implement parameterized queries with bound and typed parameters.

Secure Software Implementation

Question

You work as a Security Manager for Tech Perfect Inc. You want to save all the data from the SQL injection attack, which can read sensitive data from the database and modify database data using some commands, such as Insert, Update, and Delete. Which of the following tasks will you perform? Each correct answer represents a complete solution. Choose three.

Options

  • AApply maximum number of database permissions.
  • BUse an encapsulated library for accessing databases.
  • CCreate parameterized stored procedures.
  • DCreate parameterized queries by using bound and typed parameters.

How the community answered

(27 responses)
  • A
    26% (7)
  • B
    74% (20)

Why each option

To protect against SQL injection attacks, it is essential to use encapsulated database access libraries, create parameterized stored procedures, and implement parameterized queries with bound and typed parameters.

AApply maximum number of database permissions.

Applying maximum database permissions is counterproductive and increases the attack surface, allowing an attacker who successfully breaches the system to have greater access and cause more damage; the principle of least privilege should be followed.

BUse an encapsulated library for accessing databases.Correct

Using an encapsulated library for database access (e.g., ORMs or secure data access layers) helps prevent SQL injection by abstracting database interactions and often incorporating built-in parameterization and input sanitization, reducing the chance of direct user input manipulating SQL queries.

CCreate parameterized stored procedures.Correct

Stored procedures, when properly implemented with parameters, pre-compile the SQL statements, separating the SQL code from the user-supplied data. This prevents malicious input from altering the query's logic, as the input is treated as data, not executable code.

DCreate parameterized queries by using bound and typed parameters.Correct

Parameterized queries use placeholders for input values and bind variables to these placeholders, ensuring that user input is treated as literal data rather than executable SQL code. This explicit separation effectively neutralizes the ability of an attacker to inject malicious SQL commands.

Concept tested: Preventing SQL injection attacks

Source: https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/sql/sql-injection

Topics

#SQL Injection#Parameterized Queries#Secure Coding#Database Security

Community Discussion

No community discussion yet for this question.

Full CSSLP Practice