magus v0.3.0 is out. See what's new
¶ View markdown source · ✎ Suggest an edit
1 min read

MGS2007: exec denied by sandbox

A spell tried to execute a binary whose resolved path is outside the configured allowlist.

[MGS2007] exec denied: /home/user/.local/bin/exfil

Why

The sandbox denies execution of binaries whose absolute path is not under the workspace, /tmp, or a system library or executable directory (/usr/bin, /usr/local/bin, etc.). This blocks the attack pattern of dropping a small binary into ~/ and running it.

The binary path is the value returned by exec.LookPath, so an unqualified curl resolved from $PATH is checked at /usr/bin/curl, which is allowed.

Resolution

  • Built-in spells: should never trigger this. If they do, file a bug.

  • Third-party spells trying to run a tool you installed locally (e.g. a custom binary under ~/.local/bin): the spell expects an external binary it did not ship. Add the directory to your allowlist:

    sandbox:
      allow:
        - path: ~/.local/bin
          mode: ro
    

    ro is sufficient: execution requires read access, not write.

  • Malicious spell dropping and running a binary: do not extend the allowlist. This is sandbox working as designed.

MGS2007sandboxsecurityexecpermissionsallowlistbinary
Last updated (b022d75e)
Glossary

Workspace

The magus root directory that owns a set of projects and shared config; the unit magus operates over. See workspace.

Spell

A language/runtime adapter (e.g. go, md) that maps generic targets onto a toolchain's real commands. See spells.

Sandbox

The restricted filesystem and environment a target runs in, so builds stay reproducible and side-effect-free. See sandbox.

CI

An ordinary magusfile-defined target you compose yourself with magus\needs - magus does not hardcode its stages. Magus.RunCI treats it specially only in that it strips the rw charm, it is the anchor magus affected ci keys off, and a selected scope with no project declaring it is a load error rather than a silent no-op. See targets.

Conventions

This page uses none of the site's convention markers. The full set is on the conventions page.