PAM Automation Scripts: Don’t Forget to Secure Admin Credentials

June 16, 2023 Jed Knopf and Sharon Abarbanel

Securing PAM Automation

While IT executives understand the essential role privileged access management (PAM) solutions play in their organization’s overall security strategy, they’ve also continued to ask their PAM administrators to do more with less resources. To meet these additional asks, PAM admins have automated routine PAM tasks using scripts. PAM automation scripts can significantly lessen the burden on PAM admins and enable organizations to scale PAM usage across their entire enterprise. But securing PAM automation scripts and the admin credentials they hold is paramount.

After all, a hard-coded credential in a PowerShell script gave cyberattackers the foothold they needed to access Uber’s PAM solution and elevate their privileges to devastating effect in the 2022 breach. While automation scripts are often simple, they can hold the keys to other high-value resources within the company – including root credentials, cloud access keys and every credential in between from infrastructure orchestrators, admin credentials, service accounts and other configuration management tools. If those keys aren’t secured, attackers can easily use the unsecured credential in these scripts to find a way into an organization’s most sensitive areas.

Why Are PAM Automation Scripts So Powerful?

A PAM admin’s daily responsibilities typically revolve around the lifecycles of privileged users in their organization and require high levels of privilege. For example, when a privileged user joins the organization, the PAM admin has to add them to the right safes and grant them the necessary permissions they need to perform their privileged tasks. If a user leaves an organization, all that access has to be revoked to ensure the organization remains secure.

These processes typically involve multiple steps, all of which take time for the admin. Consider just one example of a new employee joining the organization. Of course, there are various approaches, but in this example, the PAM admin must:

  • Map that employee to an Active Directory (AD) group, giving them access to the software tools that they need for their job.
  • Map the employee to a group that grants them the right level of access to all of the safes that have the credentials necessary to work in those software tools. (Another approach is to map the employee to each individual safe they need access to, but you can see how that could quickly get overwhelming.)

This gets even more complex when you consider named accounts. For a named account, a personal safe is created for that new employee. Then the admin has to assign the proper permissions and add that new employee’s account to that personal safe, then put proper rotation policies around that.

And this is just the basics. As organizations scale, their PAM usage grows with them. They may have to onboard or offboard a large number of users at one time, particularly in the following situations:

  • Mergers and acquisitions, when employees are added by the hundreds (and sometimes thousands).
  • Large joiner/leaver events, including large-scale layoffs, which create a significant overhead from a compliance perspective.
  • Implementation of a PAM solution, including expanding users from just domain and local admins to groups like networking and cloud.

Admins need very high levels of privilege to complete these tasks. But do admins really want to do these repetitive tasks manually? And what’s the potential for errors with all of these manual steps? At some point, the growth reaches a point where automation isn’t just a nice-to-have – it’s essential for security teams who don’t have the resources to dedicate to all the mundane, day-to-day tasks required. You especially need this type of efficiency as you move beyond securing the human element and bring in all the machine identities that need to be secured – including virtual machines (VMs), service accounts in the cloud and robotic process automation (RPA) bots.

Security Risks for PAM Automation

Automation helps remove the risk of human error and saves PAM admins both time and budget that they can spend on other tasks. But while these scripts themselves may be small and simple, performing only minor tasks, they can expose critical systems to attackers. Hard-coded credentials in scripts can easily be stolen by attackers who gain access to the scripts (i.e., through a compromised network share, as happened in the Uber breach) and leveraged elsewhere. Scripts can also be easily copied, replicated and shared, with any hard-coded credentials shared along with them. Additionally, someone could potentially post a copy to a repository, exposing those credentials.

The danger increases as many of these scripts have high levels of privileged access and can thus cause a large amount of damage if unsecured credentials fall into attackers’ hands.

Best Practices for Securing PAM Automation

Here are some steps you can take to ensure that your PAM automation processes are secure:

  • Secure credentials used in scripts. No matter how inconsequential a script might seem, the value to the attacker is in the power of the embedded privileged credential(s). The script can be used as a jumping-off point for attackers if the right credential is embedded inside. Ensure that the credentials used in your automation scripts are vaulted and delivered at the time they are needed, not hard coded into the script.
  • Regularly rotate credentials. Establish policies to regularly rotate credentials. That way, even if there are hard-coded credentials in automation scripts, they quickly become invalid.
  • Automate credential management. Reduce the risk of human error by moving to an automated, on-demand process. Instead of having to manually manage credentials and add/remove users, you can have event-driven activities that are tied to your joiner/mover/leaver processes, including automated requests for approval.
  • Gain visibility. Ensure that you have oversight into what these automation scripts are doing – what resources they have access to, when they’re accessing and what they’re doing once they access the PAM solution. This is especially important for automation scripts that perform highly privileged activities like creating a new safe. Knowing exactly what these scripts are doing across your organization (and who is running them) can help you flag any risky activity and revoke access if needed.
  • Enforce least privilege. Don’t let these scripts have more access than they need. Follow the principle of least privilege so that these scripts have only the necessary privileges to perform their tasks, nothing more.
  • Practice defense in depth. Use the principles of Zero Trust and enact multiple layers of defense. Something like forced human approval with multi-factor authentication (MFA) can provide another hurdle for attackers who may have gained access to one of your automation scripts.

Identity Security for Automation

Naturally, PAM admins spend most of their time working within PAM solutions. Yet they don’t work in a vacuum, and as user workflows (as well as their own) become increasingly automated, PAM admins need additional functions and features to do their jobs. But if more tools mean more work, it defeats automation’s whole purpose.

This is just one reason why organizations are working to consolidate their identity security tools, bringing lifecycle management, identity automation and orchestration and centralized secrets management together in one comprehensive platform.

With this approach, PAM admins can access a host of built-in features that enable a trifecta of secure, automated and simplified functions – from automatically managing the credential lifecycle with REST APIs, to rotating privileged admin credentials used in script, to onboarding users.

Seamless integration with other tools across the organization’s broader security stack helps teams make smarter, faster decisions. For instance, when a third-party tool detects an event of a specific level of severity, it can automatically trigger the identity security platform to take specific corrective action.

But above all else please ensure that the credentials used in your organization’s PAM automation scripts are secured. After all, they contain the privileged credentials used to assign privileged access to other users and thus an attacker’s dream.

Learn more about how CyberArk Conjur Cloud and CyberArk Identity Flows help you automate PAM functions and secure the PAM admin credentials used by automation scripts.

Jed Knopf is a CyberArk Solutions Architect, as well as a former PAM admin. Sharon Abarbanel is a Manager, Product Management, CyberArk Secrets Manager.


Previous Article
Securing the Web Browser in an Identity-focused Threat Landscape
Securing the Web Browser in an Identity-focused Threat Landscape

For more than 30 years, we’ve been living in a world where one of the most widely-used applications is the ...

Next Article
Top Six Identity Security Risks Compounding Cyber Debt and Expanding the Attack Surface
Top Six Identity Security Risks Compounding Cyber Debt and Expanding the Attack Surface

The prolonged period of low-capital costs and widely available funding may be over, yet digital adoption pe...