Module 15 - SQL Injection ( EC Mode ) Flashcards
In which of the following SQL injection attacks does an attacker deface a web page, insert malicious content into web pages, or alter the contents of a database?
A. Compromised data integrity
B. Authorization bypass
C. Compromised availability of data
D. Remote code execution
Answer: A. Compromised data integrity
Which of the following is the result obtained after executing the SQL query “SELECT * FROM User_Data WHERE Email_ID = ‘blah’ OR 1=1”?
A. Update Table
B. Add New Records
C. Return More Data
D. Identify the Table Name
Answer: C. Return More Data
security administrator notices that the log file of the company’s webserver contains suspicious entries:
[20/Mar/2011:10:49:07] “GET /login.php?user=test’+oR+3>2%20– HTTP/1.1” 200 9958
[20/Mar/2011:10:51:02] “GET /login.php?user=admin’;%20– HTTP/1.1” 200 9978
The administrator decides to further investigate and analyze the source code of the login.php file:
php
include(‘../../config/db_connect.php’);
$user = $_GET[‘user’];
$pass = $_GET[‘pass’];
$sql = “SELECT * FROM USERS WHERE username = ‘$user’ AND password = ‘$pass’”;
$result = mysql_query($sql) or die (“couldn’t execute query”);
if (mysql_num_rows($result) != 0) echo ‘Authentication granted!’;
else echo ‘Authentication failed!’;
?>
Based on the source code analysis provided, the analyst concludes that the login.php script is vulnerable to:
A. SQL injection
B. Command injection
C. LDAP injection
D. Directory traversal
Answer: A. SQL injection
Bank of Timbuktu is a medium-sized, regional financial institution in Timbuktu. The bank has recently deployed a new Internet-accessible web application. Customers can access their account balances, transfer money between accounts, pay bills, and conduct online financial business using a web browser.
John Stevens is in charge of information security at the Bank of Timbuktu. After one month in production, several customers have complained about the Internet-enabled banking application. Strangely, the account balances of many of the bank’s customers have been changed! However, money has not been removed from the bank; instead, money is transferred between accounts. Given this attack profile, John Stevens reviewed the web application’s logs and found the following entries:
Attempted login of unknown user: johnm
Attempted login of unknown user: susaR
Attempted login of unknown user: sencat
Attempted login of unknown user: pete’’;
Attempted login of unknown user: ‘ or 1=1–
Attempted login of unknown user: ‘; drop table logins–
Login of user jason, sessionID= 0x75627578626F6F6B
Login of user daniel, sessionID= 0x98627579539E13BE
Login of user rebecca, sessionID= 0x9062757944CCB811
Login of user mike, sessionID= 0x9062757935FB5C64
Transfer Funds user jason
Pay Bill user mike
Logout of user mike
What kind of attack did the hacker attempt to carry out at the bank, based on the given information?
A. The hacker first attempted logins with suspected user names, and then used SQL injection to gain access to valid bank login IDs.
B. Brute force attack in which the hacker attempted guessing login IDs and passwords from password-cracking tools.
C. The hacker used a generator module to pass results to the webserver and exploited web application CGI vulnerability.
D. The hacker attempted session hijacking, in which the hacker opened an account with the bank, then logged in to receive a session ID, guessed the next ID, and took over Jason’s session.
Answer: A. The hacker first attempted logins with suspected user names, and then used SQL injection to gain access to valid bank login IDs.
SQL injection attacks do not exploit a specific software vulnerability; instead, they target websites that do not follow secure coding practices for accessing and manipulating data stored in a relational database.
A. False
B. True
Answer: B. True
Which of the following system tables does MS SQL Server database use to store metadata that hackers can use to acquire database schema information to further compromise the database?
A. sysdbs
B. sysrows
C. sysobjects
D. syscells
Answer: C. sysobjects
Which of the following methods carries the requested data to the webserver as a part of the message body?
A. HTTP POST
B. HTTP GET
C. IBM DB2
D. Cold fusion
Answer: A. HTTP POST
Which of the following is the most effective technique in identifying vulnerabilities or flaws in the web page code?
A. Traffic analysis
B. Packet analysis
C. Code analysis
D. Data analysis
Answer: C. Code analysis
An attacker injects the following SQL query:
blah’ AND 1=(SELECT COUNT(*) FROM mytable); –
What is the intention of the attacker?
A. Identifying the table name
B. Deleting a table
C. Updating table
D. Adding new records
Answer: A. Identifying the table name
Identify the reason why Web Applications are vulnerable to SQL injection attacks.?
A. Avoid constructing dynamic SQL with concatenated input values.
B. Tests the content of string variables and accepts only expected values.
C. Error messages reveal important information.
D. Reject entries that contain binary data, escape sequences, and comment characters.
Answer: C. Error messages reveal important information.
In which of the following attacks does an attacker pose a true or false question to a database to determine whether an application is vulnerable to SQL injection?
A. Blind SQL injection
B. In-band SQL injection
C. Error-based SQL injection
D. Union SQL injection
Answer: A. Blind SQL injection
In which of the following attacks does an attacker inject an additional malicious query into an original query to make the DBMS execute multiple SQL queries?
A. Tautology
B. System stored procedure
C. Piggybacked query
D. Illegal/logically incorrect query
Answer: C. Piggybacked query
In one of the following attacks, an attacker uses different communication channels to perform the attack and obtain results. It is difficult to perform as the attacker needs to communicate with a database server and determine the server features used by a web application. Which is this attack?
A. Union SQL injection
B. In-band SQL injection
C. End-of-line comment
D. Out-of-band SQL injection
Answer: D. Out-of-band SQL injection
What is the main difference between a “Normal” SQL injection and a “Blind” SQL injection vulnerability?
A. The vulnerable application does not display errors with information about the injection results to the attacker.
B. The request to the webserver is not visible to the administrator of the vulnerable application.
C. A successful attack does not show an error message to the administrator of the affected application.
D. The attack is called “Blind” because, although the application properly filters user input, it is still vulnerable to code injection.
Answer: A. The vulnerable application does not display errors with information about the injection results to the attacker.
In which of the following attacks does an attacker use the same communication channel to perform the attack and retrieve the results?
A. Inferential SQL injection
B. In-band SQL injection
C. Out-of-band SQL injection
D. Blind SQL injection
Answer: B. In-band SQL injection
In which of the following attacks does an attacker use a conditional OR clause in such a way that the condition of the WHERE clause will always be true?
A. End-of-line comment
B. UNION SQL injection
C. Illegal/logically incorrect query
D. Tautology
Answer: D. Tautology
In which of the following attacks does an attacker inject an additional malicious query to the original query?
A. UNION SQL injection
B. Piggybacked query
C. In-line comment
D. Tautology
Answer: B. Piggybacked query
Which of the following attacks is time-intensive because the database should generate a new statement for each newly recovered bit?
A. Error-based SQL injection
B. In-band SQL injection
C. Blind SQL injection
D. UNION SQL injection
Answer: C. Blind SQL injection
Which of the following commands is used to make the CPU wait for a specified amount of time before executing an SQL query?
A. ORDER BY 10–
B. WAITFOR DELAY ‘0:0:10’–
C. UNION SELECT 1,null,null—
D. GET_HOST_NAME()
Answer: B. WAITFOR DELAY ‘0:0:10’–
Which of the following SQL queries is an example of a heavy query used in SQL injection?
A. SELECT * FROM products WHERE id_product=$id_product
B. SELECT Name, Price, Description FROM ITEM_DATA WHERE ITEM_ID = 67 AND 1 = 1
C. SELECT Name, Phone, Address FROM Users WHERE Id=1 UNION ALL SELECT creditCardNumber,1,1 FROM CreditCardTable
D. SELECT * FROM products WHERE id=1 AND 1 < SELECT count(*) FROM all_users A, all_users B, all_users C
Answer: D. SELECT * FROM products WHERE id=1 AND 1 < SELECT count(*) FROM all_users A, all_users B, all_users C
In which of the following attacks does an attacker pose a true or false question to an database to determine whether an application is vulnerable to SQL injection?
A. Union SQL injection
B. Error-based SQL injection
C. In-band SQL injection
D. Blind SQL injection
Answer: D. Blind SQL injection
Steve works as a penetration tester in a firm named InfoSecurity. Recently, Steve was given an assignment to test the security of the company’s web applications and backend database. While conducting the test, he sends a malicious SQL query with conditional timing delays to the backend database through the web application. This conditional time delay forces the database to wait for a specified amount of time before responding. He performs the same task using different malicious SQL queries. By observing various query responses from the database, Steve came to know that the web application is vulnerable to an SQL injection attack.
What type of SQL injection attack is Steve most likely performing?
A. Out-of-band SQL Injection
B. Error-based SQL injection
C. Blind SQL injection
D. Union-based SQL injection
Answer: C. Blind SQL injection
Select all correct answers.
In blind SQLi, attackers can steal data by asking a series of true or false questions through SQL statements. Select all the correct types of blind SQL injections.?
A. Time delay
B. Boolean exploitation
C. System-stored procedure
D. Tautology
Answer: A. Time delay, B. Boolean exploitation
In which of the following attacks does an attacker use an ORDER BY clause to find the right number of columns in a database table?
A. UNION SQL injection
B. Tautology
C. In-line comments
D. Piggybacked query
Answer: A. UNION SQL injection