nerdexam
GIAC

GPEN · Question #102

You work as a Network Penetration tester in the Secure Inc. Your company takes the projects to test the security of various companies. Recently, Secure Inc. has assigned you a project to test the…

The correct answer is B. Deletes the entire members table. The query uses stacked SQL injection to terminate the SELECT statement and execute DROP TABLE, permanently deleting the entire members table.

Web Application Penetration Testing

Question

You work as a Network Penetration tester in the Secure Inc. Your company takes the projects to test the security of various companies. Recently, Secure Inc. has assigned you a project to test the security of a Web site. You go to the Web site login page and you run the following SQL query:

SELECT email, passwd, login_id, full_name FROM members WHERE email = '[email protected]'; DROP TABLE members; --' What task will the above SQL query perform?

Options

  • APerforms the XSS attacks.
  • BDeletes the entire members table.
  • CDeletes the rows of members table where email id is '[email protected]' given.
  • DDeletes the database in which members table resides.

How the community answered

(34 responses)
  • A
    9% (3)
  • B
    76% (26)
  • C
    12% (4)
  • D
    3% (1)

Why each option

The query uses stacked SQL injection to terminate the SELECT statement and execute DROP TABLE, permanently deleting the entire members table.

APerforms the XSS attacks.

XSS (Cross-Site Scripting) is a client-side injection attack that injects malicious scripts into web page output, not a server-side SQL command targeting database tables.

BDeletes the entire members table.Correct

The semicolon injected after the email value terminates the legitimate SELECT statement, and the subsequent DROP TABLE members; command instructs the database engine to permanently delete the entire members table and all its data. The double-hyphen (--) comments out any remaining SQL that follows, preventing syntax errors and allowing the destructive command to execute cleanly. This is a classic stacked query injection attack that requires the database driver to support multiple statements in a single call.

CDeletes the rows of members table where email id is '[email protected]' given.

The WHERE clause in the injected SELECT applies only to that statement and does not affect the scope of DROP TABLE, which operates on the entire table regardless of any filter conditions.

DDeletes the database in which members table resides.

DROP TABLE members removes only the named table from the database; removing the entire database would require a DROP DATABASE statement.

Concept tested: SQL injection stacked query with DROP TABLE

Source: https://owasp.org/www-community/attacks/SQL_Injection

Topics

#SQL injection#DROP TABLE#database manipulation#web attack

Community Discussion

No community discussion yet for this question.

Full GPEN Practice