8000 The SUID sandbox helper binary was found, but is not configured correctly · Issue #17972 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

The SUID sandbox helper binary was found, but is not configured correctly #17972

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 u 8000 p 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

Closed
3 tasks done
christianbundy opened this issue Apr 25, 2019 · 158 comments · Fixed by toeverything/AFFiNE#8492
Closed
3 tasks done

Comments

@christianbundy
Copy link

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

  • Electron Version:
    • 5.0.0
  • Operating System:
    • Arch Linux x64
  • Last Known Working Electron version::
    • 4.1.5

Expected Behavior

Running node_modules/.bin/electron --version should output v5.0.0.

To be clear, all commands create this error, but I'm using the --version flag for simplicity.

Actual Behavior

$ node_modules/.bin/electron --version
[2720:0425/142001.775056:FATAL:setuid_sandbox_host.cc(157)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /home/christianbundy/src/ssbc/patchwork/node_modules/electron/dist/chrome-sandbox is owned by root and has mode 4755.

Additional Information

$ stat /home/christianbundy/src/ssbc/patchwork/node_modules/electron/dist/chrome-sandbox
  Size: 5185424   	Blocks: 10128      IO Block: 4096   regular file
Device: 802h/2050d	Inode: 1465270     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1000/christianbundy)   Gid: ( 1000/christianbundy)
Access: 2019-04-25 14:15:10.609279524 -0700
Modify: 2019-04-25 14:15:10.659278929 -0700
Change: 2019-04-25 14:15:10.659278929 -0700
 Birth: 2019-04-25 14:15:10.609279524 -0700

If I chown and chmod the file then it works fine, but my intuition is that npm install electron@latest should work without those commands. Is this expected behavior?

@nornagon
Copy link
Contributor

Unfortunately there's no way we can configure this correctly automatically, because setting the appropriate permissions requires root privileges and we don't want to ask for a root password during npm install.

Ideally, Arch would configure its kernel support unprivileged CLONE_NEWUSER and Chromium (and Electron) could use the namespace sandbox instead of relying on the old setuid sandbox. Apps that are distributed on Linux will need to incorporate this into their install process. See electron-userland/electron-installer-debian#184 and electron-userland/electron-installer-redhat#112 for example.

During development, we should probably print something out on npm install though with instructions if we detect that the namespace sandbox isn't available.

@christianbundy
Copy link
Author

Hey, thanks for the super quick response!

Does unprivileged CLONE_NEWUSER come from CONFIG_USER_NS=y? If so, that should be the current configuration.

Please let me know if there's anything I can do to help, or if this is expected output on Arch I'm happy to close -- I understand that there's some jankiness to be expected when running bleeding-edge distros and I don't mind resolving this in a PKGBUILD rather than expecting it to work perfectly straight out of npm. Cheers!

@nornagon
Copy link
Contributor

CONFIG_USER_NS=y enables the user namespaces feature, but they're still restricted to privileged users by default. This suggests sysctl kernel.unprivileged_userns_clone=1

@kitingChris
Copy link

Is there a possible workaround in the meantime until every linux distro enables those features?

@MarshallOfSound
Copy link
Member

@kitingChris The setuid sandbox IS the workaround. You just need to ensure that when developing / releasing an electron app your dev / packaging scripts set the permissions of the sandbox helper correctly as @nornagon linked above.

@vladimiry
Copy link
vladimiry commented Apr 28, 2019

Is there a possible workaround in the meantime until every linux distro enables those features?

See the original message:

If I chown and chmod the file then it works fine

Also see here #16631 (comment) So to make suid sandbox work you basically have to tweak the chrome-sandbox binary this way:

  • sudo chown root chrome-sandbox
  • chmod 4755 chrome-sandbox

The issue is more severe though if running appimage/snap packages, I have not yet revealed a decent workaround for these cases. It's working if appimage is executed with --no-sandbox arguemnt, but this is a hack.

@vladimiry
Copy link

@nornagon

because setting the appropriate permissions requires root privileges and we don't want to ask for a root password during npm install.

Executing chmod 4755 node_modules/electron/dist/chrome-sandbox doesn't require root permission and that should be enough to run such command for wrapping the app to deb/pacman/etc packages as when such packages get installed all the files including chrome-sandbox normally owned by root. So it would be great electron does chmod 4755 node_modules/electron/dist/chrome-sandbox automatically during installation process as then there would be no need to handle this case manually like mentioned here.

@vladimiry
Copy link
vladimiry commented Apr 28, 2019

CONFIG_USER_NS=y enables the user namespaces feature, but they're still restricted to privileged users by default. This suggests sysctl kernel.unprivileged_userns_clone=1

I confirm executing sudo sysctl kernel.unprivileged_userns_clone=1 is another workaround, related comment.

@burningTyger
Copy link

@vladimiry I needed to first chown and then chmod. The other way round it didn't work.

@vladimiry
Copy link
vladimiry commented Apr 28, 2019

@burningTyger you are right, I just have changed the original message.

@MarshallOfSound
Copy link
Member

@nornagon If we chmod 4755 out/Release/chrome-sandbox on CI will that permission be persisted once we zip it up or do we have to make this change in electron-download to fix the permission on DL?

@liberodark
Copy link

same here is bad new fonction for what need to change that... :(

vladimiry added a commit to vladimiry/ElectronMail that referenced this issue Apr 29, 2019
@nornagon
Copy link
Contributor

@MarshallOfSound zip does not support permissions, but ultimately the issue is not the chmod permission, but rather the owner. The setuid sandbox helper is suid to root, because it needs to perform functions that are only available to root. If it were possible to set the appropriate permissions without first gaining root privileges, that would be a very serious vulnerability in Linux. Fortunately for Linux, and unfortunately for us, that is not the case.

Here are the options as I see them:

  1. Change nothing in Electron. Recommend that developers enable unprivileged CLONE_USERNS on their kernel to allow the namespace sandbox to run instead of the setuid sandbox.
  2. Boot without sandbo 8000 x if no sandboxing method is available only when booting an unpackaged app. If Electron is booting a packaged app, refuse to boot without sandbox.
  3. In all cases, if no sandboxing method is available, boot without sandboxing and print a warning.
  4. Disable sandboxing by default on Linux.

I'm leaning towards (2). It would ease development without compromising the security of the deployed app.

I'm not yet sure what to do about snap/flatpak, as I'm not familiar with their workings. It's possible that they already sandbox the app sufficiently that we can disable sandboxing altogether in that situation, as we do when building the Mac App Store version of Electron.

@nornagon nornagon self-assigned this Apr 29, 2019
@vladimiry
Copy link

As for now, I like more the first option.

  1. Boot without sandbox if no sandboxing method is available only when booting an unpackaged app. If Electron is booting a packaged app, refuse to boot without sandbox.

Such scenario would be somehow misleading. One might be successfully running unpackaged app without sandboxing, but there is a chance that the packaged app won't work the same way with enabled sandboxing. Like, for example, the case when you access the main process from the renderer process not through the remote interface. Or the case of wrapping the app to AppImage / Snap / Flatpak packages.

  1. In all cases, if no sandboxing method is available, boot without sandboxing and print a warning.

So a packaged app that was designed and developed as sandboxed might be executed without sandbox if no sandbox available. This doesn't sound good to me.

  1. Disable sandboxing by default on Linux.

What does it mean exactly? What would be the way to enable sandboxing on Linux in the way the app either starts or fails if no sandboxing available (the current situation, forced sandboxing).

@nornagon
Copy link
Contributor

I also like (1), but to defend (2) a little, the API exposed to the app wouldn't change when disabling the sandbox. The only thing we would disable is the OS-level sandbox. We would still load the app the same way, it just wouldn't be protected by the OS.

@vladimiry
Copy link

We would still load the app the same way, it just wouldn't be protected by the OS.

Then it sounds good to me too. Thanks for the explanation.

mnvr added a commit to ente-io/ente that referenced this issue May 12, 2024
mnvr added a commit to ente-io/ente that referenced this issue May 12, 2024
mnvr added a commit to ente-io/ente that referenced this issue May 13, 2024
From toeverything/AFFiNE#6722 (comment)

> Disable sandboxing entirely by launching with --no-sandbox. Adding this
  argument from JS is unfortunately insufficient, as the GPU process is launched
  before the main process JS is run.

Ref:
* electron/electron#17972
jurgelenas added a commit to ExpressLRS/ExpressLRS-Configurator that referenced this issue May 28, 2024
Schneegans added a commit to kando-menu/kando that referenced this issue Jul 16, 2024
pengx17 added a commit to toeverything/AFFiNE that referenced this issue Oct 14, 2024
Operating System
  Ubuntu
  24.04.1
  LTS

Github ubuntu-latest has points to 24.04.1
actions/runner-images#10636 (comment)

related possible fix electron/electron#17972 (comment)
EYHN pushed a commit to toeverything/AFFiNE that referenced this issue Oct 14, 2024
Operating System
  Ubuntu
  24.04.1
  LTS

Github ubuntu-latest now points to 24.04.1
actions/runner-images#10636 (comment)

related possible fix electron/electron#17972 (comment)
@leldr
Copy link
leldr commented Nov 20, 2024

CONFIG_USER_NS=y enables the user namespaces feature, but they're still restricted to privileged users by default. This suggests sysctl kernel.unprivileged_userns_clone=1

I confirm executing sudo sysctl kernel.unprivileged_userns_clone=1 is another workaround, related comment.

experiencing this same issue (Ubuntu 24 LTS) with the latest release of fiddle. this is the only/latest conversation I've heard about this issue. This fixed it.

@juliangruber
Copy link
juliangruber commented Dec 18, 2024

This just started again, and sudo sysctl kernel.unprivileged_userns_clone=1 doesn't help.

See https://github.com/filecoin-station/desktop/pull/1970/files#diff-b803fcb7f17ed9235f1e5cb1fcd2f5d3b2838429d4368ae4c57ce4436577f03fR42 and the resulting failure in https://github.com/filecoin-station/desktop/actions/runs/12372222440/job/34529950284?pr=1970:

  pw:browser <launching> /home/runner/work/desktop/desktop/node_modules/electron/dist/electron -r /home/runner/work/desktop/desktop/node_modules/playwright-core/lib/server/electron/loader.js --inspect=0 --remote-debugging-port=0 /home/runner/work/desktop/desktop/main/index.js +0ms
  pw:browser <launched> pid=4563 +3ms
  pw:browser [pid=4563][err] [4563:1217/113904.577945:FATAL:setuid_sandbox_host.cc(163)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /home/runner/work/desktop/desktop/node_modules/electron/dist/chrome-sandbox is owned by root and has mode 4755. +29ms
  pw:browser [pid=4563] <process did exit: exitCode=null, signal=SIGTRAP> +115ms
  pw:browser [pid=4563] starting temporary directories cleanup +0ms
F°°°  pw:browser [pid=4563] finished temporary directories cleanup

This time, fixing the chrome-sandbox binary works, the ns_clone configuration doesn't have an effect

@yhojann-cl
Copy link
yhojann-cl commented Dec 26, 2024

You can execute without sandbox, in the package.json add the argument

"scripts": {
    "start": "electron --no-sandbox ."
  },

Or add the parameter from javascript enrtypoint:

const { app, BrowserWindow } = require('electron');

// Need root permissions or can disable sandboxing
app.commandLine.appendSwitch('no-sandbox');

const createWindow = () => {

The electron package comes with the sandbox enabled by default unless you disable it manually, the problem is that to be enabled you always need root privileges, it would be better if by default it comes with the sandboxing disabled until someone wants to enable it manually and has these privileges. It is difficult to ask all users of an app to always have elevated privileges to run a calculator or a notepad.

aaddrick added a commit to aaddrick/claude-desktop-debian that referenced this issue Mar 30, 2025
Removes the --no-sandbox flag from the launcher and instead adds logic
to the postinst script to set the correct owner (root) and permissions
(4755) for the chrome-sandbox binary. This allows the SUID sandbox to
function correctly, resolving the login issue.

See: electron/electron#17972
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

0