织梦dedecms程序安全设置

利用伪静态取消目录执行脚本

linux系统:

新建一个txt文本文件,用文本编辑器打开,复制以下规则保存,上传到网站根目录,将文件重新命名.htaccess(注意有点)

RewriteEngine on

#安全设置 禁止以下目录运行指定php脚本

RewriteCond % !^$

RewriteRule a/(.*).(php)$ – [F]

RewriteRule data/(.*).(php)$ – [F]

RewriteRule images/(.*).(php)$ – [F]

RewriteRule css/(.*).(php)$ – [F]

RewriteRule js/(.*).(php)$ – [F]

RewriteRule style/(.*).(php)$ – [F]

RewriteRule skin/(.*).(php)$ – [F]

RewriteRule templets/(.*).(php|htm)$ – [F]

RewriteRule uploads/(.*).(php)$ – [F]


windows系统:

新建一个txt文本文件,用文本编辑器打开,复制以下规则保存,上传到网站根目录,将文件重新命名web.config。

<?xml version="1.0" encoding="UTF-8"?>

<configuration>

<system.webServer>

<rewrite>

<rules>

<rule name="Block a" stopProcessing="true">

<match url="^a/(.*).php$" />

<conditions logicalGrouping="MatchAny">

<add input="{USER_AGENT}" pattern="a" />

<add input="{REMOTE_ADDR}" pattern="" />

</conditions>

<action type="AbortRequest" />

</rule>

<rule name="Block data" stopProcessing="true">

<match url="^data/(.*).php$" />

<conditions logicalGrouping="MatchAny">

<add input="{USER_AGENT}" pattern="data" />

<add input="{REMOTE_ADDR}" pattern="" />

</conditions>

<action type="AbortRequest" />

</rule>

<rule name="Block skin" stopProcessing="true">

<match url="^skin/(.*).php$" />

<conditions logicalGrouping="MatchAny">

<add input="{USER_AGENT}" pattern="skin" />

<add input="{REMOTE_ADDR}" pattern="" />

</conditions>

<action type="AbortRequest" />

</rule>

<rule name="Block style" stopProcessing="true">

<match url="^style/(.*).php$" />

<conditions logicalGrouping="MatchAny">

<add input="{USER_AGENT}" pattern="style" />

<add input="{REMOTE_ADDR}" pattern="" />

</conditions>

<action type="AbortRequest" />

</rule>

<rule name="Block css" stopProcessing="true">

<match url="^css/(.*).php$" />

<conditions logicalGrouping="MatchAny">

<add input="{USER_AGENT}" pattern="css" />

<add input="{REMOTE_ADDR}" pattern="" />

</conditions>

<action type="AbortRequest" />

</rule>

<rule name="Block js" stopProcessing="true">

<match url="^js/(.*).php$" />

<conditions logicalGrouping="MatchAny">

<add input="{USER_AGENT}" pattern="js" />

<add input="{REMOTE_ADDR}" pattern="" />

</conditions>

<action type="AbortRequest" />

</rule>

<rule name="Block images" stopProcessing="true">

<match url="^images/(.*).php$" />

<conditions logicalGrouping="MatchAny">

<add input="{USER_AGENT}" pattern="images" />

<add input="{REMOTE_ADDR}" pattern="" />

</conditions>

<action type="AbortRequest" />

</rule>

<rule name="Block templets" stopProcessing="true">

<match url="^templets/(.*).php$" />

<conditions logicalGrouping="MatchAny">

<add input="{USER_AGENT}" pattern="templets" />

<add input="{REMOTE_ADDR}" pattern="" />

</conditions>

<action type="AbortRequest" />

</rule>

<rule name="Block uploads" stopProcessing="true">

<match url="^uploads/(.*).php$" />

<conditions logicalGrouping="MatchAny">

<add input="{USER_AGENT}" pattern="uploads" />

<add input="{REMOTE_ADDR}" pattern="" />

</conditions>

<action type="AbortRequest" />

</rule>

</rules>

</rewrite>

</system.webServer>

</configuration>
赞 (0)

评论

8+5=