Skip to content

Default subordinate ID configuration in /etc/login.defs could lead to compromise #1157

Open

Description

@JonnyWhatshisface

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.

jon@localhost ~]$ id;uname -a;cat /etc/subuid
uid=1000(jon) gid=1000(jon) groups=1000(jon),10(wheel)
Linux localhost.localdomain 5.14.0-503.14.1.el9_5.aarch64 #1 SMP PREEMPT_DYNAMIC Fri Nov 15 07:14:03 EST 2024 aarch64 aarch64 aarch64 GNU/Linux
jon:100000:65536
[jon@localhost ~]$ getent passwd msteph
msteph:x:108472:108472::/mnt/home/msteph:/bin/bash
[jon@localhost ~]$ ls -al subdo;getcap subdo
-rwxr-xr-x 1 jon jon 72936 Dec 22 23:12 subdo
[jon@localhost ~]$ ./subdo -u 108472 -g 108472 -r 1 bash
bash: /home/jon/.bashrc: Permission denied
bash-5.1$ id
uid=108472(msteph) gid=108472(msteph) groups=108472(msteph),65534(nobody)
bash-5.1$ cd ~msteph
bash-5.1$ ls
bash-5.1$ ls -al
total 16
drwx------ 3 msteph nobody 99 Dec 22 23:19 .
drwxr-xr-x. 8 nobody nobody 85 Dec 22 23:18 ..
-rw------- 1 msteph msteph 20 Dec 22 23:19 .bash_history
-rw-r--r-- 1 msteph nobody 18 Apr 30 2024 .bash_logout
-rw-r--r-- 1 msteph nobody 141 Apr 30 2024 .bash_profile
-rw-r--r-- 1 msteph nobody 492 Apr 30 2024 .bashrc
drwxr-xr-x 4 msteph nobody 39 Dec 20 09:10 .mozilla
bash-5.1$ touch testing123
bash-5.1$ ls -aal
total 16
drwx------ 3 msteph nobody 117 Dec 22 23:23 .
drwxr-xr-x. 8 nobody nobody 85 Dec 22 23:18 ..
-rw------- 1 msteph msteph 20 Dec 22 23:19 .bash_history
-rw-r--r-- 1 msteph nobody 18 Apr 30 2024 .bash_logout
-rw-r--r-- 1 msteph nobody 141 Apr 30 2024 .bash_profile
-rw-r--r-- 1 msteph nobody 492 Apr 30 2024 .bashrc
drwxr-xr-x 4 msteph nobody 39 Dec 20 09:10 .mozilla
-rw-r--r-- 1 msteph msteph 0 Dec 22 23:23 testing123
bash-5.1$

Activity

  1. ikerexxe commented on Dec 23, 2024

    @ikerexxe
    Collaborator

    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.

    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
    #154 (comment) to name a few.

    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.

  2. JonnyWhatshisface commented on Dec 23, 2024

    @JonnyWhatshisface
    Author

    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:

    1. The default range chosen is low enough that it increases the likeliness of collision. Even in my own personal network I've run in to a collision as demonstrated above.

    2. Most system administrators are entirely unaware of this configuration and thus may be unaware of the risk lying quietly in their infrastructure

    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.

  3. ikerexxe commented on Dec 24, 2024

    @ikerexxe
    Collaborator
    1. The default range chosen is low enough that it increases the likeliness of collision. Even in my own personal network I've run in to a collision as demonstrated above.
    

    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.

    2. Most system administrators are entirely unaware of this configuration and thus may be unaware of the risk lying quietly in their infrastructure
    

    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 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.

    I prefer the second option since the first one as I mentioned would probably cause collisions with other environments.

    CC'ing @abbra @alexey-tikhonov

  4. JonnyWhatshisface commented on Dec 27, 2024

    @JonnyWhatshisface
    Author

    I agree with both of your sentiments.

    • A documentation update would not be sufficient alone because there is high a probability that many people may not even understand what the subordinate ID's are or how they work. This is especially true in large environments where SOD becomes a factor. (speaking from experience)

    • No range you set will guarantee not risking collisions. Thus, this "feature" is something that should only be enabled explicitly by the administrators who wish to use it. For regulated environments, this can create a major PCI and SOX problem.

    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.

  5. carnil commented on Dec 27, 2024

    @carnil

    FTR: According to CVE-2024-56433 has been assigned.

  6. alexey-tikhonov commented on Dec 27, 2024

    @alexey-tikhonov
    Contributor

    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.

    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.

  7. JonnyWhatshisface commented on Dec 27, 2024

    @JonnyWhatshisface
    Author
  8. abbra commented on Jan 11, 2025

    @abbra

    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 (/etc/subuid and /etc/subgid) would not be used at all.
    In FreeIPA we do not allocate subids to users by default, it has to be an explicit action done centrally first.

    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.

  9. AdamWill commented on Jul 23, 2025

    @AdamWill
    Contributor

    It begs to question: what was the intended purpose of adding this default configuration?

    To answer that: the purpose is to make rootless podman work out of the box. "Fixing" this has broken that, which is a significant regression for people who want to use podman out of the box on systems on networks which don't have 170,000 users, which is surely a comfortable majority. See https://bugzilla.redhat.com/show_bug.cgi?id=2334165#c2

  10. JonnyWhatshisface commented on Jul 24, 2025

    @JonnyWhatshisface
    Author

    It begs to question: what was the intended purpose of adding this default configuration?

    To answer that: the purpose is to make rootless podman work out of the box. "Fixing" this has broken that, which is a significant regression for people who want to use podman out of the box on systems on networks which don't have 170,000 users, which is surely a comfortable majority. See https://bugzilla.redhat.com/show_bug.cgi?id=2334165#c2

    Having this introduces a security issue that, in my opinion, is largely understated. It's not just NFS at risk when network ID's are overlapped, it's the ability to hijack KRB5 tickets and assume the identity of the user on the entire network for all kerberized services. Larger international infrastructures, particularly financial institutions, heavily rely on kerberos for service protection and it's a regulatory matter. When you assume you can create blocks of 65k users, and the organisational administrators are unaware, you create a risk that can have real financial impact and security risks for those organizations.

    On a test sweep when I first found this, it was confirmed that more than 30k network UID's and GID's are impacted within the first local users range alone. Some of those ID's had access to MNPI and PII information on network services. The kerberos tickets in that environment are stored in a local ticket cache, thus simply by using the POC code that was crafted purely in Python with no real dependencies, I was able to hijack the kerberos tickets and prance around the network as those users accessing those services.

    Ease of use of Podman should not come with an unknown risk of overlapping ID's on peoples networks, and pointing the finger at 30+ year old infrastructures and claiming they should mitigate it by ensuring ID's do not fall in those ranges, when they have literally hundreds of thousands of network ID's and have had them for the better portion of 20+ years, should not be the default reaction.

    The CVE published for this mistakenly identifies NFS as the only potential risk factor, and the dispute reason actually was so bold as to say the network admins should make sure their ID's do not conflict with the default ranges that were added in to here without those admins being aware.

    I'm not trying to come off as aggressive, but this was really a very poor decision with silly reasons given this ended up on systems that do not even have Podman installed on them.

    If the admins wish to configure their systems to use rootless Podman, it should be left to their discretion to do so. And for those systems on networks that don't have 170,000 users that you pointed out, they aren't paying the higher price tag of the networks that do, so compromising their security and awareness for the sake of the smaller peoples "ease of use," versus simply having their admins configure the ranges they want to have for the users they want to have them, seems like a silly and non-sensical argument. Assuming ANY ID is safe to use for delegation with the admins awareness creates a risk, period. The proposal on the Bugzilla that likely led you here is to scan to check for conflicting ranges, but that's only valid at the time of the scan and doesn't resolve the fact that admins may later create network ID's that overlap while they have absolutely zero clue that these delegations were done to local accounts on their systems.

    Lastly, in FINRA environments in particular, allowing people to arbitrarily change their current ID even to non-existent ID's on the system is a major no no. On that note, why not just give them a random shared guest account with no password? This subordinate ID/GID delegation is not just for containers. It's a delegation to become that ID basically. The CVE GitHub with the POC shows the relative ease at which a user can simply enter a namespace and become any ID in the delegated range on the system. Feel free to play with it yourself: https://github.com/JonnyWhatshisface/CVE-2024-56433

    Thinking it's okay for this configuration in any environment, let alone enterprise environments, solely for the sake of simplifying your desires to ease the use of "rootless" containerization (which requires root to configure the ability to do so FOR A GOOD REASON) demonstrates incredibly poor awareness of security standards.

  11. debarshiray commented on Jul 24, 2025

    @debarshiray

    Could the problem here be restated as, machines that are part of an enterprise network and get their group and user IDs from a centralized source don't always have subid: sss in /etc/nsswitch.conf?

    It seems to me that mixing locally and centrally managed IDs is always a bad idea. So, if GNU Name Service Switch (or NSS) is already configured through /etc/nsswitch.conf to pick up the group and user IDs from a central source, then isn't it reasonable to expect the same for the subordinate IDs?

    I am saying this, because if subid: sss is used in /etc/nsswitch.conf, then the /etc/subgid and /etc/subuid files are ignored.

    I wonder if there is a way to loudly complain if locally and centrally managed IDs are being mixed, and if that will address this problem?

    @abbra already mentioned this briefly in his earlier comment.

  12. JonnyWhatshisface commented on Jul 25, 2025

    @JonnyWhatshisface
    Author

    I applaud the thought going behind how to simplify and ease the use of rootless containers, but I reiterate my point above: You should not be delegating any users the rights to become another ephemeral user ID / GID on a system without the administrators awareness.

    Even without the network ID collision concern, you are granting users the rights to arbitrarily change their UID/GID to non-existent ID's on the system that an administrator will most certainly be unaware of, as was the case in this instance. That is, by all means, against every philosophy of security with regards to users on a Unix system.

    If people want to use rootless containers, they need to learn to explicitly define the subordinate ID's and groups they want to delegate to which users as has always been the case - way LONG before Podman with containerization, period.

    That said, the ability to default users to have delegated ID ranges for namespace creation is not a useless ability, but it does not belong being a default ability. It especially does not belong being a default ability on systems that do not even have Podman. Doing it here in shadow-utils resulted in my Debian box that did not even have Podman on it having subordinate ID's delegated to locally provisioned service accounts which was entirely unexpected.

    In short: you should not mess around with identity management for the sake of simplifying containers for a small subset of users who want this behaviour while the rest of the world did not ask for it. The functionality to assign delegated ID's to default local users is still in shadow-utils, but it should not be enabled by default on the worlds systems in any distribution at all.

  13. debarshiray commented on Jul 25, 2025

    @debarshiray

    I applaud the thought going behind how to simplify and ease the use of rootless containers

    I don't hear the applause because you seem to have side-stepped the relatively concrete points in my comment. Some of us have to actually balance the trade-offs and engineer a solution that actually works without walking away in the name of security and throwing vast swathes of users under the bus. :/

    but I reiterate my point above: You should not be delegating any users the rights to become another ephemeral user ID / GID on a system without the administrators awareness.

    Even without the network ID collision concern

    Is there a concrete security issue without centrally managed IDs over a network (ie., NFS, LDAP, Kerberos, Active Directory, etc.) ?

    you are granting users the rights to arbitrarily change their UID/GID to non-existent ID's on the system that an administrator will most certainly be unaware of, as was the case in this instance.

    By this instance you mean your examples above involving NFS and Kerberos? Or did I miss an example exploit with only locally managed IDs?

    That is, by all means, against every philosophy of security with regards to users on a Unix system.

    If people want to use rootless containers, they need to learn to explicitly define the subordinate ID's and groups they want to delegate to which users as has always been the case - way LONG before Podman with containerization, period.

    Rootless Podman containers is what made them widely useful. So, we can't just hand-wave away that use-case and go back to how things used to be.

    That said, the ability to default users to have delegated ID ranges for namespace creation is not a useless ability, but it does not belong being a default ability. It especially does not belong being a default ability on systems that do not even have Podman. Doing it here in shadow-utils resulted in my Debian box that did not even have Podman on it

    I can't speak for Debian, but many of the Fedora editions (CoreOS, Silverblue/Workstation, etc.) have Podman by default and rely on rootless Podman working out-of-the-box.

    having subordinate ID's delegated to locally provisioned service accounts which was entirely unexpected.

    I understand your surprise. I am trying to understand if there's an exploit with locally managed IDs.

    In short: you should not mess around with identity management for the sake of simplifying containers for a small subset of users who want this behaviour while the rest of the world did not ask for it.

    I can assure you that containers aren't for a small subset of users anymore. :)

    The functionality to assign delegated ID's to default local users is still in shadow-utils, but it should not be enabled by default on the worlds systems in any distribution at all.

    I wouldn't emphasize any because there are some distributions that only exist to serve containers. :)

  14. AdamWill commented on Jul 26, 2025

    @AdamWill
    Contributor

    note systemd 258 has something relevant here: https://mastodon.social/@pid_eins/114573005995694680 . not sure if podman folks have taken a look at that yet.

  15. JonnyWhatshisface commented on Jul 26, 2025

    @JonnyWhatshisface
    Author

    I don't hear the applause because you seem to have side-stepped the relatively concrete points in my comment. Some of us have to actually balance the trade-offs and engineer a solution that actually works without walking away in the name of security and throwing vast swathes of users under the bus. :/

    It's you who are side-stepping the reality of the situation by playing the semantics game and ignoring the bluntly obvious points.

    Leave it to the administrators to delegate the ID ranges they wish to use for their containers. Be it via subuid/subgid configuration or via identity management handled through NSS, it is THEIR place to decide and choose what ID ranges are okay to be used.

    That, or, have some major system (ie systemd) that is part of every distribution reserve a set of ranges that is documented and well-known - and does not conflict with any current organizations ID ranges by default, and is configurable to be changed - reserve such a range.

    However, that still doesn't resolve the next part.

    Even without the network ID collision concern

    Correct. Even without the context of network ID collusion, you still have absolutely no business delegating the right of local users on peoples systems to arbitrarily change their assigned UID and GID range based on the assumption that it's okay to do so because they just might maybe one day want to run Podman.

    For that matter, we might as well go ahead and file a PR to sudo to default every single user on the system the right to execute whatever they want as "nobody."

    The functionality needs to be enabled intentionally by people who wish to use it, not blindly crammed in for folks who don't even know it's there.

    Is there a concrete security issue without centrally managed IDs over a network (ie., NFS, LDAP, Kerberos, Active Directory, etc.) ?

    Redundant and silly question. See above.

    Rootless Podman containers is what made them widely useful. So, we can't just hand-wave away that use-case and go back to how things used to be.

    You're right - we can't expect administrators to be bothered with the simple things like configuring systems for intended use-cases.

    Maybe e should go ahead and go back to the days of a default password without a warning prompt on sql's sa user. Maybe a default root password while we're at it, just incase the user forgets or can't be bothered to set one? While we're at it, weshould go ahead and petition to have a guest/guest account on every Linux install out of the box, too.

    What you're basically trying to say is that there's no problem with just giving every single local user unrestricted and unfettered access to randomly change their assigned UID/GID to entirely unexpected and potentially even unknown-to-even-exist ID's.

    I can't speak for Debian, but many of the Fedora editions (CoreOS, Silverblue/Workstation, etc.) have Podman by default and rely on rootless Podman working out-of-the-box.

    Thanks for what I am sure is a completely unbiased list of distributions with absolutely no potential conflict of interest or close involvement with this - nor key to your agenda and personal objectives.

    Recommendation: Put this back in to the login.defs on the distributions you've mentioned directly. Then they, too, can get their very own CVE's.

    I can assure you that containers aren't for a small subset of users anymore. :)

    If this is your attempt to paraphrase or summarize what I said, then I'm afraid you've misunderstood. I'm far more aware of their uses than you give me credit for, particularly in environments of quite literally hundreds of thousands of users and machines - which is how and why we are in this discussion right now.

    I wouldn't emphasize any because there are some distributions that only exist to serve containers. :)

    See all of the above.

    Let the users configure the system for their intended use-case instead of exposing RH to the risk of being sued for creating security issues through what would, after all this argument, undoubtedly be seen as pure negligence should it result in any kind of impact to a large enough customer.

    If it's solutions you're looking for, here's one: Add a configuration for login.defs to the Podman RPM and let that be the culprit of giving the ID's to the user. Though, I suspect they likely won't want the CVE (a regression one, at that) put on them.


    A lot of this can be avoided and still accomplished with the simplest of concepts: AWARENESS.

    Give the configuration ability and decision to the users to enable this kind of functionality. Educate them on how and where. Choose a default range if you want and DOCUMENT it clearly in the documentation, but disable it by default and allow users to choose to enable it. Leverage things like environment variables during the RPM install in order to configure it if chosen by the admins. But don't default it across Linux distributions where the users may otherwise not even use Podman.

  16. alexey-tikhonov commented on Jul 29, 2025

    @alexey-tikhonov
    Contributor

    @hallyn, @alejandro-colomar, what is your stance on this?

  17. alejandro-colomar commented on Jul 29, 2025

    @alejandro-colomar
    Collaborator

    I think I morally agree with the OP (@JonnyWhatshisface) .

    Maybe when you apt-get install podman, the installation scripts could add the necessary configuration, without having it by default on every system that doesn't need or want it.

  18. AdamWill commented on Jul 29, 2025

    @AdamWill
    Contributor

    That creates an ordering problem between 'installing podman' and 'creating user accounts', though.

  19. hallyn commented on Jul 30, 2025

    @hallyn
    Member

    I think @debarshiray is spot on.

    And it's up to a distro to configure as appropriate for its expected users. If the distro is intended as an easy on-ramp for using or experimenting with unprivileged containers, then default subids make sense.

  20. carnil commented on Jun 14, 2026

    @carnil

    With the question from Chris Hofstaedtler in https://bugs.debian.org/1103832#40 is anything planned here from upstream point of view, or will just a documentation update be helpful?

  21. alejandro-colomar commented on Jun 14, 2026

    @alejandro-colomar
    Collaborator

    With the question from Chris Hofstaedtler in https://bugs.debian.org/1103832#40 is anything planned here from upstream point of view, or will just a documentation update be helpful?

    Cc: @ikerexxe , @hallyn

  22. hallyn commented on Jun 18, 2026

    @hallyn
    Member

    We are not going to change anything about the defaults. That's too context dependent to be generalizable. Distributions and sites should be better aware of their situation and able to do override our defaults.

    But I'm happy to collaborate on some good documentation.

    As I asked elsewhere earlier this week, is there a better place than the subuid(5) and login.defs(5) manpages?

    I do think we can also provide more flexible behaviors (than just a
    SUB_UID_MIN and SUB_UID_MAX, for instance).

  23. ikerexxe commented on Jun 18, 2026

    @ikerexxe
    Collaborator

    The reality is that ID allocation is highly context-dependent, and there is no 'one-size-fits-all' range that will safely avoid collisions across every possible deployment scenario.

    Shifting the burden of this configuration to the distributions and local system administrators is the only approach that respects the diversity of existing environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions