Browsing the Web and Reading E-mail Safely as an Administrator



Similar documents
User Rights vjj 1

Managing and Securing Windows Service Accounts. Bob McCoy, MCSE, CISSP/ISSAP Technical Account Manager Microsoft Corporation

Microsoft Auditing Events for Windows 2000/2003 Active Directory. By Ed Ziots Version 1.6 9/20/2005

Windows Server 2008 Security Resource Kit

How To Use Exchange Reporter Plus On A Microsoft Mailbox On A Windows (Windows) On A Server Or Ipa (Windows 7) On An Ubuntu 7.6 (Windows 8) On Your Pc Or

User guide. Business

isupplier PORTAL ACCESS SYSTEM REQUIREMENTS

Installation and Deployment

Computer Security: Principles and Practice

Installation Guide for Pulse on Windows Server 2008R2

Exam Ref Implementing an Advanced Server Infrastructure. Steve Suehring

Citrix Shared Desktop

Installation Guide for Pulse on Windows Server 2012

Windows Operating Systems. Basic Security

FlexSim LAN License Server

PC Security and Maintenance


Universal Management Service 2015

Securely Registering Applications

WrkSetup.exe Automated Installation (version 8.0.7)

SIEMENS. Sven Lehmberg. ZT IK 3, Siemens CERT. Siemens AG 2000 Siemens CERT Team / 1

ITSS. The University of Michigan Information Technology Security Services. Abstract. Run As User! Audience and Scope

ez Agent Administrator s Guide

Installation Guide For Exchange Reporter Plus

Downloading and Mass Deploying Applications

LifeCyclePlus Version 1

Integrated Virtual Debugger for Visual Studio Developer s Guide VMware Workstation 8.0

Receiver Updater for Windows 4.0 and 3.x

MCTS Guide to Microsoft Windows 7. Chapter 7 Windows 7 Security Features

ET2 System Requirements.docx

IIS, FTP Server and Windows

Get Started Guide - PC Tools Internet Security

What Is Ad-Aware Update Server?

Running the Tor client on Mac OS X

PUBLIC Password Manager for SAP Single Sign-On Implementation Guide

Net Protector Admin Console

Homeland Security Red Teaming

Qbox User Manual. Version 7.0

INTERNET & COMPUTER SECURITY March 20, Scoville Library. ccayne@biblio.org

ILTA HANDS ON Securing Windows 7

NS Financials. Client Platform Guide for Mac Using Safari Incl Citrix Setup As A Local Client

HoneyBOT User Guide A Windows based honeypot solution

Installation & Activation Guide. Lepide Active Directory Self Service

7 Steps to Safer Computing

Computer Security Maintenance Information and Self-Check Activities

What is Aconex Local Copy? Controlling Access to a Datastore Hardware Requirements Software Requirements Installing Aconex Local Copy Troubleshooting

MaaS360 Cloud Extender

Installing GFI MailSecurity

Installation and Troubleshooting Guide for SSL-VPN CONNECTIONS Access

NAS 253 Introduction to Backup Plan

MaaS360 On-Premises Cloud Extender

Investment Management System. Connectivity Guide. IMS Connectivity Guide Page 1 of 11

Setting Up Your FTP Server

NSi Mobile Installation Guide. Version 6.2

This Deployment Guide is intended for administrators in charge of planning, implementing and

Requirements on terminals and network Telia Secure Remote User, TSRU (version 7.1 R4)

Desktop Surveillance Help

Getting Started Guide: Getting the most out of your Windows Intune cloud

PC Installation Documentation for the Instant Messaging and MeetingPlace Features of Your New Telephone

TestElite - Troubleshooting

How To Install And Run Cesview Iii (For New Users)

AkrutoSync 4.0 User Guide

Burst Technology bt-loganalyzer SE

SAS 9.3 Foundation for Microsoft Windows

Installing Oracle 12c Enterprise on Windows 7 64-Bit

HELP DOCUMENTATION E-SSOM INSTALLATION GUIDE

Amazon WorkMail. User Guide Version 1.0

Introduction. Before you begin. Installing efax from our CD-ROM. Installing efax after downloading from the internet

Aspera Connect User Guide

Getting Started Guide for Symantec On-Demand Protection for Outlook Web Access 3.0

Virtual CD v10. Network Management Server Manual. H+H Software GmbH

Contents. Chapter 1 Introducing virtualized Microsoft Office Chapter 2 Packaging Microsoft Office... 5

Getting Started with Microsoft Office Live Meeting. Published October 2007

How To Backup Your Computer With A Remote Drive Client On A Pc Or Macbook Or Macintosh (For Macintosh) On A Macbook (For Pc Or Ipa) On An Uniden (For Ipa Or Mac Macbook) On

SQL Server 2008 R2 Express Edition Installation Guide

Introduction to Computer Security

Team Foundation Server 2013 Installation Guide

OutDisk 4.0 FTP FTP for Users using Microsoft Windows and/or Microsoft Outlook. 5/1/ Encryptomatic LLC

Acronis Backup & Recovery 11.5 Quick Start Guide

CONNECT-TO-CHOP USER GUIDE

Secure Browser Installation Manual

(Installation through ADSelfService Plus web portal and Manual Installation)

The cloud server setup program installs the cloud server application, Apache Tomcat, Java Runtime Environment, and PostgreSQL.

Understanding and evaluating risk to information assets in your software projects

Table of Contents. OpenDrive Drive 2. Installation 4 Standard Installation Unattended Installation

1. Scope of Service. 1.1 About Boxcryptor Classic

Administrators Help Manual

Salesnet CRM Documents

Exchange Migration Guide

Intelligent Power Protector User manual extension for Microsoft Virtual architectures: Hyper-V 6.0 Manager Hyper-V Server (R1&R2)

CYCLOPE let s talk productivity

Outlook Web Access 2003 Remote User Guide

GP REPORTS VIEWER USER GUIDE

ZyWALL SSL 10. User s Guide. Integrated SSL-VPN Appliance. Version /2008 Edition 1

Test Case 3 Active Directory Integration

TECHNICAL TRACKSNETWORKING ESSENTIALS OPPORTUNISTIC LOCKING

Dell UPS Local Node Manager USER'S GUIDE EXTENSION FOR MICROSOFT VIRTUAL ARCHITECTURES Dellups.com

Health Monitor. Setup and Configuration

Support Guide for CCS Service Desk. Banner Document Management (BDM)

Requirements on terminals and network Telia Secure Remote User, TSRU (version 7.3 R6)

Transcription:

1 of 7 12/11/2008 9:14 AM 2008 Microsoft Corporation. All rights reserved. Code Secure Browsing the Web and Reading E-mail Safely as an Administrator Michael Howard Microsoft Security Engineering November 15, 2004 Summary: Michael Howard discusses how you can run as an administrator and access Internet data safely by dropping unnecessary administrative privileges when using any tool to access the Internet. (10 printed pages) Download the DropMyRights.msi file [ http://download.microsoft.com/download/f/2/e/f2e49491-efde-4bca- 9057-adc89c476ed4/dropmyrights.msi ]. I've said this many times, but I'll say it again, "Running with an administrative account is dangerous to the health of your computer and your data." So, whenever someone says they must operate their computers as administrators, I always try to persuade them it's not the correct thing to do from a security perspective. That said, every once in a while I meet someone who has a valid reason. For example, I use one of the computers in my office to install the latest daily build of Windows, and I need to be an administrator to install the OS. However, and this is a big point, I do not read e-mail, browse the Web, or access the Internet in any form when running as an administrator on that machine. And I do not do so because the Web is the source of most of the nasty attacks today. What if someone does want to browse the Web? Or read e-mail? Or do Instant Messaging and so on, and for some reason must run in an administrative context? If you look at the major threats to computers, they are from user interaction with the Web through tools like browsers and e-mail clients. Sure, there are non-user interaction attacks, such as Blaster (http://www.cert.org/advisories/ca-2003-20.html [ http://www.cert.org/advisories /ca-2003-20.html ] ) and Lion (http://www.sans.org/y2k/lion.htm [ http://www.sans.org/y2k/lion.htm ] ), but that's in part why we turned on the firewall in Windows XP SP2! Note For Best practices on running as a non-admin, I urge you to look over Aaron Margosis' blog [ http://weblogs.asp.net/aaron_margosis/ ] to glean tips on running as a non-admin in Windows. An Example of Why Running as an Admin Is Bad Some nasty malware works only because the user browsing the Web is an administrator. A good example is a recent variation of the Bagle/Beagle worm named W32.Beagle.AV@mm. I would recommend you read up on what the worm does once it is invited onto a computer system. Symantec has a good write-up at http://securityresponse.symantec.com/avcenter/venc/data/w32.beagle.av@mm.html [ http://securityresponse.symantec.com/avcenter/venc/data/w32.beagle.av@mm.html ]. I say invited because the malware is not taking advantage of a coding or design defect. It is using simple human error to execute. Amongst the many things this malware does, all of which require admin rights, are: Creating files in the system32 directory. Terminating various processes. Disabling the Windows Firewall. Downloading and writing files to the system32 directory. Deletes registry values in HKLM. All these fail if the user running the e-mail client is not an administrator. So wouldn't it be useful (read: safer) if you could browse the Web, read e-mail, and so on as a non-admin, even though you need to perform your normal daily tasks as an admin? Luckily, Windows XP and Windows Server 2003 and later support this capability using restricted tokens. Further Detail

2 of 7 12/11/2008 9:14 AM Windows XP and Windows Server 2003 and later support functionality called Software Restriction Policy, also known as SAFER [ http://msdn.microsoft.com/library/default.asp.aspx?url=/library/en-us/security/security /safer.asp ], which allows a user or software developer to run code at a lower privilege without having the user enter credential information when the application starts. For example, an administrator could run an application as a normal user by stripping out certain SIDs and privileges from the application's token as the application is launched. Some applications, most notably Internet-facing applications, such as a Web browser, instant messaging, or e-mail client, should never be run under an administrative context. The DropMyRights Application DropMyRights is a very simple application to help users who must run as an administrator run applications in a much-safer context that of a non-administrator. It does this by taking the current user's token, removing various privileges and SIDs from the token, and then using that token to start another process, such as Internet Explorer or Outlook. This tool works just as well with Mozilla's Firefox, Eudora, or Lotus Notes e-mail. The code couldn't be simpler. Here's the core code: ////////////////////////////////////////////////////////////////////////////////// DWORD wmain(int argc, wchar_t **argv) { DWORD fstatus = ERROR_SUCCESS; if (2!= argc && 3!= argc) { Usage(); return ERROR_INVALID_PARAMETER; // get the SAFER level DWORD hsaferlevel = SAFER_LEVELID_NORMALUSER; if (3 == argc && argv[2]) { switch(argv[2][0]) { case 'C' : case 'c' : hsaferlevel = SAFER_LEVELID_CONSTRAINED; break; case 'U' : case 'u' : hsaferlevel = SAFER_LEVELID_UNTRUSTED; break; default : hsaferlevel = SAFER_LEVELID_NORMALUSER; break; // get the command line, and make sure it's not bogus wchar_t *wszpath = argv[1]; size_t cchlen = 0; if (FAILED(StringCchLength(wszPath,MAX_PATH,&cchLen))) return ERROR_INVALID_PARAMETER; SAFER_LEVEL_HANDLE hauthzlevel = NULL; if (SaferCreateLevel(SAFER_SCOPEID_USER, hsaferlevel, 0, &hauthzlevel, NULL)) { // Generate the restricted token we will use. HANDLE htoken = NULL; if (SaferComputeTokenFromLevel( hauthzlevel, // SAFER Level handle NULL, // NULL is current thread token. &htoken, // Target token 0, // No flags NULL)) { // Reserved STARTUPINFO si; ZeroMemory(&si, sizeof(startupinfo)); si.cb = sizeof(startupinfo); si.lpdesktop = NULL;

3 of 7 12/11/2008 9:14 AM // Spin up the new process PROCESS_INFORMATION pi; if (CreateProcessAsUser( htoken, wszpath, NULL, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi)) { CloseHandle(pi.hProcess); CloseHandle(pi.hThread); else { fstatus = GetLastError(); fwprintf(stderr,l"createprocessasuser failed (%lu)\n",fstatus); else { fstatus = GetLastError(); SaferCloseLevel(hAuthzLevel); else { fstatus = GetLastError(); return fstatus; The source code and executable are available at the top of this article. Now let's look at configuring the application to run applications in lower privilege. Setup Simply copy DropMyRights.exe to a folder. Then for each application you want to run in lower privilege, follow the steps in the next three sections. Create a Shortcut Create a shortcut and enter DropMyRights.exe as the target executable, followed by the path to the application you want to execute in lower privilege. For example: C:\warez\dropmyrights.exe "c:\program files\internet explorer\iexplore.exe" Figure 1 shows what this will look like on your screen.

4 of 7 12/11/2008 9:14 AM Figure 1. Path to application that you want to run in lower privilege Updating the Shortcut Name Next, update the name of the shortcut to represent the executable target, and not dropmyrights. I usually put the word "(Safer)" after the application name to denote this application will run in a safer security context. "(Nonadmin)" is another common addition, as shown in Figure 2. Figure 2. Updating the shortcut name Setting the Icon and Run Mode Finally, once the shortcut is created, set the Run option for the shortcut to Minimized and if you want, select a new icon.

5 of 7 12/11/2008 9:14 AM Figure 3. Setting the Run option to Minimized and optionally changing the icon Advanced Options The arguments to DropMyRights are: DropMyRights {path [N C U] The meanings of the variables are: Path is the full path of the application to launch. N means run the application as a normal user. This is the default if you provide no argument. C means run the application as a constrained user. U means run the application as an untrusted user. Chances are, this will cause some applications to fail. The best way to identify what each of these settings does is to look at the resulting process token. The following tables show the changes made to the process token. Table 1. Administrative Account

6 of 7 12/11/2008 9:14 AM DOMAIN\Domain Users None SeSecurityPrivilege BUILTIN\Administrators \ SeBackupPrivilege SeRestorePrivilege SeSystemtimePrivilege SeShutdownPrivilege SeRemoteShutdownPrivilege SeTakeOwnershipPrivilege SeDebugPrivilege SeSystemEnvironmentPrivilege SeSystemProfilePrivilege SeProfileSingleProcessPrivilege SeIncreaseBasePriorityPrivilege SeLoadDriverPrivilege SeCreatePagefilePrivilege SeIncreaseQuotaPrivilege SeUndockPrivilege SeManageVolumePrivilege SeCreateGlobalPrivilege SeImpersonatePrivilege Table 2. Normal User ('N') DOMAIN\Domain Users None BUILTIN \Administrators Table 3. Constrained ('C') DOMAIN\Domain Users DOMAIN\Domain Users BUILTIN \Administrators

7 of 7 12/11/2008 9:14 AM \RESTRICTED Table 4. Untrusted ('U') DOMAIN\Domain Users \RESTRICTED BUILTIN \Administrators The red cross mark means the SID is still in the token, but it is a deny SID. A SID with this attribute is a deny-only SID. When the system performs an access check, it checks for access-denied ACEs that apply to the SID, but it ignores access-allowed ACEs for the SID. The biggest privilege and SIDs delta is between the administrative account and the normal user account. As you can see, all privileges are stripped from the token except the Bypass Traverse Checking privilege (also know as.) Constrained and untrusted are smaller deltas from normal user, and you may start to see some applications fail with security restriction errors. My opinion is use Normal (the default) for most things, and Constrained if you think you'll be browsing hostile or potentially dangerous Web sites. Spot the Security Defect A good number of people worked out the bug in my last article. The CreateFile function is opening the file for all access, when the code only reads from the file. FILE_ALL_ACCESS should be replaced with GENERIC_READ or similar. This is bad because in all likelihood only an administrator can use this code, not a normal user. I see this error often. Can you spot this code flaw? This came across my desk the other day as a bug in some Java DNS stuff. It's an interesting bug, which I rewrote in C# and generalized the flaw. Int16 req;... while (true) { getrequest(); req++; arr[req] = DateTime.Now; Michael Howard is a Senior Security Program Manager in the Secure Engineering group at Microsoft and is the coauthor of Writing Secure Code [ http://www.microsoft.com/mspress/books/5957.asp ], now in its second edition, and the main author of Designing Secure Web-based Applications for Windows 2000. He is also a co-editor of Basic Training in IEEE Security & Privacy Magazine. His main focus in life is making sure people design, build, test, and document nothing short of a secure system. His favorite line is "One person's feature is another's exploit."