Skip to content

noexec bypasses using /run #304

Closed
Closed

Description

@nihil-admirari

systemd mounts $XDG_RUNTIME_DIR (/run/user/$UID) as exec, and $XDG_RUNTIME_DIR is always user writable. Apparently this behaviour is hardcoded in systemd: https://github.com/systemd/systemd/blob/main/src/shared/mount-setup.c#L99.

There is also similarly writable and executable fuse-portal mounted at /run/user/1000/doc.

The presence of these mount makes it trivial to bypass noexec even with ordinary binaries rather than scripts. Is there a workaround available?

See also: https://askubuntu.com/a/1432445.

Activity

  1. nihil-admirari commented on Dec 23, 2024

    @nihil-admirari
    Author

    Correction: $XDG_RUNTIME_DIR is mounted by user-runtime-dir.c, and mounting is controlled by user-runtime-dir@.service. Probably it can be overridden to remount as noexec after mounting.

  2. locked and limited conversation to collaborators on Dec 24, 2024
  3. converted this issue into a discussion #307 on Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions