PHP3 ‘safe_mode’失效漏洞

漏洞信息详情

PHP3 ‘safe_mode’失效漏洞

漏洞简介

含有安全模式的PHP3无法正确地从相关函数执行的命令中过滤shell元字符。远程攻击者可以利用此漏洞执行命令。

漏洞公告

Index: functions/file.c
===================================================================
RCS file: /repository/php3/functions/file.c,v
retrieving revision 1.229
retrieving revision 1.230
diff -u -r1.229 -r1.230
— functions/file.c 2000/01/01 04:31:15 1.229
+++ functions/file.c 2000/01/03 21:31:31 1.230
@@ -26,7 +26,7 @@
| Authors: Rasmus Lerdorf |
+———————————————————————-+
*/
-/* $Id: file.c,v 1.229 2000/01/01 04:31:15 sas Exp $ */
+/* $Id: file.c,v 1.230 2000/01/03 21:31:31 kk Exp $ */
#include “php.h”
#include
@@ -51,6 +51,7 @@
#include “safe_mode.h”
#include “php3_list.h”
#include “php3_string.h”
+#include “exec.h”
#include “file.h”
#if HAVE_PWD_H
#if MSVC5
@@ -575,7 +576,7 @@
pval *arg1, *arg2;
FILE *fp;
int id;
– char *p;
+ char *p, *tmp = NULL;
char *b, buf[1024];
TLS_VARS;
@@ -600,7 +601,11 @@
} else {
snprintf(buf,sizeof(buf),”%s/%s”,php3_ini.safe_mode_exec_dir,arg1->value.str.val);
}
– fp = popen(buf,p);
+
+ tmp = _php3_escapeshellcmd(buf);
+ fp = popen(tmp,p);
+ efree(tmp); /* temporary copy, no longer necessary */
+
if (!fp) {
php3_error(E_WARNING,”popen(\”%s\”,\”%s\”) – %s”,buf,p,strerror(errno));
RETURN_FALSE;
@lerdorf.on.ca>

参考网址

来源: BID
名称: 911
链接:http://www.securityfocus.com/bid/911

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享