存档

文章标签 ‘apache’

Possible Arbitrary Code Execution with Null Bytes, PHP, and Old Versions of nginx

2011年8月25日 admin     712 views 没有评论

from:https://nealpoole.com/blog/2011/07/possible-arbitrary-code-execution-with-null-bytes-php-and-old-versions-of-nginx/

After publishing my previous blog post on PHP, nginx configuration, and potential arbitrary code execution, I came across a separate null-byte injection vulnerability in older versions of nginx (0.5.*, 0.6.*, 0.7 <= 0.7.65, 0.8 <= 0.8.37). By taking advantage of this vulnerability, an attacker can cause a server that uses PHP-FastCGI to execute any publicly accessible file on the server as PHP.

In vulnerable versions of nginx, null bytes are allowed in URIs by default (their presence is indicated via a variable named zero_in_uri defined in ngx_http_request.h). Individual modules have the ability to opt-out of handling URIs with null bytes. However, not all of them do; in particular, the FastCGI module does not.

The attack itself is simple: a malicious user who makes a request to http://example.com/file.ext%00.php causes file.ext to be parsed as PHP. If an attacker can control the contents of a file served up by nginx (ie: using an avatar upload form) the result is arbitrary code execution. This vulnerability can not be mitigated by nginx configuration settings like try_files or PHP configuration settings like cgi.fix_pathinfo: the only defense is to upgrade to a newer version of nginx or to explicitly block potentially malicious requests to directories containing user-controlled content. 阅读全文…

Apache+Php Web安全配置全攻略

2010年4月15日 admin     2,042 views 没有评论

apache+php Web安全配置全攻略

kindle整理
个人整理算不上原创,mysql的略过不说了

apache方面:

1.编译源代码,修改默认的banner

2.修改默认的http状态响应码404,503等默认页面

3.访问特殊目录需要密码.htaccess

4.关闭索引目录options -Indexes

5.关闭CGI执行程序options -ExecCGI

6.apache限制目录php_admin_value open_basedir /var/www

7.apache的php扩展名解析漏洞
apache配置文件,禁止.php.这样的文件执行,配置文件里面加入

<Files ~ “\.(php.|php3.)”>
Order Allow,Deny
Deny from all
</Files>

8.apache设置上传目录无执行权限
关闭路径/www/home/upload的php解析:
<Directory “/www/home/upload”>
<Files ~ “.php”>
Order allow,deny
Deny from all
</Files>
</Directory>

PHP方面:
阅读全文…

[zz]Linux Hardening & Security

2010年3月22日 admin     2,515 views 没有评论

From:http://www.milw0rm.com/papers/346

=======================================
|———–:[INFO]:——————|
|————————————-|
| Title: “Linux Hardening & Security” |
| Author: Krun!x | QK |
| E-Mail: only4lul@gmail.com |
| Home: madspot.org | ljuska.org |
| Date: 2009-06-20 |
=======================================

阅读全文…

分类: 网站防护 标签: , ,