-
Notifications
You must be signed in to change notification settings - Fork 120
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
BLOG: No New Privileges support in docker #269
Comments
Just to be clear, this is in upstream Docker, not just in our fork/patches? |
@jberkus Yes, this is in upstream Docker. We added support for it in OCI, runc and docker. |
cool! So we have quite a few submissions this week, OK if this post comes on on Wednesday or Thursday? |
@jberkus Yes lets space these releases out over time. Better to be active versus too active. |
Moved to PR #272. Closing. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We recently add support for no_new_priv to docker.
It was also earlier added to runc and the Open Container Initiative
spec.
This security feature was added to the Linux kernel back in 2012. A process can set the no_new_priv bit
in the kernel that persists across fork, clone and execve. The no_new_priv bit ensures that the process or its
children processes do not gain any additional privileges. A process isn't allowed to unset the no_new_priv bit
once it is set. Process with no_new_privs are not allows to change uid/gid or gain any other capabilities. Even
if the process executes setuid binaries or executables with file capability bits set. no_new_priv also, prevents LSMs like SELinux from transitioning to process labels that have access not allowed to the current process. This means an SELinux process is only allowed to transition to a process type with less privileges.
For more details see kernel documentation
Here is an example showcasing how it helps in docker:
Create a setuid binary that displays the effective uid
Now we will add the binary to a docker image
Now we will create and run a container without no-new-privileges.
This shows that even though you requested a non privileged user (UID=1000) to run your container,
that user would be able to become root by executing the setuid app on the container image.
Running with no-new-privileges prevents the uid transition while running a setuid binary
As you can see above the container process is still running as UID=1000, meaning that even if the
image has dangerous code in it, we can stil prevent the user from escalating privs.
If you want to allow users to run images as a non privilege UID, in most cases you would want to
prevent them from becoming root. no_new_privileges is a great tool for guaranteeing this.
The text was updated successfully, but these errors were encountered: