Home > Articles > Programming > Windows Programming

Living the "Least Privilege" Lifestyle: Don't Run Every Day Logged In as an Administrator

📄 Contents

  1. What's the Problem with Running as an Administrator?
  2. The Almighty Administrator
  3. What's Next?
Don Kiely contends that exercising administrative rights over our computers is a major cause of insecure systems. In the first of five articles, he explains the concept of "least privilege" and shows why software developers should be happy to operate as "mere users."
Like this article? We recommend

I recently spoke at several software developer user groups around the country and made this assertion, representing it as one of the fundamental truths of computing today: The fact that most people run with administrative rights on their local machine is the root cause of many or most of today's security problems.

The corollary is that if most operating systems made it easier to run as a mere user without local administrative rights, the computing world would be a safer place. This is called running with a least privilege user account. Least privilege is one of the first principles of any kind of security: A user should have the permissions required to do his or her job, and not a single permission more.

But what does least privilege really mean? How do you do it? Why is it so critical? In this and following articles I'll explore these topics:

  • Why running as a member of the administrators group every day has facilitated many recent worms, viruses, etc.
  • Why running without administrative privileges is safer
  • How to survive daily computer use as a mere user (including lots of tools and tricks)
  • Why it's impossible to develop secure software when running as an administrator
  • How to survive development work as a mere user (with a focus on Visual Studio .NET development)

Many users, particularly those of us who are reasonably technical, run with administrative rights on the local machine because it's easier that way. You can always install software, make a quick tweak to the operating system, solve security exceptions thrown by older applications, run disk defragmentation utilities and other tools that keep the system healthy. Mere users—those without administrative privileges on the local machine—either have to get someone from the help desk to perform such tasks, or meticulously log off and log back on using an account with administrative privileges to perform the privileged task, and then log off and back on as a mere user. The latter option gets old fast, but there are better ways to survive running as a least privilege user, and I'll cover them in this series of articles.

No matter how technically savvy you may be, there's no way to keep spyware, viruses, worms, and other nasties from running and taking over your machine. This is why I and others have worked to spread the least privilege message. Until operating systems force users to live with lesser privileges—and make it easier to do so—we all need to make the small extra effort. It's not as painful as you might think, but it does require learning a bit about how security works and the tools available in the operating system or from third parties.

I run Windows and am a Windows application developer, so I'll focus on Windows for these articles. The basic concepts apply to any operating system, but there are variations in the tools and techniques you'll need to use for living the least privilege lifestyle and developing apps that mere users can run.

What's the Problem with Running as an Administrator?

From a developer's standpoint, there are two reasons not to run as an administrator on your development machine:

  • Your machine is more susceptible to attack by malware.
  • It's impossible to write secure code.

I realize that these are strong assertions, but I've discovered the hard way that they're painfully true.

The reason that your computer is more susceptible to attacks is that malware launched from a process with your security token by default inherits that token. That's why if you run as an administrator, fire up Microsoft Outlook, open an email message, and double-click the attachment, the evil.exe file that runs has full administrative rights on the local machine. That code owns your machine, without any need to implement any tricky code to gain control of the machine. And if you're running as a domain administrator, the code owns the network.

Simply put, most recent malware attacks would not have been as serious had most people been running as a least privilege user. At the very least, malware would have spread far more slowly with fewer damaging effects. But with admin privileges, malware can read and write to any location on the hard drive and Windows registry (with very few exceptions), inserting any kind of nasty code. You've probably heard of the legions of zombies used by spammers and distributed denial-of-service attacks to spread their damage. These zombies are machines that have been so thoroughly compromised that attackers can use them at will as a free platform from which to spew spam or pummel a target. And the owners of those compromised computers are often blissfully ignorant of their contribution to spam and computer attacks.

The other major problem with running with administrative privileges is that it's impossible to write secure code. This is because it's far too easy to build insecure assumptions into your code that lead to security problems. Here's a simple example of how this problem occurs. Say that in the early stage of a project you write some low-level code that saves user configuration information to a file in the application directory. (Mere users don't have write permission to the c:\Program Files directory in Windows because such a permission would allow malware to insert code into an EXE or DLL file and save the hacked file to its original location.) Because you're running with administrative privileges, the code runs fine locally without causing any kind of security exception. As the project progresses, layer upon layer of code, all the way up to the user interface, expects the configuration information to be saved to that specific location, perhaps because it reads the information from that location. Over the life of the project maybe hundreds of components grow to depend on that flawed behavior. By the time you're ready to deploy, the problem has grown into a major flaw that would take hundreds of person-hours to fix.

When describing this problem in user groups, someone inevitably protests, "But we test under a least privilege account, so we'll find the problem and fix it!" Ah, yes, the argument that testing finds all flaws—how we developers just love the testing staff. The problem is that this level of testing inevitably happens only late in the project, when the security flaw is so insidious as to be impossible to fix. Because these kinds of security flaws tend to be rooted in low-level code, the behavior has likely proliferated throughout the application. Besides, you'd have to thoroughly test every possible path through the code with differing levels of permissions to completely root out the problem. Such detailed testing is very difficult and few shops tests apps that thoroughly.

This example of writing to the application directory is one of the simplest such security flaws. Throw in a few more insidious and subtle security bugs and there's no way your app will ship on time. Unless, of course, you deploy the app and require every user to have admin privileges, thus perpetuating the myth that users need local administrative rights to run desktop software. This has been the cycle for years now. It's time to break that cycle and create secure computing environments.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020