Skip to content

Conversation

@ChrysoliteAzalea
Copy link

Hello everyone! I propose using a private propagation instead of slave one for bind mounts (this is optional and done by --private option). It can theoretically enhance sandbox security as bind-mounting protected paths inside accessible paths won't expose anything to the sandbox.

Signed-off-by: Азалия Смарагдова <charming.flurry@yandex.ru>
Copy link
Contributor

@rusty-snake rusty-snake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manpage and shell completion missing.

The manpage should also explain consequences like busy removable media.

…iles.

Signed-off-by: Азалия Смарагдова <charming.flurry@yandex.ru>
@ChrysoliteAzalea
Copy link
Author

Manpage and shell completion missing.

The manpage should also explain consequences like busy removable media.

Done.

@smcv
Copy link
Collaborator

smcv commented Jul 25, 2022

It can theoretically enhance sandbox security as bind-mounting protected paths inside accessible paths won't expose anything to the sandbox

It can also make sandbox security worse, by having files that you thought you had unmounted (outside the sandbox) remain accessible inside the sandbox, or by having files that you thought you had hidden (by mounting something else over them) remain visible inside the sandbox.

Copy link
Collaborator

@smcv smcv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is your use-case for wanting this feature?

int max_id;
unsigned int n_lines;
int root;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't adjust whitespace in locations that you're not otherwise editing.

This blank line is intentional: bubblewrap is mostly written in a C89 style where variable declarations must come before statements, and when writing in that style it's common to have an empty line between the last variable declaration and the first statement.


bind_mount_result
bind_mount (int proc_fd,
int p_priv,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it should be a BIND_PRIVATE flag in bind_option_t options. It's a lot clearer what the flag means if you see

bind_mount (..., BIND_PRIVATE);

rather than

bind_mount (..., 1, ...);    /* what does 1 mean? is it a boolean? is it a length? ... */

or

bind_mount (..., TRUE, ...);    /* what is being set to true here? */

" --symlink SRC DEST Create symlink at DEST with target SRC\n"
" --seccomp FD Load and use seccomp rules from FD (not repeatable)\n"
" --add-seccomp-fd FD Load and use seccomp rules from FD (repeatable)\n"
" --private Set mount propagation to private\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if --private is halfway through the list of arguments? It's not at all obvious whether it affects all mounts (I think this is actually what happens) or whether it only affects mounts that appear after --private.

@smcv
Copy link
Collaborator

smcv commented Jul 25, 2022

I don't think we can allow this in situations where bwrap is privileged (setuid root), because it would give users the ability to do something that the sysadmin thought they had prevented:

  • sysadmin or OS mounts a device, let's say /run/media/usb_backup_drive
  • unprivileged user uses the setuid bwrap to create a mount namespace with private propagation
  • sysadmin unmounts /run/media/usb_backup_drive
  • unprivileged user can still access /run/media/usb_backup_drive/... using programs running in their private mount namespace

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants