{"id":1569,"date":"2015-03-15T14:38:57","date_gmt":"2015-03-15T06:38:57","guid":{"rendered":"http:\/\/www.51cos.com\/?p=1569"},"modified":"2015-03-15T14:40:21","modified_gmt":"2015-03-15T06:40:21","slug":"%e7%94%a8%e7%81%ab%e8%bd%a6%e5%a4%b4%e5%90%91discuz%e8%ae%ba%e5%9d%9b%e5%8f%91%e5%b8%83%e6%96%87%e7%ab%a0%e6%97%b6%e5%87%ba%e7%8e%b0%e6%82%a8%e5%bd%93%e5%89%8d%e7%9a%84%e8%ae%bf%e9%97%ae","status":"publish","type":"post","link":"http:\/\/www.51cos.com\/?p=1569","title":{"rendered":"\u7528\u706b\u8f66\u5934\u5411Discuz\u8bba\u575b\u53d1\u5e03\u6587\u7ae0\u65f6\u51fa\u73b0\u201c\u60a8\u5f53\u524d\u7684\u8bbf\u95ee\u8bf7\u6c42\u5f53\u4e2d\u542b\u6709\u975e\u6cd5\u5b57\u7b26\uff0c\u5df2\u7ecf\u88ab\u7cfb\u7edf\u62d2\u7edd\u201d\u9519\u8bef\u7684\u89e3\u51b3\u65b9\u6cd5"},"content":{"rendered":"<p>\u5728\u901a\u8fc7\u706b\u8f66\u5934\u5411DiscuzX\u8bba\u575b\u53d1\u5e03\u6587\u7ae0\u65f6\uff0c\u51fa\u73b0\u9519\u8bef\u201c\u60a8\u5f53\u524d\u7684\u8bbf\u95ee\u8bf7\u6c42\u5f53\u4e2d\u542b\u6709\u975e\u6cd5\u5b57\u7b26\uff0c\u5df2\u7ecf\u88ab\u7cfb\u7edf\u62d2\u7edd\u201d\u3002<\/p>\n<p>\u89e3\u51b3\u65b9\u6cd5\u662f\u7981\u7528Discuz\u7684\u5168\u5c40\u5b89\u5168\u68c0\u67e5\uff0c\u4f46\u4f1a\u5f15\u53d1\u4e00\u4e9b\u4e0d\u5b89\u5168\u7684\u6076\u610f\u653b\u51fb\uff0c\u56e0\u6b64\u5728\u53d1\u5e03\u4e4b\u540e\u6539\u56de\u539f\u6837\u3002<\/p>\n<p><strong>\u65b9\u68481<\/strong><\/p>\n<p>\u5219\u53ef\u4ee5\u4fee\u6539DiscuzX\u7684\u914d\u7f6e\u6587\u4ef6 config\/config_global.php\uff0c\u7981\u7528\u5b89\u5168\u68c0\u67e5\uff1a<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"prettyprint linenums\">$_config['security']['urlxssdefend']                =  '1';   <\/p>\n<p>\u4fee\u6539\u4e3a\uff1a<\/p>\n<pre class=\"prettyprint linenums\"> $_config['security']['urlxssdefend']                =  0;    <\/p>\n<p>\u65b9\u68482<\/p>\n<p>\u6253\u5f00\uff1a<\/p>\n<p>\\source\\class\\discuz\u7684discuz_application.php\u67e5\u627e<\/p>\n<pre class=\"prettyprint linenums\">private function _xss_check() {<\/p>\n<p>        static <span class=\"katex math inline\">check = array('\"', '&gt;', '&lt;', '\\'', '(', ')', 'CONTENT-TRANSFER-ENCODING');<\/p>\n<p>        if(isset(<\/span>_GET['formhash']) &amp;&amp; <span class=\"katex math inline\">_GET['formhash'] !== formhash()) {<br \/>\n            system_error('request_tainting');<br \/>\n        }<\/p>\n<p>        if(<\/span>_SERVER['REQUEST_METHOD'] == 'GET' ) {<br \/>\n            <span class=\"katex math inline\">temp =<\/span>_SERVER['REQUEST_URI'];<br \/>\n        } elseif(empty (<span class=\"katex math inline\">_GET['formhash'])) {<\/span>temp = <span class=\"katex math inline\">_SERVER['REQUEST_URI'].file_get_contents('php:\/\/input');<br \/>\n        } else {<\/span>temp = '';<br \/>\n        }<\/p>\n<p>        if(!empty(<span class=\"katex math inline\">temp)) {<\/span>temp = strtoupper(urldecode(urldecode(<span class=\"katex math inline\">temp)));<br \/>\n            foreach (<\/span>check as <span class=\"katex math inline\">str) {<br \/>\n                if(strpos(<\/span>temp, $str) !== false) {<br \/>\n                    system_error('request_tainting');<br \/>\n                }<br \/>\n            }<br \/>\n        }<\/p>\n<p>        return true;<br \/>\n    }<\/p>\n<p>\u4fee\u6539\u4e3a\uff1a<\/p>\n<pre class=\"prettyprint linenums\">\/**<\/p>\n<p>private function _xss_check() {<\/p>\n<p>        static <span class=\"katex math inline\">check = array('\"', '&gt;', '&lt;', '\\'', '(', ')', 'CONTENT-TRANSFER-ENCODING');<\/p>\n<p>        if(isset(<\/span>_GET['formhash']) &amp;&amp; <span class=\"katex math inline\">_GET['formhash'] !== formhash()) {<br \/>\n            system_error('request_tainting');<br \/>\n        }<\/p>\n<p>        if(<\/span>_SERVER['REQUEST_METHOD'] == 'GET' ) {<br \/>\n            <span class=\"katex math inline\">temp =<\/span>_SERVER['REQUEST_URI'];<br \/>\n        } elseif(empty (<span class=\"katex math inline\">_GET['formhash'])) {<\/span>temp = <span class=\"katex math inline\">_SERVER['REQUEST_URI'].file_get_contents('php:\/\/input');<br \/>\n        } else {<\/span>temp = '';<br \/>\n        }<\/p>\n<p>        if(!empty(<span class=\"katex math inline\">temp)) {<\/span>temp = strtoupper(urldecode(urldecode(<span class=\"katex math inline\">temp)));<br \/>\n            foreach (<\/span>check as <span class=\"katex math inline\">str) {<br \/>\n                if(strpos(<\/span>temp, <span class=\"katex math inline\">str) !== false) {<br \/>\n                    system_error('request_tainting');<br \/>\n                }<br \/>\n            }<br \/>\n        }<\/p>\n<p>        return true;<br \/>\n    }<br \/>\n*\/<\/p>\n<p>    private function _xss_check() {<\/span>temp = strtoupper(urldecode(urldecode(<span class=\"katex math inline\">_SERVER['REQUEST_URI']))); <\/p>\n<p>                    if(strpos(<\/span>temp, '&lt;') !== false || strpos(<span class=\"katex math inline\">temp, '\"') !== false || strpos(<\/span>temp, 'CONTENT-TRANSFER-ENCODING') !== false) { <\/p>\n<p>                            system_error('request_tainting'); <\/p>\n<p>                    } <\/p>\n<p>                    return true; <\/p>\n<p>            }<\/p>\n<p>\u540c\u65f6\u8fdb\u884c\u4ee5\u4e0b\u64cd\u4f5c\uff1a<\/p>\n<p>1. \u5728DiscuzX\u7ba1\u7406\u540e\u53f0\u7981\u7528\u767b\u5f55\/\u53d1\u5e03\u7684\u9a8c\u8bc1\u7801\u529f\u80fd<br \/>\n2. \u5728\u706b\u8f66\u5934\u7684\u53d1\u5e03\u6a21\u5757\u4e2d\u5c06\u767b\u5f55\u6a21\u5f0f\u6539\u4e3a\u6570\u636e\u5305\u6a21\u5f0f\uff0c\u586b\u5199\u7528\u6237\u540d\u548c\u5bc6\u7801<\/p>\n<p>\u7136\u540e\u6d4b\u8bd5\u53d1\u5e03\uff0c\u5e94\u8be5\u6ca1\u95ee\u9898\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u901a\u8fc7\u706b\u8f66\u5934\u5411DiscuzX\u8bba\u575b\u53d1\u5e03\u6587\u7ae0\u65f6\uff0c\u51fa\u73b0\u9519\u8bef\u201c\u60a8\u5f53\u524d\u7684\u8bbf\u95ee\u8bf7\u6c42\u5f53\u4e2d\u542b\u6709\u975e\u6cd5\u5b57\u7b26\uff0c\u5df2\u7ecf\u88ab\u7cfb\u7edf\u62d2\u7edd\u201d\u3002 \u89e3 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-1569","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/1569","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1569"}],"version-history":[{"count":0,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/1569\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1569"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1569"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}