首页 -> 安全研究

安全研究

安全漏洞
Unixware SCOhelp CGI程序存在格式串漏洞

发布日期:2000-09-28
更新日期:2000-09-28

受影响系统:

SCO Unixware 7.0

描述:

SCO Unixware 7 缺省安装时会包含sochelp组件。这是一个监听在tcp 457端口的HTTP
服务器,允许用户访问帮助手册以及其他的一些文档。它的一个用来完成搜索功能的CGI
程序存在一个格式串漏洞,允许远程用户在主机上执行任意代码。尽管攻击者只能得到
'nobody'用户权限(缺省状态下),仍然会给用户非法访问主机系统的机会,他可能进
一步获取更高权限。


<*来源:Juliano Rizzo (CORE-SDI公司)
         http://www.core-sdi.com
  *>



测试方法:

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!


有问题的程序是vtopic CGI脚本,通过提交下列的URL:
  
  http://target:457/search97cgi/vtopic?Action=FilterSearch&filter=&queryText=%25x

可以让服务器产生下列响应:


--
Internal error: STR_sprintf: Invalid format (Error E1-0142 (Query
Builder): Invalid character '%' (0x25))

Result
Search failed: -40

Result
Error E1-0142 (Query Builder): Invalid character '

Result
Error E1-0130 (Query Builder): Syntax error in query string near
character 1

Result
Error E1-0133 (Query Builder): Error parsing query: 81887e0

Result
VdkSearchNew failed, error -40

Result
Request failed for REQUEST_METHOD=, QUERY_STRING=

Component
Component (vsearch) failed in processing request, -2

Action
Action (FilterSearch) failed while processing request in component
(vsearch), -2

Service Manager
Action (FilterSearch) failed in processing request, -2
S97IS Service manager failed to process request




建议:

临时解决方案:

NSFOCUS建议您在没有升级程序或者打补丁之前,按照SCO公司提供的临时解决方案去做:

1) 以root身份登录系统

2) cd /usr/ns-home/httpd-scohelphttp/search97

3) mkdir ./securebin

4) mv ./bin/vtopic ./securebin

5) 在/usr/ns-home/httpd-scohelphttp/search97/bin目录下创建下列一个shell脚本:


#!/bin/sh
VERITYBIN=/usr/ns-home/httpd-scohelphttp/search97/bin
SECUREBIN=/usr/ns-home/httpd-scohelphttp/search97/securebin
configPath=$VERITYBIN/inetsrch.ini
export configPath

# If POST method, convert to QUERY_STRING
if [ -z "$QUERY_STRING" ]
then
        POST=1
        eval `$VERITYBIN/cgiparse -init`
else
        POST=0
fi

# Exit if not set
if [ -z "$QUERY_STRING" ]
then
        exit 1
fi

# Now strip out insecure character %25
QUERY_STRING=`echo "$QUERY_STRING" | sed "s/%25/+/g"`

# First check for multiple ViewTemplate fields
# which could fool vtopic
COUNT=`$VERITYBIN/cgiparse -count -value ViewTemplate 2> /dev/null`
if [ "$COUNT" -gt 1 ]
then
        exit 1
fi

# First check for multiple ResultTemplate fields
# which could fool vtopic
COUNT=`$VERITYBIN/cgiparse -count -value ResultTemplate 2> /dev/null`
if [ "$COUNT" -gt 1 ]
then
        exit 1
fi

# Now check for correct path in ViewTemplate if it has one
if echo "$QUERY_STRING" | egrep -i '&ViewTemplate=' > /dev/null 2>&1
then
        MATCH=`cgiparse -value ViewTemplate 2> /dev/null | egrep -i
'[-A-Za-z0-9_.]+/_SearchTemplates/docview.hts'`
        if [ -z "$MATCH" ]
        then
                exit 1
        fi
fi

# Now check for correct path in ResultTemplate if it has one
if echo "$QUERY_STRING" | egrep -i '&ResultTemplate=' > /dev/null 2>&1
then
        MATCH=`cgiparse -value ResultTemplate 2> /dev/null | egrep -i
'[-A-Za-z0-9_.]+/_SearchTemplates/result.hts'`
        if [ -z "$MATCH" ]
        then
                exit 1
        fi
fi

# OK, so proceed
if [ "$POST" -eq 1 ]
then
        export CONTENT_LENGTH
        echo "$QUERY_STRING" | $SECUREBIN/vtopic
else
        export QUERY_STRING
        $SECUREBIN/vtopic
fi


6) chmod +x vtopic

这个脚本可以作为vtopic的wrapper程序,暂时弥补格式化串漏洞

注意:securebin的名字应该改变,以防止攻击者直接使用这个目录下的vtopic进行攻击。

厂商补丁:

暂无


浏览次数:6590
严重程度:0(网友投票)
本安全漏洞由绿盟科技翻译整理,版权所有,未经许可,不得转载
绿盟科技给您安全的保障