Summary
A command execution flaw in mise's task templating allows arbitrary commands to run when task definitions are rendered, even for read-only operations like listing tasks.
If an attacker can introduce malicious task-include files into a repository, merely cd'ing into that directory and invoking task listing or completion can execute attacker-controlled commands without any trust prompt.
Affected context
This vulnerability appears in mise-based developer environments that:
- Use task-include directories such as
mise-tasks/or.mise/tasks/ - Rely on mise's trust mechanism to gate configuration execution
- Operate in directories that contain task includes but no
mise.tomlor.tool-versionsconfig file
In these contexts, mise falls back to default includes and renders task templates using Tera, with exec() available in the template environment and no trust prompt guarding access.
Exploit preconditions
- Attack surface: Developer workstations running
misecommands in cloned or downloaded repositories. - Required access: Ability to place or modify task-include files in a directory that a victim might
cdinto (e.g., via a malicious repo, pull request, archive, or shared project). - Trigger point: Execution of read-only or exploratory commands that render tasks, such as:
mise tasksmise task lsmise runmise tasks --usage- Shell tab-completion that queries tasks
- Why exploitation is possible: Task-include files are processed on a code path that bypasses
trust_checkwhen no config file is present. During rendering, Tera templates can invoke a registeredexec()function, allowing arbitrary command execution without user confirmation.
Why this happens
The root cause is an inconsistency in trust enforcement combined with unsafe template capabilities.
mise's trust model is designed around gating configuration files (mise.toml, .tool-versions) through trust_check, but task-include directories are loaded through a separate path that does not pass through this gate when no config file exists.
Within that path, Tera templates are rendered in an environment where exec() is exposed, enabling templates to run shell commands directly.
This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') and CWE-94: Code Injection, because untrusted template content is effectively treated as executable logic.
The missing trust boundary and over-privileged template functions together result in arbitrary command execution tied to routine read-only operations.
Potential impact
- Developers' machines may execute arbitrary commands controlled by an attacker.
- Attackers could install malware, backdoors, or persistently modify the local environment.
- Sensitive data on the developer workstation (tokens, SSH keys, configuration) could be exfiltrated.
- Local source code and build artifacts can be tampered with, enabling supply-chain compromise.
- Subsequent pushes or releases may unknowingly contain attacker-injected changes.
General mitigation guidance
Effective mitigation centers on hardening template execution and consistently enforcing trust boundaries:
- Restrict or remove high-privilege template functions such as
exec()from environments that render untrusted project content. - Ensure all execution paths that can trigger template rendering or task evaluation pass through a unified trust mechanism, independent of the presence of config files.
- Treat task definitions, includes, and templates as untrusted input by default, and require explicit user consent before enabling any behavior that could run commands.
- Separate presentation logic (listing tasks, showing usage) from execution logic, so read-only operations never trigger side-effectful template functions.
- Apply least-privilege principles to developer tooling, avoiding hidden automatic behavior that can run commands without clear user intent.
How teams detect issues like this
Detection typically involves a mix of static and procedural checks:
- Static analysis of the codebase for template engines wired to functions that execute commands or scripts (e.g.,
exec()in Tera contexts). - Code review guidelines that flag any template rendering driven by repository content where trust checks are absent or conditional.
- Policy-based enforcement that all user-configurable execution paths are mediated through a centralized trust-check system, regardless of file type.
- Automated scanning of task-include directories in projects for suspicious template constructs (such as
{{ exec(...) }}) and alerting maintainers. - Integration of security-focused linters or review tools into CI pipelines for developer tools, ensuring regressions in trust enforcement are caught before release.

