H-Sphere WebShell远程命令执行漏洞
发布日期:2003-01-06
更新日期:2003-01-10
受影响系统:HSphere Webshell 20020224
描述:
BUGTRAQ ID:
6537
Webshell是一款基于WEB的应用程序,可以作为文件管理器进行文件上传和下载处理,使用用户名/密码方式进行认证,以suid root属性运行。
Webshell中多处代码对用户提交的请求缺少正确过滤检查,远程攻击者可以利用这个漏洞以root用户权限在系统上执行任意命令。
Webshell中的'command.C'114-117行中:
string file = dirname + '/' + cgi.varByName("file");
string mode = cgi.varByName("mode");
string tmp=CHMOD+mode+" "+shquote(encodeFileName(file));
if (0==system(tmp.c_str())) {
由于对HTTP查询字段中的'mode'变量缺少正确检查,提交包含恶意命令的参数给'mode'变量,可以导致以root用户权限执行(如 'mode=$(cat /etc/passwd) 0755')。
在'command2.cc'中的170-228之间也存在对输入缺少正确过滤问题:
void Command::compress(bool download) {
string zipfile=encodeFileName(cgi.varByName("zipfile"));
string compression=cgi.varByName("compression");
.
.
if (compression.compare("zip")==0) {
.
.
cmd=ZIP" -q -r -b /tmp "+zipfile+tmp;
}
.
.
if (!error) {
if (download)
html.header("application/x-unknown");
error= !((chdir(dirname.c_str())==0) && (system(cmd.c_str())==0));
由于对HTTP查询中的'zipfile'字段数据缺少正确检查,提交包含元字符加SHELL命令的数据作为'zipfile'值,可能以root用户权限执行这些恶意命令(如'zipfile=xyzzy`ls -l`')。
<*来源:Carl Livitt (
carl@learningshophull.co.uk)
链接:
http://marc.theaimsgroup.com/?l=bugtraq&m=104187147309413&w=2
*>
建议:
厂商补丁:
HSphere
-------
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:
升级程序:
http://www.hsphere.com/WebShell-2.4.tar.gz
或下载补丁:
http://www.psoft.net/misc/webshell_patch.html浏览次数:3193
严重程度:0(网友投票)