oss-sec mailing list archives
Re: Article: State of Sandboxing in Linux
From: Mickaël Salaün <mic () digikod net>
Date: Sun, 24 Nov 2024 12:52:32 +0100
On Mon, May 20, 2024 at 09:42:38AM +0000, Ali Polatel wrote:
Hello list, I want to share an article I wrote on Linux Sandboxing: https://git.sr.ht/~alip/syd/tree/main/item/doc/toctou-or-gtfo.md
Nice article! I somehow miss this email...
There's nothing new in there except something I discovered on Landlock which may be a bug or a feature. TL;DR Landlock allows you to chdir into a directory that's not allowlisted. That's it though, you can not list/read anything in there so I'd not say this is anything more than a potential info leak (as in you discovered the dir existed). That said, I am not quite sure. Very small PoC for those who do no want to read the article: (-plib turns all seccomp sandboxing off so we apply a very simple landlock sandbox only allowing /usr, busybox is static linked) ⇒ syd -plib -msandbox/lock:on -m allow/lock/read+/lib -m allow/lock/read+/usr busybox sh ~/src/syd/syd-3 $ cd /tmp /tmp $ busybox ls ls: can't open '.': Permission denied /tmp $ I could enter /tmp although that's not allowlisted by Landlock.
This is neither a bug nor a feature, but a current limitation highlighted in the documentation: https://docs.kernel.org/userspace-api/landlock.html#filesystem-flags This limitation is due to the current path-based LSM hooks (e.g. also used by AppArmor and Tomoyo), but we plan to address that: https://github.com/landlock-lsm/linux/issues/9 Sandboxer tools using Landlock may mislead users to think this kind of access may be denied but if we take a look at the Landlock filesystem access rights, none of them control path walk. It should be noted that Landlock still provides the required access rights to protect users' data. Only access to metadata cannot be controlled yet. Thanks to incremental development, Landlock is gaining more and more features with new kernel versions: https://docs.kernel.org/userspace-api/landlock.html#previous-limitations You can find more information about Landlock's development in the related article: https://landlock.io/talks/2024-06-06_landlock-article.pdf
Best regards, Ali Polatel PS: Initially I've sent this e-mail using the wrong e-mail address (was not subscribed to the list), so this is a resend. I apologize if you end up receiving it twice.
Current thread:
- Re: Article: State of Sandboxing in Linux Mickaël Salaün (Nov 24)
- Re: Article: State of Sandboxing in Linux Ali Polatel (Nov 25)
- <Possible follow-ups>
- Re: Article: State of Sandboxing in Linux Evan Carroll (Nov 24)
- Re: Article: State of Sandboxing in Linux Eli Schwartz (Nov 25)
- Re: Article: State of Sandboxing in Linux Evan Carroll (Nov 25)
- Re: Article: State of Sandboxing in Linux Ali Polatel (Nov 25)
- Re: Article: State of Sandboxing in Linux Eli Schwartz (Nov 25)
- Re: Article: State of Sandboxing in Linux Ali Polatel (Nov 25)
