Home php教程 php手册 网站防注入与挂马 PHP.INI 安全设置

网站防注入与挂马 PHP.INI 安全设置

May 25, 2016 pm 04:40 PM

当要在防止页面攻击时,可在页面的头部include防攻击文件,就像通用防注入文件,我们可以用三种情况来办到:

1、在每个文件内引用,这样的文件是可以,不过如果一个网站内有几百个文件的话就不方便了.

2、在共同包含文件内引用一下,比如 config.inc.php,这是一个好办法,也是目前市场上比较流行的做法.

3、在php.ini中引用,在配置文件内引用的话,将影响到所有的网站,包含所有页面,这就像当年流行的一些免费空间商,当你免费开通一个ftp空间,上传网站以后,空间内会出现广告一样,不知道是不是这种方法,但是目的是一样的,这样做的好处是:如果是一个公司或者是一个企业内部网站的话,即安全,维护也方便.

前两种方法大家都清楚,第三种就是在php.ini中,找到此节:

;automatically add files before or after any php document. 
;auto_prepend_file = "phpids.php" 
;auto_append_file = "alert.php"
Copy after login

默认是空,请添加所包含的文件,同时找到:

;unix: "/path1:/path2"  
;include_path = ".:/php/includes"  
;  
;windows: "path1;path2"  
include_path = ".;f:phpnowhtdocs"
Copy after login

因为我的是win环境,所以开启了windows选项,包含路径可自由修改,同时,这样的功能也为我们攻击也造成了方便,比如挂马,现在"市场"上也有很多的挂马技巧,就不多说了,我们可以利用auto_prepend_file选项,来批量挂马了,可以将整个服务器上的网站挂上,优点为:不影响速度、不修改文件、方法新颖,缺点为:必须对php.ini有写权限.


教程网址:

欢迎收藏∩_∩但请保留本文链接。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)