Attacking Web Apps Flashcards
SQL Injection
What is UNION SELECT? How it can be used to perform a SQL Injection attack?
UNION SELECT is a method that allows the user to include information from other tables or columns that were not initially defined. But there is one constraint: You can only select the same number of columns as in the original query.
So an attacker can use UNION select with values to represent each column, starting with one and adding a column until the response is positive, with no errors. The values can be used to see which one of the columns are actually displayed.
… union select 1#
… union select 1,2#
… union select 1,2,3#
After this, the hacker can then start to enumerate the database and retrieve desired information by adding queries to the right columns.
What is blind SQL Injection?
It’s a type of SQL injection where the way to extract data is different. Typically, it occurs when the application returns generic error messages, but has not mitigated the vulnerable code, so an attacker can ask true or false questions to the database and determine the answer for each one of them based on the response returned by or behavior of the application
What is a content-based blind SQL Injection?
The attacker will check the result by looking at the content of the given response. To start, two queries are sent, one that returns true and other that returns false. Then the responses will be compared to check if it is possible to know the value of a query based on the response content. Finally, if possible, the attacker can run other queries and perform the attack.
What is a time-based blind SQL injeciton?
In this type of blind SQL injection, the attacker will use the following logic to retrieve inormation:
IF query is true, wait x seconds to return the response.
With this, is possible to know if the query is true even if the application doesn’t display anything different.
This query is being used to perform a blind SQL injection, what is wrong with it?
‘ and substring(select password from injection 0x02 where username = ‘jessamy’, 1, 1) = ‘a’
The select operation inside the substring function should be involved in parenthesis, to indicate to SQL that this operation must be resolved first, otherwise the comparation will not work properly.
What is XSS?
Cross-site scripting is an attack that allows a hacker to inject malicious scripts to web applications. It happens when the app accepts user input but does not perform the proper validation of it. So the attacker can manipulate the website and make it return malicious javascript to other users, circumventing the SOP. When the malicious code executes in a victim’s browser, the attacker can compromise their interaction.
What is reflected XSS?
Also known as non-persistent, it occurs when the user input is immediately returned, without being permanently stored. Usually te victmin must click a malicious url.
What is stored XSS?
Also known as persistent, it occurs when the user input is stored in the target server. The victim will retrieve this malicious data later.
What is DOM-Based XSS?
Also knwon as Type-0, it occurs when the payload is executed by modifying the DOM environment in the victim’s browser. The payload never leaves the browser and the HTML page does not change, but the client side code will execute differently because of the malicious modifications that were made.
What is command injection?
Os command injection, also known as shell injection, is a web application vulnerability that allows an attacker to run arbitrary OS commands in the server that is running the application.
What is insecure file upload?
When a web server allows an user to upload a file without sufficiently validating its name, type, content or size. Usually is used to achieve RCE, but there are other possibilities and ways to cause an impact.
What are the key factors that can affect the impact of a insecure file upload exploitation?
There are two key factors:
* Which aspects of the file are being correctly validated.
* What restrictions are imposed to the file once it has been successfully updated.
Insecure file upload
Cite possible impacts that do not involve getting a shell.
Overwriting files, achieve stored XSS, upload files to another directory or empty the machine’s memory causing a DoS.
What is account locking? What is the main weakness of this method?
It’s a mechanism for brute-force protection that consists of locking an account if a certain criteria is met, usually a number of failed login attempts.
This method provides an certain level of protection if the attacker is trying to brute-force one specific account, but it fails if the attacker is performing credential stuffing or password spraying attacks.
What is rate limiting?
It’s a brute-force protection that consists of blocking an IP address if too many login requests are made in a short period of time.