jdx/mise · error · eyre::Report

unsafe ELF interpreter path: {interpreter:?}

Error message

unsafe ELF interpreter path: {interpreter:?}

What it means

Thrown by elf_interpreter when the PT_INTERP string is present but fails the safety check: it must be an absolute path (start with '/') and contain no embedded NUL or newline. This guard exists because the interpreter path is later shell-quoted into a remote 'sh -c' command (validate_default_binary_compatibility), so a malformed value could inject shell syntax. Real loaders like /lib64/ld-linux-x86-64.so.1 always pass; failure indicates corruption or a crafted binary.

Source

Thrown at src/system/remote.rs:1421

        let size = usize::try_from(read_elf_int(
            bytes,
            start + size_field,
            if class == 1 { 4 } else { 8 },
            little_endian,
        )?)?;
        let value = bytes
            .get(
                offset
                    ..offset
                        .checked_add(size)
                        .ok_or_else(|| eyre!("invalid ELF interpreter"))?,
            )
            .ok_or_else(|| eyre!("truncated ELF interpreter"))?;
        let value = value.strip_suffix(&[0]).unwrap_or(value);
        let interpreter = String::from_utf8(value.to_vec())?;
        if !interpreter.starts_with('/') || interpreter.contains('\0') || interpreter.contains('\n')
        {
            bail!("unsafe ELF interpreter path: {interpreter:?}");
        }
        return Ok(Some(interpreter));
    }
    Ok(None)
}

fn read_elf_int(bytes: &[u8], offset: usize, size: usize, little_endian: bool) -> Result<u64> {
    let value = bytes
        .get(
            offset
                ..offset
                    .checked_add(size)
                    .ok_or_else(|| eyre!("invalid ELF field"))?,
        )
        .ok_or_else(|| eyre!("truncated ELF field"))?;
    let mut padded = [0_u8; 8];
    if little_endian {
        padded[..size].copy_from_slice(value);

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Discard the binary and obtain it from a trusted source (official release or your own build)
  2. Inspect the interpreter: readelf -l mise | grep 'Requesting program interpreter' must show an absolute path
  3. Treat repeated occurrences as a security signal: verify checksums/signatures before retrying

Example fix

# before: untrusted binary with malformed interpreter
readelf -l ./downloaded/mise | grep interpreter
# [Requesting program interpreter: lib/ld-linux.so.2\n...]  -> relative/newline -> rejected

# after: use the signed official artifact
curl -fsSL https://mise.run | sh
readelf -l ~/.local/bin/mise | grep interpreter
# [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
Defensive patterns

Strategy: validation

Validate before calling

# Confirm the interpreter is an absolute, sane path before upload
readelf -l ./mise | grep 'Requesting program interpreter'
# expect: [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
# anything relative/newline-separated is corrupt or hostile: discard the binary

Type guard

fn interpreter_path_safe(interp: &str) -> bool {
    interp.starts_with('/') && !interp.contains('\0') && !interp.contains('\n')
}

Try / catch

match elf_interpreter(&bytes) {
    Err(e) if e.to_string().contains("unsafe ELF interpreter path") => {
        // treat as untrusted input: never shell-quote this into a remote command
        eyre::bail!("binary rejected: unsafe PT_INTERP; verify provenance before retrying");
    }
    other => other?,
}

Prevention

When it happens

Trigger: A mise_bin whose PT_INTERP segment was corrupted so the path is relative or contains control characters; a maliciously crafted binary attempting to smuggle characters into the remote shell command.

Common situations: Supply-chain caution: binaries from untrusted sources; damaged files where the interpreter string runs into adjacent data; packers that rewrite PT_INTERP incorrectly.

Related errors


AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22). Data as JSON: /api/errors/e93b4f0ffd5316e4. Report an issue: GitHub.