---
title: "MGS2007: exec denied"
description: Fires when a spell tries to execute a binary whose resolved path is outside the workspace, tmp, and the system executable allowlist.
tags: [MGS2007, sandbox, security, exec, permissions, allowlist, binary]
---

# MGS2007: exec denied by sandbox

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

```text
[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:

  ```yaml
  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.
