-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default subordinate ID configuration in /etc/login.defs could lead to compromise #1157
Comments
That's one way of seeing things, but I have another one in mind. The remote server doesn't take into account that lower ID's might be used in the system and tries to use an ID that is already allocated to subordinate ID ranges. This is a gray area since there is no range of IDs assigned for centrally managed users. The issue of ID assignment was already addressed when the assignment of subordinates for centrally managed users was implemented #154 (comment) and Some projects like FreeIPA define the ID range allocation for a number that is big enough to avoid this type of collision. Unfortunately this isn't always the case, and it's up to the sysadmin to define the boundaries correctly to avoid this type of problem. By the way, this problem could happen in other cases as well, such as centrally managed user IDs being assigned to values below 1000. So there is a collision with the range of system users. This case is not theoretical, but I saw it a little over a year ago. The system administrator should try to avoid these problems by assigning values that do not collide with each other. |
Unfortunately, in larger enterprise environments (including the one I recently left which is a 170k machine RH shop) - these default subordinate ID ranges are low enough that the likeliness of collision becomes very high. For example, in that said previous environment, the first local user given a range of 100000-165535 results in collision with more than 8,000 valid ID's, giving potential for severe internal privilege escalation in what is a publicly regulated environment. I think the biggest problem here stems from two things:
I found this purely by coincidence because I already have incredibly complex and large subuid/subgid configurations in my infrastructure. I was confused about where the entries came from and initially assumed I must have done it and forgotten about it. I've spoken with a few directors from four separate multinational organizations who have confirmed their operations and engineering teams were entirely unaware of this default behaviour. Llikewise, all 4 have identified and confirmed collisions with ID's within just the first delegated range assigned to local accounts created on the system both with adduser/useradd and through the user addition at install time. I do believe that raising the starting range to somewhere in the billions would do more to reduce the likeliness of collision, but I also believe that defaulting delegation of subordinate ID's within any range is something better left to the administrators to configure and should probably not be a default configuration out of the box. |
Choosing a higher range of IDs would have meant a higher risk of collision with other suppliers. There is no perfect solution and this needs to be assessed very carefully.
This is a big problem, but there is no way to contact each of them to make sure they have understood it correctly before enabling a new feature like this.
I prefer the second option since the first one as I mentioned would probably cause collisions with other environments. CC'ing @abbra @alexey-tikhonov |
I agree with both of your sentiments.
It begs to question: what was the intended purpose of adding this default configuration? Whatever it is, I suspect the risk it introduces far outweighs whatever the benefit in doing so is. |
FTR: According to CVE-2024-56433 has been assigned. |
If you want to keep auto assignment then, imo, 2147483648…4294967294 range would be the best bet as it doesn't conflict systemd (https://systemd.io/UIDS-GIDS/) and matches what IPA does. |
One thing to keep in mind is that in Financial environments regulated by FINRA, allowing any system account or network user to arbitrarily change ID’s is a major problem. In those cases, even if you increase the default range to a high enough range that collision is unlikely, it still puts such environments at risk of running in to issues with regulators.
I believe the right answer here is to disable it by default entirely. Why is it needed? What benefit are you gaining from assigning arbitrary subordinate id delegations as a default for local users?
|
Note that pluggable subid support does not allow to use multiple subid modules, so if you are supplying subid mappings via SSSD from a centralized source (e.g. FreeIPA), the local source ( For purely local setup I believe it should also be done explicitly. However, we still cannot agree with systemd folks on a way to jointly define and manage ID ranges used for various types of objects in the ID space. Sadly, most of allocation decisions therefore are static. |
Trying to find the right place to bring this up to, as I'm not sure whether shadow-utils is shipping this out like this or if it's the distributions that have distributed it like this.
I'm seeing on Red Hat 9 and Debian 12 that login.defs is shipping with SUB_UID_* configuration resulting in /etc/subuid and /etc/subgid entries for local accounts being added to the system.
This can have unintended consequences, as it assumes the systems are running in an environment where there would be no ID's on the network that fall within the ranges handed out by this configuration.
The issue is that the subordinate ID's can easily become the effective UID/GID of the account they're assigned to. For example, my local account had an entirely unexpected subordinate ID range assigned to it which happens to overlap with a user ID on my network. With minimal effort I'm able to become that ID and write to the users NFS home directory.
The text was updated successfully, but these errors were encountered: