Attacking FreeIPA — Part IV: CVE-2020–10747

Attacking FreeIPA — Part IV: CVE-2020–10747

This post is the final part in a series about my experiences attacking FreeIPA. In Part I of this series, we reviewed some of the background and underlying technologies utilized by FreeIPA. We also discussed several authentication mechanisms, and forms of credential material, specifically how to identify, parse, and re-use credentials as an attacker. In Part II of this series we discussed the various different types of objects inside of a FreeIPA environment, and a little bit about their significance, as well as how these objects can be enumerated to obtain situational awareness. In Part III of this series we conducted lateral movement inside of a FreeIPA environment to accomplish two red team objectives.

If you haven’t read the first three parts of the series you can find them here:

Introduction

During an assessment of a cloud environment managed through FreeIPA our team was able to uncover a vulnerability in how FreeIPA integrates with existing technologies. This vulnerability allowed for our team to escalate to the “root” account and obtain UID 0. It also allowed us to bypass all existing HBAC rulesets and conduct lateral movement throughout the environment. This vulnerability was reported to RedHat through there vulnerability disclosure program and CVE 2020–10747 was assigned.

Vulnerability Overview

To explain this vulnerability I have created a small lab environment replicating the assessment environment as closely as possible. Inside our lab we have recently compromised an account with some permissions inside the environment, but lack the cleartext credentials needed to utilize sudo and escalate to root.

Specifically compromised account had access to the “User Administrators” privilege.

Permissions of the User Administrators privilege

With this privilege comes a lot of different power to affect users inside the environment. Using this privilege we can make a new user inside the FreeIPA domain named root.

Creating a user named root

Once the user is created in the domain we can obtain a ticket for the account with kinit.

Obtaining a ticket for [email protected]

Now we can attempt to SSH using our newly created root domain account.

SSH utilizing the root domain account

As shown this drops the user into the local root account! So simply by creating a domain user for a local user we were able to authenticate using the [email protected] account and obtain the user context of the local root account.

But how does this account behave when an HBAC rule prevent access to a host. To test this theory let’s make another account named lowpriv and compare the two accounts privileges. Then we will attempt lateral movement with both accounts.

Making a lowpriv account

Now let’s compare [email protected] and [email protected].

Both accounts are not a member of any HBAC Rules or privileged groups

Now that we confirmed neither account is a member of any HBAC rules, or privileged groups let’s attempt to laterally move with each account.

Authentication Fails with [email protected]Authentication both succeeds and returns a root shell

Conclusion

This post is the culmination of my FreeIPA series. Hopefully this series has provided some value to red teamers, offensive engineers, penetration testers and blue teamers, detection engineers, system administrators. Understanding the core functionality, how it can be abused, and what the implications of the configuration decisions that we make, is critical in designing secure systems.

I also wanted to thank RedHat for making the disclosure process clean and efficient. They were timely and very professional in all of our communication and that cannot be understated. I encourage anyone reading this series to create their own lab environments and conduct more research. The more we can identify and disclose through the proper channels; the more positive change we can affect in the security posture of tools and technologies that are used every day!

DISCLOSURE TIMELINE

As committed as SpecterOps is to transparency, we acknowledge the speed at which attackers adopt new offensive techniques once they are made public. This is why prior to publicization of a new bug or offensive technique, we regularly inform the respective vendor of the issue, supply ample time to mitigate the issue, and notify select, trusted vendors in order to ensure that detections can be delivered to their customers as quickly as possible.

  • March 3rd, 2020: Initial Disclosure.
  • March 3rd, 2020: RedHat security team acknowledged the disclosure and began the process to validate the vulnerability.
  • March 18th, 2020: Update requested to confirm validation of the vulnerability.
  • March 18th, 2020: RedHat confirms that they are still investigating the vulnerability and will report back when they have completed the validation.
  • April 1st, 2020: RedHat validates the vulnerability, and start investigating solutions to the problem.
  • May 5th, 2020: Update requested to see the progress the RedHat team is making on a potential fix.
  • May 6th, 2020: RedHat responds that the issue is more difficult to remedy then expected. The SSH team does not consider this as a bug, but an expected feature, and there are ongoing discussions about the best way to solve the problem.
  • May 22nd, 2020: RedHat reports CVE-2020–10747 has been assigned to a flaw
  • May 26th, 2020: Disembargo date of June 15th, 2020 is agreed upon

Attacking FreeIPA — Part IV: CVE-2020–10747 was originally published in Posts By SpecterOps Team Members on Medium, where people are continuing the conversation by highlighting and responding to this story.

Article Link: https://posts.specterops.io/attacking-freeipa-part-iv-cve-2020-10747-7c373a1bf66b?source=rss----f05f8696e3cc---4