jdx/mise · error

unsafe ELF interpreter path

Error message

unsafe ELF interpreter path: {interpreter:?}

What it means

After extracting the PT_INTERP program header string, `elf_interpreter` sanity-checks the interpreter path: it must be absolute, and must not contain NUL or newline characters. A path failing these checks could break shell quoting or be abused for path injection when re-executing the binary remotely, so mise refuses it.

Solutions

  1. Run an unmodified official mise build — replace any locally patched binary
  2. Verify the binary's checksum/signature against the release
  3. Inspect the interpreter with `readelf -l $(which mise) | grep interpreter` to confirm it looks like `/lib64/ld-linux-...`

Example fix

// before
# patched binary has interpreter "ld-linux.so" (relative)
readelf -l mise  # [Requesting program interpreter: ld-linux.so]
// after
# use official build with absolute interpreter
readelf -l mise  # [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

fn is_absolute_safe_path(p: &str) -> bool {
    p.starts_with('/') && p.chars().all(|c| c != '\\0' && c != '\\n' && c != '\\r')
}

Try / catch

if let Ok(Some(interp)) = elf_interpreter(&bytes) {
    if !safe_interpreter(&interp) {
        // reject tampered binary; use stock build
        return Err(anyhow!("refusing tampered mise binary"));
    }
}

Prevention

When it happens

Trigger: The ELF interpreter string in the local mise binary is not a normal absolute path: it lacks a leading '/', or embeds NUL/newline bytes — a tampered or hand-crafted binary, or corrupted program header contents.

Common situations: Running a patched/repacked mise binary; binary corruption after the header (bad sectors, partial write); security-tooling test fixtures.

Understand the failure class

Background: Path traversal blocked: "path escapes the workspace" and "outside site root" errors when a path will not stay inside its allowed directory — this error's family across 26 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/e93b4f0ffd5316e4. Report an issue: GitHub.

Appendix: source

Thrown at src/system/remote.rs:1943

        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 533346cc37)