Date: Tue, 9 Mar 1999 12:57:42 -0800 From: Aleph One To: BUGTRAQ@netspace.org Subject: Windows NT Screen Saver Vulnerability Cybermedia Software has found the following vulnerability: < http://www.cybermedia.co.in/NT%20Security/SS%20vulnerability.htm > Screen Saver vulnerability Description: The Screen Saver is started by Winlogon.Exe whenever the machine is idle for the specified amount of time. Screen Saver setting is a per user property and every user has right to set his own screen saver. The screen saver is started by Winlogon.Exe, initially in a suspended mode using CreateProcess API call. Once Winlogon.Exe gets the process handle to screen saver, it changes the primary security token of the screen saver to that of the logged in user and then resumes the screen saver process. This is done for security reasons. If Winlogon were to NOT do this, then screen saver would run with the security context of Winlogon.Exe (which runs in system context). Problem: The Winlogon.Exe DOES NOT check whether the changing of Primary token is successful. Hence if setting of primary token fails due to some reason, the screen saver binary will run in system context and be able to do whatever it pleases (e.g adding the logged in user to admin group). Simulation: On Windows NT 3.51 and all its service packs, Windows NT 4.0 with Service Pack 1, and NT 5.0 beta1 and beta2, when an MS-DOS application is spawned, the returned process handle is junk (rather it is a special event handle). The simulation consists of one 32-bit application say BEADMIN.EXE and one MS-DOS based application, say SCRNSAVE.EXE. The BEADMIN.EXE when started does the following * Creates one event in `not-signal'ed state * Sets up the screen saver. The screen saver executable is specified as SCRNSAVE.EXE and the timeout is set to minimum. . BEADMIN.EXE now waits on the event. After some time, the screen saver is triggered. This results in Winlogon.Exe spawning SCRNSAVE.EXE. Since the CreateProcess call returns junk handle to Winlogon.Exe, the setting of primary token fails. Hence the SCRNSAVE.EXE application (NTVDM.EXE) runs in System Context. This SCRNSAVE.EXE again spawns BEADMIN.EXE application. Now this second copy of BEADMIN.EXE inherits the security context of NTVDM which is System Context. This application adds the logged in user to admin group and signals the event on which first instance of BEADMIN.EXE is waiting. In response to this the first copy of BEADMIN.EXE resets back the Screen Saver settings and quits. The logged in user name is passed between the first and second copy of BEADMIN.EXE using shared section. Comments: Although this program does not run on versions of Windows NT 4.0 after Service pack 1, the vulnerability exists in these versions as well. i.e in these versions also Winlogon.exe fails to perform the validation. but the condition required for simulation does not happen. i.e In these versions, winlogon.exe gets the proper handle to the process. Since the vulnerability is once again reproducible in the beta versions of NT 5.0, it is clear that it needs to be fixed. [1]Download Demo for Screen Saver vulnerability Blueline.jpg (398 bytes) Copyright© 1999, Cybermedia Software Private Limited. All trademarks are property of their respective holders. References 1. http://www.cybermedia.co.in/Free%20Downloads/ScrnSave.zip ----------------------------------------------------------------------------- Date: Wed, 10 Mar 1999 19:10:55 -0700 From: Steve Manzuik To: NTBUGTRAQ@LISTSERV.NTBUGTRAQ.COM Subject: Re: NT SCREENSAVER VULNERABILITY And if you read the entire article, you will notice that this only works on machines that are running NT 3.51 or 4.0 SP1. Anything prior to SP1 is not at risk. Why did these guys bother publishing this?? >This was cut from the March 10th, 1999 Windows NT Magazine Security Update >Buletin: > >* NT SCREENSAVER VULNERABILITY > >Prasad Dabak, of Cybermedia Software Private Limited, has discovered a > >vulnerability in the Windows NT screensaver where a user could possibly > ----------------------------------------------------------------------------- Date: Wed, 10 Mar 1999 22:06:52 -0500 From: Russ To: NTBUGTRAQ@LISTSERV.NTBUGTRAQ.COM Subject: Re: NT SCREENSAVER VULNERABILITY >And if you read the entire article, you will notice that this only works >on machines that are running NT 3.51 or 4.0 SP1. Anything prior to SP1 >is not at risk. I assume you mean anything after SP1 is not at risk. I've been told that the exposure discovered by Cybermedia does, in fact, exist in versions after NT 4.0 SP1, but is "far more complex" to execute. Ergo, they haven't been able to construct a working demonstration exploit on systems running SP2 or greater. As such, it may only be a matter of time until these "complexities" are resolved and an exploit released. I'm further told that Microsoft will be releasing a fix/patch for this. Its worth noting that Cybermedia said the exploit was demonstrable in Win2000 B2, implying the fault continues to exist. When I first received notice of this from Mark Edwards of NTShop, like you, I discounted the worthiness of a report to NTBugtraq. However, if what Mark says is true (and no reason to doubt it), this "heads-up" is worth it. Let us not, however, get into any discussions about Screen Saver Security in general, that's not the issue here. What's at issue is the way Winlogon.exe handles the situation created by the demonstration program (which happens to be a screen saver). >why did these guys bother publishing this?? If nothing else, consider it useful FYI. If Microsoft confirms the problem continues to exist in SP2/SP3/SP4, consider this very useful information. Cheers, Russ - NTBugtraq moderator ----------------------------------------------------------------------------- Date: Sat, 13 Mar 1999 00:29:40 -0800 From: aleph1@UNDERGROUND.ORG To: BUGTRAQ@netspace.org Subject: Microsoft Security Bulletin (MS99-008) The following is a Security Bulletin from the Microsoft Product Security Notification Service. Please do not reply to this message, as it was sent from an unattended mailbox. ******************************** Microsoft Security Bulletin (MS99-008) -------------------------------------- Patch Available for Windows NT "Screen Saver" Vulnerability Originally Posted: March 12, 1999 Summary ======= Microsoft has learned of a vulnerability affecting all versions of Microsoft(r) Windows NT(r) operating system, which could allow a user to gain administrative privileges on a computer. In most common usage scenarios, this vulnerability presents itself on workstations, terminal servers, and other systems that allow non-administrative users to interactively log on. Less-common configurations could also be affected, and are discussed below. A fully supported patch is available to eliminate the vulnerability, and Microsoft recommends that affected customers download and install it, if appropriate. Issue ===== Windows NT provides a screen saver feature, in which a user-selected screen saver program is run when the machine has been idle for a specified length of time. Windows NT initially launches a screen saver in the local system context, then immediately changes its security context to match that of the user. However, Windows NT does not check whether this context change was successfully made. This is the underlying problem in this vulnerability. If the context change can be made to fail, the screen saver will remain running in a highly-privileged state. The risk is that a malicious user could develop a screen saver program that, for example, uses the elevated privileges to add the author to the Administrators group. It is important to understand that the user must able to run exploitation code on a machine in order to elevate their privileges. There are two types of machines at risk: - Machines that allow non-administrative users to interactively log on. Workstation and terminal servers typically do allow this, but, per standard security practices, most other machines only allow administrators to interactively log on. - Machines that allow remote users to submit arbitrary programs for execution. Servers such as domain controllers, line of business servers, application servers, print and file servers and the like typically do not accept arbitrary programs for execution. It also is important to note that the scope of the privilege elevation is highly dependent on the specific machine on which the exploitation code is run. For example, a user who exploited this vulnerability on a workstation could join the local Administrators group, but could not directly exploit this vulnerability to become a domain administrator. However, a user who exploited this vulnerability on a domain controller would be able to become a domain Administrator, because the domain SAM is shared among all domain controllers. While there are no reports of customers being adversely affected by this vulnerability, Microsoft is proactively providing a patch to allow customers to take appropriate action to protect themselves against it. Affected Software Versions ========================== Microsoft Windows NT Workstation 4.0 Microsoft Windows NT Server 4.0 Microsoft Windows NT Server 4.0, Enterprise Edition Microsoft Windows NT Server 4.0, Terminal Server Edition What Microsoft is Doing ======================= Microsoft has released patches that fix the problem identified. The patches are available for download from the sites listed below in What Customers Should Do. Microsoft also has sent this security bulletin to customers subscribing to the Microsoft Product Security Notification Service. See http://www.microsoft.com/security/services/bulletin.asp for more information about this free customer service. Microsoft has published the following Knowledge Base (KB) article on this issue: - Microsoft Knowledge Base (KB) article Q221991, Screen Saver Vulnerability Lets User Privileges be Elevated. http://support.microsoft.com/support/kb/articles/q221/9/91.asp (Note: It might take 24 hours from the original posting of this bulletin for the KB article to be visible in the Web-based Knowledge Base.) What Customers Should Do ======================== Microsoft recommends that customers evaluate the degree of risk that this vulnerability poses to their systems and determine whether to download and install the patch. The patch can be found at: - X86-based Windows NT Workstation and Server 4.0 (including Enterprise Edition): ftp://ftp.microsoft.com/bussys/winnt/winnt-public/fixes/ usa/NT40/hotfixes-postSP4/ScrnSav-fix/Scrnsavi.exe - X86-based Windows NT Server 4.0, Terminal Server Edition: ftp://ftp.microsoft.com/bussys/winnt/winnt-public/fixes/ usa/NT40TSE/hotfixes-postSP3/ScrnSav-fix/Scrnsavi.exe - Alpha-based Windows NT Workstation and Server 4.0 (including Enterprise Edition): ftp://ftp.microsoft.com/bussys/winnt/winnt-public/fixes/ usa/NT40/hotfixes-postSP4/ScrnSav-fix/Scrnsava.exe - Alpha-based Windows NT Server 4.0, Terminal Server Edition: ftp://ftp.microsoft.com/bussys/winnt/winnt-public/fixes/ usa/NT40TSE/hotfixes-postSP3/ScrnSav-fix/Scrnsava.exe (Note: The above URLs have been wrapped for readability) (Note: Patches for Windows NT Server 4.0, Terminal Server Edition, will not be available immediately upon release of this bulletin, but will be released shortly after.) More Information ================ Please see the following references for more information related to this issue. - Microsoft Security Bulletin MS99-008, Patch Available for Windows NT 'Screen Saver' Vulnerability (the Web-posted version of this bulletin), http://www.microsoft.com/security/bulletins/ms99-008.asp. - Microsoft Knowledge Base (KB) article Q221991, Screen Saver Vulnerability Lets User Privileges be Elevated, http://support.microsoft.com/support/kb/articles/q221/9/91.asp (Note: It might take 24 hours from the original posting of this bulletin for the KB article to be visible in the Web-based Knowledge Base.) Obtaining Support on this Issue =============================== If you require technical assistance with this issue, please contact Microsoft Technical Support. For information on contacting Microsoft Technical Support, please see http://support.microsoft.com/support/contact/default.asp. Revisions ========= - March 12, 1999: Bulletin Created For additional security-related information about Microsoft products, please visit http://www.microsoft.com/security ----------------------------------------------------------------- THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. (c) 1999 Microsoft Corporation. All rights reserved. Terms of Use. ******************************************************************* You have received this e-mail bulletin as a result of your registration to the Microsoft Product Security Notification Service. You may unsubscribe from this e-mail notification service at any time by sending an e-mail to MICROSOFT_SECURITY-SIGNOFF-REQUEST@ANNOUNCE.MICROSOFT.COM The subject line and message body are not used in processing the request, and can be anything you like. For more information on the Microsoft Security Notification Service please visit http://www.microsoft.com/security/bulletin.htm. For security-related information about Microsoft products, please visit the Microsoft Security Advisor web site at http://www.microsoft.com/security. ----------------------------------------------------------------------------- Date: Sat, 13 Mar 1999 02:38:08 -0500 From: Russ To: NTBUGTRAQ@LISTSERV.NTBUGTRAQ.COM Subject: Alert: Microsoft Security Bulletin (MS99-008) - NT Screensaver Vulnerability Microsoft have released a Security Bulletin which covers an issue raised by Cybermedia Software Private Limited in their March 10th, 1999 announcement . Microsoft's bulletin is more forth-coming than usual in pointing out the potential for exploit, something I'm sure we all welcome. Although they do not explicitly state it, the fact that a ScrnSav-fix directory has been added under the Post-SP3 and Post-SP4 directories of NT 4.0 and NT 4.0 Terminal Server (intel and alpha), I guess its safe to say that the exploit could've been made to work on releases beyond SP1 (as was originally reported). Small savings are gained from Cybermedia's inability to create a demonstration exploit for SP3 or SP4 I guess (not that someone won't do one in the future). Anyone thinking of implementing this fix should seriously look at the security of user profiles. Screen Savers represent all sorts of other potential issues, and if properly controlled prior to the announcement of this exploit, the exploit probably didn't represent much of a direct threat. That said, the lack of verification of a security context change in a core component of NT is, as MS put it in their Bulletin, "the underlying problem". The daunting size of NT, in terms of secure programming practice verification, is truly showing if this functionality has not been verified throughout all NT applications. Stop and count the number of processes you can think of that do security context switching...;-[ Microsoft have prepared a KB article describing the vulnerability. This article was not available when I checked. Finally, while not directly related to this issue, I had a conversation with individuals representing Cybermedia Software Private Limited. In particular I discussed with them the issue of releasing exploits to the "media" without receiving any response from the vendor (or waiting any amount of time for such a response). Its certainly their right, as it is anyone's, to do this. However, in the spirit of White Hat Infosec, I sought to encourage them to, um, do things differently in the future. Their message to me was that they would "definitely notify Microsoft ahead of time and adopt that as a policy". I offered them, as I hope you all know I offer you, NTBugtraq's full support and capabilities for getting the right people involved when a discovery needs to be addressed. Cheers, Russ - NTBugtraq moderator