-
Notifications
You must be signed in to change notification settings - Fork 588
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
Creation of blacklisted or read-only files #1011
Comments
Also, many distributions are shipped without critical folders like autostart or ~/bin... they are created as required, and as long as they don't exist, even firejailed applications can make and fill them with arbitrary data. |
Yes it's a nice feature, I'll mark it as an enhancement, although I have no idea how to do it at this moment. |
@netblue30, just to provide a little more input :) Do you think it could be helpful to write a warning to the syslog when a blacklisted file from disable-common.inc is freshly created (kernel provides the inotify API for such things)? From an attackers perspective, it would increase the risk of discovery to some extent.... An alternative way to handle this issue would be to employ whitelisting in more profiles. Also this has its downsides (with whitelisting, everything tends to be more restrictive, which leads to an increased risk of breaking functionality in one way or another), but an extensive use of whitelisting would be more compatible with the way Firejail works right now. When going this direction, having a profile switch at hand like "whitelist everything that is not hidden (in the root of user home)" would be very helpful, I guess. A very similar discussion about blacklisting, that inspired this comment, is/has been going on in #578. |
In profile files, you can use
which ensures the directory exists and cannot be accessed. If you want to do this for a file, use |
In the moment, firejail can blacklist files or set them read-only, if the files already exist. But if a file to be marked as read-only or as blacklisted doesn't exist yet, firejail won't prevent its creation.
This is for sure entirely unproblematic in most cases, but I see a problem in particular with the bash configuration file zoo. It is probably safe to assume that on most systems the set of bash configuration files is incomplete. In a Debian home folder, for example, there are by default only
.bashrc
,.bash_logout
and.profile
.Now if a program in a firejail sandbox would create a new
.bash_profile
or.bash_login
file (both read-only via disable-common.inc) or a new.bash_aliases
file, it could basically write there anything it wanted... and have it executed on next login. I'm not familiar with other shells, but there might be similar problems, too.Thus, a nice-to-have feature would be to prevent the creation of blacklisted or read-only files.
For the issue with bash there are several easy workarounds of course: E.g. creating an empty file
~/.bash_aliases
and renaming~/.profile
to~/.bash_profile
solves the problem for a default Debian desktop.#1010
The text was updated successfully, but these errors were encountered: