DMA[2005-0614a] - 'Global Hauri ViRobot Server cookie overflow' Author: Kevin Finisterre Vendor: http://www.globalhauri.com Product: 'ViRobot Linux (and Unix?) Server' References: http://www.digitalmunition.com/DMA[2005-0614a].txt Description: HAURI, Inc. is a leading anti-virus solution provider in the global market. The "ViRobot" which was developed exclusively by HAURI, is an excellent and powerful anti-virus that uses a unique type of detection engine technology to detect the latest viruses and to repair files infected with those viruses. The HAURI anti-virus technology is regarded highly in Korea and has received rave reviews from all over the world. HAURI has a customer base in multiple parts of the world: US & Canada : Global HAURI Inc. - http://www.globalhauri.com Singapore : HAURI ASIA Pte Ltd. - http://www.hauri.com.sg Japan : HAURI JAPAN Inc. - http://www.hauri.co.jp China : China Blue Star Hauri Technology Co., Ltd. - http://www.hauri.com.cn Latin/Mexico : HAURI Latinoamerica S.A. - http://www.haurilatin.com Latin/Brazil : Hauri do Brazil - http://www.haurilatin.com Europe : Hauri Europe GmbH - http://www.hauri-europe.com Korea : HAURI Inc. - http://www.hauri.co.kr HAURI, Inc. is also a GSA Schedule compatible company. Our testing was performed against the 60 Day ViRobot trial located at: http://www.globalhauri.com/html/download/down_linux_end.html b37ae48a9c46985a753f5d28588753c2 /home/kfinisterre/linux_eng_60days.tar.gz Both ViRobot Unix Server and ViRobot Linux Server have a user-friendly web-based control interface. Access control is built into the system to ensure that only authorized personnel can have control of the server. Unfortunately the system makes use of cookie based authentication in an insecure manor. During our trial run we found that the /usr/local/ViRobot/cgi-bin/addschup binary is vulnerable to a trivial remote expoit. In order to explain the bug we can make use of multiple exported variables to simulate a remote request. Below we show the environmental conditions necessary to exploit addschup remotely. The fact that addschup is setuid helps make this both a local and remote root. jdam:/usr/local/ViRobot/cgi-bin# ls -al addschup -rwsr-sr-x 1 root staff 26484 2005-01-05 01:30 addschup We need to set the following variables in order to behave as if a browser request was made. kfinisterre@jdam:/tmp$ export REMOTE_ADDR=127.0.0.1 kfinisterre@jdam:/tmp$ export REQUEST_METHOD=POST kfinisterre@jdam:/tmp$ export CONTENT_TYPE=application/x-www-form-urlencoded kfinisterre@jdam:/tmp$ export CONTENT_LENGTH=1 kfinisterre@jdam:/tmp$ export PATH=$PATH:/sbin:/usr/sbin At this point the cgi binary should run however it will complain that we have not authenticated. You need to authenticate. >From the usage of ltrace we found that the request for authentication is checked via a cookie with the paramaters "ViRobot_ID" and "ViRobot_PASS". The ViRobot_PASS is optional for exploitation. For the time being setting the ViRobot_ID to a string of 36 chars should work just fine. kfinisterre@jdam:/tmp$ export HTTP_COOKIE=ViRobot_ID=<36 chars> Because we set out CONTENT_LENGTH to 1 earlier we must send at least one char to the stdin of the addschup binary. When addschup is satisfied with all environment of the variables and the input from stdin it will attempt to create a crontab file for root. Since we are running the program as a regular binary rather than as a cgi the output html that the web browser should recieve is dumped to the terminal. kfinisterre@jdam:/usr/local/ViRobot/cgi-bin$ echo a | ./addschup Content-type:text/html
In the above example we chose to use a ViRobot_ID of 36 chars. We did this in order to outline the basis of the vulnerability. As mentioned above addschup attempts to add the scheduled update to roots crontab in /var/spool/cron/root. Unfortunately the author of ViRobot made use of a small buffer to hold the username from the cookie data. Because of this some of our userinput has spilled over into the buffer that is supposed to contain the entry that will be placed in the crontab file. The result as you can see is a string of four A's in roots crontab just before the vrupdate command. The above example causes a root crontab entry with malicious userinput. kfinisterre@jdam:/usr/local/ViRobot/cgi-bin$ cat /var/spool/cron/root * * * * * AAAA/ViRobot/vrupdate -s > /dev/null 2>&1 The below output from gdb outlines the usage of a small 32 byte buffer to store the user name for ViRobot. The data stored in the username variable comes from the HTTP_COOKIE's ViRobot_ID field, if this data is longer than 32 chars it will wind up bleeding over into the install_path variable. This is an example of a valid username stored in the username buffer: 0x8052e00