Skip to content
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

Make W^X a normal permission #29

Merged
merged 3 commits into from May 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions debian/control
Expand Up @@ -32,6 +32,8 @@ Description: application launcher to start apps in a restrictive sandbox
* Microphone access
.
* Shared storage access (read-only or read-write)
.
* Dynamic native code execution
.
All apps the user installs will be automatically configured to run in
the sandbox and a prompt will ask the user which permissions they wish to
Expand Down
23 changes: 18 additions & 5 deletions usr/bin/sandbox-app-launcher
Expand Up @@ -102,11 +102,6 @@ setup() {
"${auto_dir}/seccomp-wx"
fi

## Some apps break with W^X so allow opting out.
if grep -qw "${app_name}" "${wx_whitelist}"; then
seccomp_filter="${auto_dir}/seccomp-filter-wx.bpf"
fi

## Create wrappers.
if ! [ -e "${wrapper_dir}/${app_name}" ]; then
cat <<EOF > "${wrapper_dir}/${app_name}"
Expand Down Expand Up @@ -151,6 +146,24 @@ run_program() {
bwrap_args+="--ro-bind ${shared_dir} ${shared_dir} --ro-bind /shared /shared "
fi

## Optionally allow dynamic native code execution.
##
## This allows creating memory mappings that are both
## writable and executable and allows transitioning
## a writable memory mapping to executable i.e. violating
## W^X.
##
## This is generally a security issue since it allows an
## attacker to execute new arbitary code so preventing this
## will force the attacker to use the already existing code
## (ROP/JOP) which is far more limited.
##
## Although, some things require this such as JIT engines in
## browsers so it must be optional.
if [ "${allow_dynamic_native_code_exec}" = "yes" ]; then
seccomp_filter="${auto_dir}/seccomp-filter-wx.bpf"
fi

sudo -H -u "${app_user}" bash -c "
bwrap \
--ro-bind /bin /bin \
Expand Down
2 changes: 0 additions & 2 deletions usr/share/sandbox-app-launcher/wx_whitelist

This file was deleted.