Kernel News

Closing Security Holes in User Namespaces

Serge E. Hallyn posted a patch to add some cool magic to file capabilities in namespaces. Linux uses namespaces to corral resources into virtual systems, essentially allowing multiple whole Linux operating systems to run on top of a single host. The problem was that a hostile user could create their own namespace, assign themselves the identity of a root user, and then use their higher privilege level to change the extended attributes (xattrs) of a file to give improper access to regular users.

With Serge's patch, whenever the root user of a given namespace attempted to alter security xattrs, the kernel would sneak past the root identity and rely on the credentials of the original user instead. If the original user lacked the necessary credentials, the kernel would use an alternative security xattr that would allow the process to complete its work, without actually giving the targeted files any security holes.

Mimi Zohar liked the whole sneaky process, especially the part where userspace didn't need to keep track of whether it was in or out of a namespace. That's one of the holy grails of virtualization – to make the virtual system seem identical to a standard instance of Linux running directly on its own hardware. But, because of various complex security considerations, it's very difficult to provide absolutely every feature of regular Linux in a virtualized environment. Serge's patch was an attempt to address one instance of that type of issue.

Meanwhile, Eric W. Biederman had some criticisms of Serge's whole concept. He didn't like that Serge's code would allow an equivalent, though less dangerous, xattr to be written instead of the more dangerous one desired by the hostile attacker. He felt that these two xattrs were essentially identical but ran the risk of getting out of sync. Eric preferred to just allow the user to write the xattr, but record the fact that it was the user doing it and not root. This way, he said, the security would not be compromised.

Mimi asked if Eric's suggestion would allow multiple instances of the same xattr, and Serge explained, "No, but we don't actually want that anyway. The current behavior for security capability is that it works in all user namespaces. So, we want to continue the behavior that if root in the init_user_ns sets a capability, that [it] works in all namespaces. Allowing other namespaces to set the capability would only be confusing."

Zack Brown

The Linux kernel mailing list comprises the core of Linux development activities. Traffic volumes are immense, often reaching 10,000 messages in a week, and keeping up to date with the entire scope of development is a virtually impossible task for one person. One of the few brave souls to take on this task is Zack Brown.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Reiserfs Experiencing Turbulent Updates

    When Jeff Mahoney sent in a bunch of patches for reiserfs, he assumed that the filesystem would be frozen in maintenance mode from that point on. Things turned out differently.

  • Kernel News

    Chronicler Zack Brown reports on the latest news, views, dilemmas, and developments within the Linux kernel community.

  • Kernel News

    Chronicler Zack Brown reports on the latest news, views, dilemmas, and developments within the Linux kernel community.

  • Kernel News

    Chronicler Zack Brown reports on the latest news, views, dilemmas, and developments within the Linux kernel community.

  • Kernel News

    Chronicler Zack Brown reports on the latest news, views, dilemmas, and developments within the Linux kernel community.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News