Securing the *NIX Root Superuser (UID0)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Idira Success Blogs
19 min read
L4 Transporter
There are many variations of *NIX-based operating systems in the wild (e.g., Unix, Linux, RHEL, AIX, etc.), used for many different reasons, but the one thing they have in common (besides the fact that they’re all *NIX kernel based-OSes) is that they all contain an all-power superuser called “root”. With *NIX being one of the most popular operating systems running on servers across organizations of all sizes, it’s important to understand how we can secure our *NIX hosts and protect our organizations. In this article, we'll cover why securing the *NIX Root user is important, what the challenges surround the built-in superuser, and how Idira can help secure these accounts, including the discovery, prioritization, and implementation of controls.

Introduction
Associated with one of the most ubiquitous terms in IT security, gaining “root” access, every single *NIX-based server OS build has a built-in superuser administrator account that’s local to that operating system. It’s commonly recognized by its user identifier (UID) zero, hence the nickname “UID0 account”. This account is intended to be used in emergency situations only to perform administrative actions on its host, think of it as a password of last resort. Securing them is considered “table stakes security” – whether you subscribe to NIST, CIS, SANS, or some other industry guidance, they’re all going to tell you that you must secure them. Many regulatory bodies telling you to do the same too, that’s why these accounts are constantly popping up on audit findings.


The Challenge
To address and remediate the security risks, we must better understand why these root accounts are commonly compromised. For starters, they’re all powerful on their host, which means they can be used to bypass other local layers of security on the machine. These superuser accounts often re-use the same password across many machines in the organization out of simplicity and convenience, but this creates the ability to move laterally and bounce from machine to machine. Those passwords often go unmanaged, last changed literally years or decades ago, and stored in a text document or digital safe.


*NIX servers also play host to a variety of other privileged credential repositories: business applications, CI/CD pipeline tools and other automation services. *NIX servers power and enable digital businesses, they’re everywhere and used for just about everything.

But they also pose an additional unique challenge that they’re Windows-based counterparts typically don’t. *NIX-based operating systems also allow you to authenticate with a key, in addition to just a password, making the security effort more complicated. Those SSH key pairs are commonly created with an out-of-band process and are often overlooked, with those keys regularly hard-coded in scripts and batch jobs to make IT admins lives easier. For all these reasons, malicious actors continue to target what the industry ironically considers to be tables takes security.

The Solution
Idira addresses these challenges through the use proactive and reactive controls at rest, in transit and in use. By adhering to the recommendations below, you’ll have gained control over, and visibility into the human interactive access to your built-in root superuser accounts. As we mentioned earlier, these accounts are intended to be used in emergency scenarios only, often referred to as “break glass” scenarios (think “in case of emergency, break glass to access”). These are not intended to be used as the day-to-day operational accounts IT Administrators need to perform their job (we’ll cover that in another article). We achieve this through foundational privileged access management controls using Idira Privileged Access Manager (Privilege Cloud or Self-Hosted).
ka3Ht0000000q6jIAA__eid=ka3Ht0000000q6j&feoid=00N2J00000APFDu&refid=0EM2J000004596y.png
Figure 1: Solution Overview Diagram

To remediate the risk associated with these credentials, we’ll want to apply a combination of privileged access management controls, which we’ll split into controls applied to the account itself, and controls applied to the user leveraging the account. For the controls applied to the account itself, we’ll implement vaulting and credential rotation for each built-in root superuser account. We’ll want to apply automatic and periodic rotation of these credentials and use both complex passwords as well as unique ones for each account. This helps address lateral movement risks by ensuring each password can only be used for a single host. Shorter rotation intervals or the use of one-time password functionality will further mitigate risk of credential exposure by shortening the password’s effective time-to-live (TTL). In the event a password goes out of sync (e.g., target system and vaulted value don’t align), the use of automatic reconciliation will ensure that we maintain constant control over that account.

We’ll apply the same controls to any SSH public/private keypairs for the root user(s). The only difference is, instead of rotating the password on the host itself, we’re essentially creating a new keypair, adding it to the authorized_keys file on the host, and deleting the old key pair. When you hear someone refer to “rotating the SSH key pair”, this is the process that they’re referring to.

You’ll find many security practitioners recommend disabling SSH access for root, but how can you implement PAM controls when you’re not allowed to SSH with the account? By using a secondary account known as a logon account, we can SSH to our host as a low-level user, and then switch user to the root account and then perform automatic password management actions. That logon account is also managed with PAM controls the same way the root account is.

To better secure the act of leveraging this account to access a system, we’ll implement credential and session isolation via a bastion host (Privileged Session Manager for SSH) to prevent the credential from reaching the users workstation (helping address the risk of credential theft), to prevent the user from knowing the password or key, and to prevent any malware that may exist on the workstation from reaching the server. IT Admins are able to continue to use their preferred SSH clients (e.g., Putty, SecureCRT, etc.) for simple, native access. With Idira controlling access to the session, we can audit and record it as well. This mitigates the risk of external malicious actors compromising the identity of the IT admin to abuse the account and the risk of malicious insiders by providing visibility, audit and recording of the administrator themselves, serving both as a deterrent for privilege abuse and a useful forensic tool. That process of using a secondary logon account and automatically switching to root applies to human interactive access as well, allowing you to effectively connect directly as root when required.

As we mentioned before, you’ll find many security experts recommend disabling SSH access for root, a common practice to mitigate the risk of brute force attacks against your root user. You won’t hear us argue about that, but just because SSH login for the root user is disabled doesn’t mean that your security controls should end there – that alone is not an effective enough control. If you can SSH to that host as a standard user ID (and are a member of the sudoers group), then you are capable of re-enabling that SSH access and even reset the root user password because that user is effectively root.

That leads us to another important point to consider, that any user account that can elevate to root privileges and potentially bypass these PAM controls to gain root privilege should also require PAM controls. You want to treat any user ID that can sudo (or su to root) on a machine the same as the root account itself. If you leave those sudoer users out of our equation, you’ve essentially nullified the effectiveness of your PAM controls for root. You need to be sure you’re either applying the same types of PAM controls listed above and let those users sudo or use an agent-based privilege control service to elevate a user to root permissions on-demand (depending on your federation and access control model), to effectively keep the system “close looped”.

Discovery
Now that we know what controls we should be applying and why, it’s time to start discovering all the *NIX root credentials and keys that exist within your organization. The first place to start is by checking your IT inventory system for all *NIX Servers – every single one will have a built-in root superuser account. This can provide us with quick and dirty insight into the population of machines we’re dealing with and potentially which lines of business or applications they’re associated with.


Next, or perhaps in place of reviewing details through an existing inventory system, it will be important to extract specific account details for each machine, including account name (if renamed), password age, password last set date, last login date, and account state. To do this we can leverage a tool like CyberArk’s Discovery and Audit (DNA) standalone application. DNA will provide output that allows us to view all that detail, which is extremely helpful in building a plan of action to remediate the local administrator accounts across your organization. For more details on how to leverage Idira DNA, check out the article Discovering Your Privileged OS Accounts with DNA. Pay special attention to the “Analyzing the Data” section where we cover *NIX Root Administrator (UID0).

Another method for discovering your *NIX root superuser accounts is using Idira PAM’s built-in Accounts Discovery feature. If you’re looking to develop a process to discover and onboard accounts simultaneously, Accounts Discovery can automatically identify new machines and based on the rules you define, onboard those accounts to your Idira PAM solution. If you’re looking to do any upfront analysis or prioritization planning, it’s recommended to use DNA first, and then begin to leverage Accounts Discovery on an ongoing basis.

Prioritization
Built-in root superuser accounts are generally considered high-priority use case, made slightly more complicated than its Windows counterpart (Administrator SID 500) due to the introduction of keys and a lack of federation. This is however one of the easier use cases to implement when we take internal politics into consideration, as the root user accounts should rarely be used directly by end users. It’s foundational security, but if all built-in root accounts really are created equal (superuser access to a single host), how do you determine the order in which you remediate these accounts? What are the methods or rationales we can use to prioritize if onboarding and securing 500, 5,000, 10,000, or 20,000+ root accounts isn’t feasible right away? The following sections will explore the more common prioritization strategies in an effort to help choose the option that’s right based on an individual organization’s circumstances and goals.


Passwords vs. Keys
While the two are closely linked, if you have to prioritize one over another due to bandwidth, it’s recommended to focus on the passwords first, and circle back to the SSH keys second. Password based access for root superuser admins is simply more straightforward, there’s a direct one-to-one relationship to an account and password. SSH keys are slightly more complicated, as they require additional analysis to determine the potential one-to-many relationship (private to public). Internal discovery can also take longer, as most organizations have their root superuser admin passwords documented somewhere (even if it’s not in a secure location), whereas private key inventory tends to be much poorer. This isn’t to say you shouldn’t prioritize the SSH keys at the same time as the passwords, but it’s something to keep in mind as you build your plan. But whatever you do, don’t forget to do it – it’s the equivalent of locking the front door (password) but leaving the backdoor (SSH key) unlocked for bad actors to enter.


Accounts with the Same Password Age
Accounts that share the same password age tend to also share the same password or public key. As we mentioned earlier, organizations historically set the same password out of convenience, but by doing so increase the “blast radius” if it’s compromised. Organizations also tend to use a batch process or script to set the passwords or public/private key pairs in bulk. If necessary, looking for accounts with the same password age can indicate instances where the same password or public key has been set across large sets of servers, and therefore indicate additional risk worthy of prioritization. As the number of servers with the same root superuser password age increases, so should the priority of securing that set of servers.


Oldest Age Passwords
Accounts that have old passwords or keys can pose significant risk due to the prolonged lack of oversight or control. As age increases, so does the chance that old IT admins, vendors, or other employees might have that password, as does the chance that someone is using that password for malicious purposes without anyone knowing it. This in and of itself isn’t the only reason for prioritization though and can sometimes involve additional complexities on legacy systems that have older passwords for a reason. However, in scenarios where there are not major technical roadblocks to securing the account as we’ve discussed in this article, we can combine this strategy with the next one to come up with a more comprehensive plan of attack.


Line of Business (LoB), Application or Data Classification
If the accounts are on servers that are owned by or associated with a particularly noteworthy, important, or risky line of business (LoB), application, or data classification tier, it may be best to incorporate these factors into the prioritization process. Applications that are either at high risk of compromise or would present a higher risk to the company and its mission should they be compromised are typically going to warrant a higher priority for the organization.


Application servers that pose significant risk are those that act as “credential repositories”. A credential repository is a term used to describe the function of the application, service or file that stores other privileged credentials to perform various functions automatically. The most common servers that perform this function are automated task servers and CI/CD pipeline servers. These types of applications require access to privileged credentials to perform a variety of IT and application tasks. The credentials are typically stored in either an authorized_keys file in the automated task scenario or stored in playbooks and manifest files in the case of CI/CD pipeline tools.

Although this information is often stored in an IT inventory system, additional research may be required if such a system either doesn’t exist or has incomplete information. Keep in mind that if a substantial amount of research is required to fully understand the server environment, as the old security adage goes, “you can’t secure what you don’t know about.” Performing this research and gaining this level of understanding about the environment will be an important aspect of building your plan to reduce risk within the organization and applies to any of the three strategies listed here.

Implementation
Step 1: Discover Accounts and Build the Plan

First and foremost, we need to discover all the built-in root superuser accounts on the organization’s *NIX servers and develop an onboarding and remediation plan per the guidance above. This can be completed with the Discovery and Audit Tool or via the Accounts Discovery feature. As part of that plan, we’ll need to determine the desired safe design and safe member structure to support an account access model. For more insight into designing safes and safe members, please review the Online Documentation and our article on Designing Access Controls for PAM. If you do not already have secondary logon accounts created, you’ll need to create a plan to create them in advance of your account onboarding.


Step 2: Install and Configure PAM
The second big step may be the most obvious, but we need to make sure that we’ve installed and configured our Privilege Cloud or Privileged Access Security solution per the Online Documentation. This will serve as the foundation for securing the local administrator credentials. This step is listed second because the discovery and analysis mentioned above can be started and even completed independently of the PAM solution being up and running.


Step 3: Define Your Security Policy
A key aspect of implementing security controls is defining what our policy governing them will be. There are two “concepts” of security policy to cover here. The first is what your organization’s actual IT security and password policy states, and the other is what settings you configure within Idira PAM, both are often referred to as “policy”. The latter is referred to as platform settings. Your organization’s security policy should be able to answer questions like, how often will our passwords and keys be rotated? How complex is our password policy? How often will we verify the credentials are accurate? Do our audit or compliance requirements mandate anything specific? If your organization has no specific security policy requirements, Idira recommends rotating root superuser admin accounts every 30 days (7 days for highly sensitive servers) using a password complexity of 30 characters (min recommendation 15) with two capital letters, two lower case letters, two numbers and two special characters. For SSH key pairs for these root superuser admins, Idira recommends using RSA key encryption with a key size of 2048. These accounts should be verified weekly and automatically reconciled to ensure they’re always accurate and functional.


Step 4: Onboard Root Superuser Admin Accounts to PAM
Once your PAM solution is up and running and you’ve identified all your root superuser admin accounts, you’ll need to create the safes according to the plan you developed in step 1. Then you can begin to onboard them, including your logon accounts. This can be completed using the Accounts Discovery feature or by using the Idira Account Onboarding Utility to bulk onboard the accounts to PAM. To onboard a singular account manually, you can use the main web portal.


Step 5: Phased Approach to Enabling Controls
In some cases, you may be able to flip on all security controls overnight with minimal impact to end-users, however that’s generally not the case and doing so successfully depends on several factors. When the overall user base is generally more resistant to change, aren’t familiar with the particular type of control being implemented and/or tend to use the accounts being secured often in their daily job routines, the chances of successfully implementing these controls overnight decreases significantly, with breach remediation being one of the few exceptions. Idira recommends taking a phased approach in order to minimize user pushback and gain higher adoption rates in scenarios where the organization feels that their users aren’t ready for the changes being implemented.


There are two types of strategies that we can employ to help ensure a successful implementation. The first is one associated with people and process, while the other is focused more on technology. For more information about the strategies related to people and process, see our Change is Hard article. The strategy focusing on technology is outlined below and is intended to reduce the user pushback often associated with implementing new security controls.

Note: As these steps are reviewed, it’s important to keep in mind that the overall goal of this exercise is to not only prove out the functionality on a technical level, but also to create internal champions that can speak with others about how easy the workflow is to work with.
  1. The first step is to ensure all necessary users have access to the accounts that are to be secured. Once specific accounts are rotated during the testing process, we don’t want users to be unfamiliar with the way in which they can get access to those accounts.
  2. The second step is to begin testing credential rotation with a small subset of accounts to validate that account passwords and keys are changing as expected, while also helping to ensure there aren’t any network or permission-related issues associated with the credential management controls.
  3. Once rotation is confirmed to be functioning correctly, enable session management (PSM for SSH) for a subset of users and accounts to test and validate that your session brokering capabilities work as expected. This can be done on the same set of accounts that were used during step 2, or they can be different accounts. This step also serves to confirm with your internal champions that the training and guidance you’ve provided is working as expected.
  4. In an ideal situation, the users who have been helping with testing have begun to see how simple this is going to be for them, which will make the final steps much easier. From here, the next step is to begin rolling out credential rotation to larger groups of accounts until all built-in admin accounts utilize a unique password.
  5. Once all accounts have been rotated, we’ll want to run a Privileged Accounts Compliance Status report to validate that these accounts have successfully changed their passwords. If any have failed, review and remediate the errors.
  6. After that, organizations should consider enforcing session isolation for all root superuser admin accounts, although this can be taken in a phased approach as well. Start by simply enabling the PSM for SSH functionality but hold off on disabling users’ ability to see the password or key itself until the users are comfortable with the concept and any issues resolved.
  7. Once users are at a reasonable acceptance level, Idira strongly recommends disabling the ability for users to view or copy the password outside of an approval process, such as submitting a dual-control request or using a ticketing system integration in order to validate a password checkout request. If users are allowed to check out the password in any scenario, Idira highly recommends enabling one-time password (OTP) functionality.
Moving Forward by Going Back to the Basics
While there are certainly many worthy security initiatives to tackle, we hope with the insight and guidance above that you feel empowered to go back to the basics to address your *NIX root superuser admins. These accounts are a fundamental element of an organization’s IT security hygiene and usually present a quick and impactful win that can provide additional defense against malicious attacks.


We recommend reviewing these links for a complete list of supported *NIX operating systems for password and SSH key management, and explore the Idira Marketplace for *UNIX integrations. Our articles on Designing Access Control for PAM and Discovering Your Privileged OS Accounts with DNA will provide you with some deeper insight on those two key aspects of securing your *NIX root superuser admin accounts. You can also find a free quick start training for Managing Linux Root Credentials with Idira PAM on the training portal.
If you’re interested in additional other foundational security articles, we suggest checking out our articles on Securing the Windows Server Local Admin (SID 500) and Securing the Windows Domain and Server Admin Access.
  • 4161 Views
  • 0 comments
  • 0 Likes
Top Liked Authors