{"id":497,"date":"2024-05-03T16:03:51","date_gmt":"2024-05-03T16:03:51","guid":{"rendered":"https:\/\/faq.cinar-studio.ru\/?p=497"},"modified":"2024-05-06T18:19:49","modified_gmt":"2024-05-06T18:19:49","slug":"universalnaya-zashhita-ot-xss-bitrix-dlya-vzlomannyh-sajtov","status":"publish","type":"post","link":"https:\/\/faq.cinar-studio.ru\/?p=497","title":{"rendered":"\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 XSS Bitrix \u0434\u043b\u044f \u0432\u0437\u043b\u043e\u043c\u0430\u043d\u043d\u044b\u0445 \u0441\u0430\u0439\u0442\u043e\u0432"},"content":{"rendered":"<h3>\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 Bitrix<\/h3>\n<p><strong>\u041c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430<\/strong>: \u0412\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u043a\u0440\u0438\u043f\u0442 \u0432 \u0444\u0430\u0439\u043b <code>\/bitrix\/php_interface\/init.php<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u043c \u043c\u0435\u0441\u0442\u043e\u043c \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432. \u042d\u0442\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u0435\u0435, \u0447\u0435\u043c \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f <code>\/bitrix\/header.php<\/code>, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u043e\u0442\u0435\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043f\u0440\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<p><strong>\u041c\u0435\u0442\u043e\u0434 \u0432\u0441\u0442\u0430\u0432\u043a\u0438<\/strong>:<\/p>\n<ol>\n<li>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 PHP \u0444\u0430\u0439\u043b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>security_headers.php<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u0435 \u0432\u0430\u0448 \u043a\u043e\u0434 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438.<\/li>\n<li>\u0412\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0432 <code>init.php<\/code> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b <code>include<\/code><\/li>\n<\/ol>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"!whitespace-pre hljs language-php\"><span class=\"hljs-keyword\">include<\/span>(<span class=\"hljs-variable\">$_SERVER<\/span>[<span class=\"hljs-string\">'DOCUMENT_ROOT'<\/span>].<span class=\"hljs-string\">'\/path\/to\/security_headers.php'<\/span>);<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043a\u0440\u0438\u043f\u0442\u0430:<\/p>\n<p>https:\/\/\u0412\u0410\u0428\u0414\u041e\u041c\u0415\u041d.ru\/?x=eval()<\/p>\n<p>\u0414\u043e\u043b\u0436\u043d\u043e \u0432\u044b\u0439\u0442\u0438:<\/p>\n<p>denied by antivirus-cinar 1<\/p>\n<p>\u0421\u0430\u043c \u043a\u043e\u0434 \u0441\u043a\u0440\u0438\u043f\u0442\u0430:<\/p>\n<p><code>&lt;?php $patt = \"~\\&lt;\\?~i\"; if(strpos($_SERVER['REQUEST_URI'], '\/bitrix\/admin\/') === false){ header(\"Content-Security-Policy: connect-src 'self' https:\/\/mc.yandex.ru https:\/\/bizexpres.ru:7220 https:\/\/bitrix.info;\");<\/code><br \/>\n<code>if(empty($_POST['g-recaptcha-response'])){<\/code><br \/>\n<code>if (is_array($_FILES)) {<\/code><br \/>\n<code>if(!empty($_FILES['userfile']['name'])) { } else {<\/code><br \/>\n<code>foreach($_FILES as $anystring=&gt;$file_data) {<\/code><br \/>\n<code>if (preg_match($patt,file_get_contents($file_data['tmp_name']))) die(\"denied by antivirus-cinar 3\");<\/code><br \/>\n<code>}<\/code><br \/>\n<code>}<\/code><br \/>\n<code>}<\/code><br \/>\n<code>$patt = \"~\\\/\\.\\.\\\/\\.\\.\\\/\\.\\.\\\/|{0-9a-zA-Z}[80]|eval[^\\(]*\\(|include[^\\(]*\\(|base64_decode[^\\(]*\\(|stripslashes[^\\(]*\\(|strip_tags[^\\(]*\\(|fopen[^\\(]*\\(|chmod[^\\(]*\\(|chown[^\\(]*\\(|chgrp[^\\(]*\\(|unlink[^\\(]*\\(|unset[^\\(]*\\(|fgetc[^\\(]*\\(|fgets[^\\(]*\\(|file_get_contents[^\\(]*\\(|file_put_contents[^\\(]*\\(|fwrite[^\\(]*\\(|move_uploaded_file[^\\(]*\\(|is_uploaded_file[^\\(]*\\(|rmdir[^\\(]*\\(|fromCharCode[^\\(]*\\(|tmpfile[^\\(]*\\(|tempnam[^\\(]*\\(|phpinfo[^\\(]*\\(|basename[^\\(]*\\(|curl_init[^\\(]*\\(|socket_create[^\\(]*\\(|popen[^\\(]*\\(|exec[^\\(]*\\(|system[^\\(]*\\(|passthru[^\\(]*\\(|proc_open[^\\(]*\\(|gzuncompress[^\\(]*\\(|shell_exec[^\\(]*\\(|delete from|insert into~i\";<\/code><\/p>\n<p><code>foreach ($_REQUEST as $v1x1) prfilter_x1($v1x1,$patt);<\/code><br \/>\n<code>}<\/code><br \/>\n<code>}<\/code><\/p>\n<p><code>function prfilter_x1($v1x1,$patt) {<\/code><br \/>\n<code>ob_start();<\/code><br \/>\n<code>if (is_array($v1x1)) {<\/code><br \/>\n<code>foreach ($v1x1 as $vx) prfilter_x1($vx,$patt);<\/code><br \/>\n<code>}<\/code><br \/>\n<code>else {<\/code><br \/>\n<code>if ( preg_match($patt, $v1x1) || preg_match($patt, stripslashes($v1x1) ) ) die(\"denied by antivirus-cinar 1\");<\/code><br \/>\n<code>if ( preg_match($patt, base64_decode($v1x1) ) || preg_match($patt, stripslashes(base64_decode($v1x1) ) ) ) die(\"denied by antivirus-cinar 2\");<\/code><br \/>\n<code>}<\/code><br \/>\n<code>ob_end_clean();<\/code><br \/>\n<code>}<\/code><br \/>\n<code>?&gt;<\/code><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 Bitrix \u041c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430: \u0412\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u043a\u0440\u0438\u043f\u0442 \u0432 \u0444\u0430\u0439\u043b \/bitrix\/php_interface\/init.php, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u043c \u043c\u0435\u0441\u0442\u043e\u043c \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432. \u042d\u0442\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u0435\u0435, \u0447\u0435\u043c \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \/bitrix\/header.php, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u043e\u0442\u0435\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043f\u0440\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u041c\u0435\u0442\u043e\u0434 \u0432\u0441\u0442\u0430\u0432\u043a\u0438: \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 PHP \u0444\u0430\u0439\u043b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 security_headers.php, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u0435 \u0432\u0430\u0448 \u043a\u043e\u0434 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438. \u0412\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/faq.cinar-studio.ru\/index.php?rest_route=\/wp\/v2\/posts\/497"}],"collection":[{"href":"https:\/\/faq.cinar-studio.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/faq.cinar-studio.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/faq.cinar-studio.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/faq.cinar-studio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=497"}],"version-history":[{"count":12,"href":"https:\/\/faq.cinar-studio.ru\/index.php?rest_route=\/wp\/v2\/posts\/497\/revisions"}],"predecessor-version":[{"id":511,"href":"https:\/\/faq.cinar-studio.ru\/index.php?rest_route=\/wp\/v2\/posts\/497\/revisions\/511"}],"wp:attachment":[{"href":"https:\/\/faq.cinar-studio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=497"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/faq.cinar-studio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=497"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/faq.cinar-studio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}