|
|||||||||||
|
RE: IkonBoard v3.1.1: arbitrary command execution
From: Adam Gilmore <vuln(at)optusnet.com.au>
Date: Thu Apr 03 2003 - 16:48:50 EST
-----Original Message-----
Hey, I can't work out any way to possibly exploit this vulnerability. To bypass the directory check, you can use the poisoned null byte, but then, you are limited to doing a require on a directory (see code)
my $code = 'require '. "\"$default/" .$area. '.pm"; $lang ='. $area.
and obviously a require fails on a directory and causes an error, preventing the rest of the code being evalled. I honestly don't think it's possible to insert code in this situation - however if anyone can suggest other solutions, let me know.
-----Original Message-----
Vulnerable: IkonBoard 3.1.1 (and probably earlier) Category: Perl/CGI coding errors Impact: Arbitrary command execution Date: 1st April 2003 Vendor: The Jarvis Group Homepage: http://www.ikonboard.com/ Vendor Status: First notified 26th January 2003 Vendor Fix: None available Details
IkonBoard (http://www.ikonboard.com/) is a comprehensive web bulletin
board
There is a flaw in the Perl code that cleans up user input before
interpolating it into a string which gets passed to Perl's eval()
function,
The flaw is in the code that cleans up the value of the 'lang' cookie,
in
# Make sure the cookie data is legal
$iB::COOKIES->{$iB::INFO->{'COOKIE_ID'}.'lang'} =~
s/^([\d\w]+)$/$1/;
If the cookie contains illegal characters then the s/// operation fails
to
The cookie value is then interpolated into a directory name, which is in turn interpolated into a string passed to the eval function. There is a check that the directory exists, but use of the poisoned null technique allows that check to be bypassed. Suggested Fix
Either apply the attached patch to Sources/Lib/FUNC.pm on the web
server, or
At line 104 of Sources/Lib/FUNC.pm is the code: $sid =~ s/^(\d+)$/$1/; ... change it to: $sid =~ s/^(\d+)$/$1/ or die 'bad sid cookie value'; At line 191 of Sources/Lib/FUNC.pm is the code: $iB::COOKIES->{$iB::INFO->{'COOKIE_ID'}.'lang'} =~ s/^([\d\w]+)$/$1/; ... change it to:
$iB::COOKIES->{$iB::INFO->{'COOKIE_ID'}.'lang'} =~
s/^([\d\w]+)$/$1/ or die 'bad lang cookie value';
Exploit
The following proof of concept exploit demonstrates that the problem is
exploitable by causing a syntax error in the eval(). The Perl syntax
error
I have refrained from publishing a more functional exploit at this time,
to
my $HOST = 'www.example.domain';
use IO::Socket; my $sock = IO::Socket::INET->new("$HOST:80") or die "connect: $!";
$sock->print(<<END) or die "write: $!";
END print while <$sock>;
-- Nick Cleaton nick@cleaton.netReceived on Fri Apr 4 15:54:47 2003 This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:07:38 EDT |
||||||||||
|
|||||||||||