Exploit database

GH-1f1f8001e1f10a100cc3de445d1e8b71

d4ytox/cve-2026-119618

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-119618

6 sources

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

Repository files5
d4ytox/cve-2026-119618Revision bc7ddb064a3d

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

lab/build.sh

Shell · 11,656 bytes
#!/bin/bash
# Build APR, APR-util and the two target Apache httpd trees from upstream
# source tarballs. The only thing that differs between the vulnerable and the
# fixed side of the differential is the httpd version: 2.4.70 carries the
# vulnerable assign_headers() write, 2.4.71 carries the upstream fix
# (824beab9b9424d6cfb29595248fdbf6c3dddeab1).
#
# Environment:
#   SANITIZER                address | thread | none   (default address)
#   HTTPD_VERS               space-separated httpd versions (default "2.4.70 2.4.71")
#   MPM                      event | worker | prefork  (default event)
#   POOL_CONCURRENCY_CHECK   1 to build APR with --enable-pool-concurrency-check
#   POOL_DEBUG               1 to build APR with --enable-pool-debug
#   GUARD_PAGES              1 to build APR with --enable-allocator-guard-pages
#
# On the MPM
# ----------
# This must be a threaded MPM, and the default is event because that is what
# production runs and what the CVE was scored against.
#
# prefork is a trap. mod_http2 calls prefork unsupported: h2_post_config()
# logs AH10034 "the HTTP/2 protocol will be inactive", and both
# h2_protocol_propose() and h2_protocol_switch() in h2_switch.c return DECLINED,
# so TLS ALPN and Upgrade: h2c both refuse HTTP/2. Only the cleartext
# prior-knowledge path still reaches mod_http2, because
# h2_c1_hook_process_connection() never consults h2_mpm_supported(). The race
# does reproduce there, since h2_c1_child_init() creates worker threads
# ungated, but it reproduces in a configuration upstream believes is switched
# off and which has its own history of unrelated crashes. Measuring on prefork
# invites the reviewer to attribute every crash to that instead. Build event.
#
# On the APR instrumentation options
# ----------------------------------
# These are three different instruments and they are not interchangeable.
#
#   POOL_CONCURRENCY_CHECK  Per-pool, not per-allocator. apr_pools.c adds
#       in_use/in_use_by to struct apr_pool_t and CASes IDLE->IN_USE at the top
#       of apr_palloc, apr_pvsprintf, apr_pool_clear and apr_pool_destroy.
#       allocator_alloc() and allocator_free() carry no instrumentation at all,
#       so two threads colliding on the allocator's free-node list from
#       *different* pools pass both CAS gates unnoticed. It fires only for the
#       narrower same-pool overlap. Mutually exclusive with POOL_DEBUG: every
#       pool_concurrency_* call site lives in the !APR_POOL_DEBUG half of
#       apr_pools.c, so asking for both silently discards the check.
#
#   POOL_DEBUG  Replaces the pool allocator with one malloc() per allocation.
#       This is a mechanism-isolating control, NOT a way to get better reports
#       for this bug: it removes the allocator free-node list that this CVE
#       races on. Expect the crashes to disappear. That disappearance is the
#       evidence, since it says the corruption travels through the pool
#       allocator rather than through anything else under the same traffic. It
#       is confounded by also changing allocation layout wholesale, so it
#       supports the mechanism claim and cannot establish it alone.
#
#   GUARD_PAGES  Wraps every allocator node in PROT_NONE pages, so a write that
#       runs off the end of a pool block faults at the instruction that did it
#       rather than at some later dereference of corrupted data. Composes with
#       either of the above.
set -euo pipefail

SANITIZER="${SANITIZER:-address}"
HTTPD_VERS="${HTTPD_VERS:-2.4.70 2.4.71}"
MPM="${MPM:-event}"
POOL_CONCURRENCY_CHECK="${POOL_CONCURRENCY_CHECK:-0}"
POOL_DEBUG="${POOL_DEBUG:-0}"
GUARD_PAGES="${GUARD_PAGES:-0}"
APR_VER="${APR_VER:-1.7.4}"
APRUTIL_VER="${APRUTIL_VER:-1.6.3}"
PREFIX="${PREFIX:-/opt}"
JOBS="${JOBS:-$(nproc)}"

# Upstream SHA256 sums, taken from the .sha256 files published next to each
# tarball on archive.apache.org. A mismatch aborts the build: an exploit lab
# that cannot say which bytes it compiled is not evidence of anything.
declare -A SHA256
SHA256[apr-1.7.4.tar.gz]="a4137dd82a185076fa50ba54232d920a17c6469c30b0876569e1c2a05ff311d9"
SHA256[apr-util-1.6.3.tar.gz]="2b74d8932703826862ca305b094eef2983c27b39d5c9414442e9976a9acf1983"
SHA256[httpd-2.4.70.tar.gz]="e0cc26ab60a024db2b4a9b219ce6e1538fe2d3138ece2156d2834c63ae21913d"
SHA256[httpd-2.4.71.tar.gz]="6b0433674ded858d2ac01e95345935ce127d5d287471762f0a7f10f4969cbfe8"

REPORT="$PREFIX/build-report.txt"

case "$SANITIZER" in
  address) SAN="-fsanitize=address -fno-omit-frame-pointer" ;;
  thread)  SAN="-fsanitize=thread  -fno-omit-frame-pointer" ;;
  none)    SAN="" ;;
  *) echo "build.sh: unknown SANITIZER=$SANITIZER" >&2; exit 1 ;;
esac

case "$MPM" in
  event|worker) ;;
  prefork)
    echo "build.sh: WARNING: MPM=prefork. mod_http2 logs AH10034 and refuses" >&2
    echo "build.sh: WARNING: HTTP/2 over ALPN and Upgrade. Only the cleartext" >&2
    echo "build.sh: WARNING: prior-knowledge path survives. Not a representative" >&2
    echo "build.sh: WARNING: configuration; see the comment at the top of this file." >&2
    ;;
  *) echo "build.sh: unknown MPM=$MPM" >&2; exit 1 ;;
esac

if [ "$POOL_DEBUG" = "1" ] && [ "$POOL_CONCURRENCY_CHECK" = "1" ]; then
  echo "build.sh: POOL_DEBUG and POOL_CONCURRENCY_CHECK are mutually exclusive." >&2
  echo "build.sh: The pool_concurrency_* call sites are all inside the" >&2
  echo "build.sh: !APR_POOL_DEBUG half of apr_pools.c, so building both would" >&2
  echo "build.sh: silently compile the concurrency check out. Build two images." >&2
  exit 1
fi

# -O1 with frame pointers: enough optimisation to keep the timing realistic,
# little enough to keep stack traces readable. -fno-common so a sanitizer sees
# distinct objects rather than merged tentative definitions.
export CFLAGS="-g3 -O1 -fno-omit-frame-pointer -fno-common ${SAN}"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="${SAN}"

mkdir -p /build "$PREFIX"
cd /build

{
  echo "=== build.sh configuration ==="
  echo "date=$(date -u +%Y-%m-%dT%H:%M:%SZ)"
  echo "SANITIZER=$SANITIZER"
  echo "MPM=$MPM"
  echo "HTTPD_VERS=$HTTPD_VERS"
  echo "APR_VER=$APR_VER"
  echo "APRUTIL_VER=$APRUTIL_VER"
  echo "POOL_CONCURRENCY_CHECK=$POOL_CONCURRENCY_CHECK"
  echo "POOL_DEBUG=$POOL_DEBUG"
  echo "GUARD_PAGES=$GUARD_PAGES"
  echo "CFLAGS=$CFLAGS"
  echo "LDFLAGS=$LDFLAGS"
  echo "cc=$(cc --version | head -1)"
  echo "arch=$(uname -m)"
} > "$REPORT"

fetch() {
  local url="$1" out="$2"
  local want="${SHA256[$out]:-}"
  if [ -z "$want" ]; then
    echo "build.sh: no SHA256 recorded for $out, refusing to download" >&2
    exit 1
  fi
  echo ">>> fetch $url"
  curl -fsSL --retry 3 -o "$out" "$url"
  local got
  got="$(sha256sum "$out" | cut -d' ' -f1)"
  if [ "$got" != "$want" ]; then
    echo "build.sh: SHA256 mismatch for $out" >&2
    echo "  expected $want" >&2
    echo "  got      $got" >&2
    exit 1
  fi
  echo "    sha256 ok: $got"
  echo "sha256 $out = $got" >> "$REPORT"
}

# Run ./configure with its output captured rather than discarded, then fail if
# autoconf reported an option it did not recognise. Autoconf accepts unknown
# --enable-* flags silently apart from one warning line, so discarding the log
# is how a build ends up quietly missing the instrumentation it was asked for.
run_configure() {
  local label="$1"; shift
  local log="/build/configure-${label}.log"
  echo ">>> configure $label"
  if ! ./configure "$@" > "$log" 2>&1; then
    echo "build.sh: configure failed for $label, tail follows:" >&2
    tail -40 "$log" >&2
    exit 1
  fi
  if grep -q "unrecognized options" "$log"; then
    echo "build.sh: configure ignored an option we passed for $label:" >&2
    grep "unrecognized options" "$log" >&2
    exit 1
  fi
  cp "$log" "$PREFIX/configure-${label}.log"
}

echo "===== APR $APR_VER ====="
if [ ! -x "$PREFIX/apr/bin/apr-1-config" ]; then
  fetch "https://archive.apache.org/dist/apr/apr-${APR_VER}.tar.gz" "apr-${APR_VER}.tar.gz"
  tar xzf "apr-${APR_VER}.tar.gz"
  cd "apr-${APR_VER}"
  APR_CONF=(--prefix="$PREFIX/apr" --enable-threads)
  [ "$POOL_CONCURRENCY_CHECK" = "1" ] && APR_CONF+=(--enable-pool-concurrency-check)
  [ "$POOL_DEBUG" = "1" ]             && APR_CONF+=(--enable-pool-debug)
  [ "$GUARD_PAGES" = "1" ]            && APR_CONF+=(--enable-allocator-guard-pages)
  run_configure apr "${APR_CONF[@]}"
  make -j"$JOBS" >/dev/null
  make install >/dev/null

  # Record what the instrumentation macros actually came out as. apr_private.h
  # is generated by configure and is the authoritative answer; it is not
  # installed, so capture it before /build is removed.
  {
    echo "=== APR instrumentation, from apr_private.h ==="
    grep -E 'APR_POOL_CONCURRENCY_CHECK|APR_POOL_DEBUG|APR_ALLOCATOR_GUARD_PAGES|APR_HAS_THREADS' \
      include/apr_private.h || echo "(no matching lines)"
  } >> "$REPORT"
  cd /build
fi

# Second, independent check on the installed object: the "pool concurrency
# check:" literal exists only inside #if APR_POOL_CONCURRENCY_CHECK. If the
# option was requested and this string is absent, the check is not compiled in
# and any clean result from it would be an artifact of the build.
APR_LIB="$(find "$PREFIX/apr/lib" -name 'libapr-1.so*' -type f | head -1)"
if [ -n "$APR_LIB" ] && strings "$APR_LIB" | grep -q 'pool concurrency check'; then
  CONCURRENCY_CHECK_PRESENT=1
else
  CONCURRENCY_CHECK_PRESENT=0
fi
echo "APR_CONCURRENCY_CHECK_LINKED=$CONCURRENCY_CHECK_PRESENT" >> "$REPORT"
if [ "$POOL_CONCURRENCY_CHECK" = "1" ] && [ "$CONCURRENCY_CHECK_PRESENT" = "0" ]; then
  echo "build.sh: --enable-pool-concurrency-check was requested but the" >&2
  echo "build.sh: 'pool concurrency check' string is absent from $APR_LIB." >&2
  echo "build.sh: The check is NOT compiled in. Refusing to ship an image" >&2
  echo "build.sh: whose clean results would be meaningless." >&2
  exit 1
fi

echo "===== APR-util $APRUTIL_VER ====="
if [ ! -x "$PREFIX/apr-util/bin/apu-1-config" ]; then
  fetch "https://archive.apache.org/dist/apr/apr-util-${APRUTIL_VER}.tar.gz" "apr-util-${APRUTIL_VER}.tar.gz"
  tar xzf "apr-util-${APRUTIL_VER}.tar.gz"
  cd "apr-util-${APRUTIL_VER}"
  run_configure apr-util --prefix="$PREFIX/apr-util" \
                         --with-apr="$PREFIX/apr" \
                         --with-expat=/usr
  make -j"$JOBS" >/dev/null
  make install >/dev/null
  cd /build
fi

for V in $HTTPD_VERS; do
  echo "===== httpd $V ====="
  if [ ! -x "$PREFIX/httpd-$V/bin/httpd" ]; then
    fetch "https://archive.apache.org/dist/httpd/httpd-${V}.tar.gz" "httpd-${V}.tar.gz"
    tar xzf "httpd-${V}.tar.gz"
    cd "httpd-${V}"
    run_configure "httpd-$V" --prefix="$PREFIX/httpd-$V" \
                --with-apr="$PREFIX/apr" \
                --with-apr-util="$PREFIX/apr-util" \
                --enable-http2=shared \
                --with-nghttp2=/usr \
                --with-ssl \
                --with-pcre \
                --with-mpm="$MPM" \
                --enable-mods-shared=most
    make -j"$JOBS" >/dev/null
    make install >/dev/null
    cd /build
  fi
  "$PREFIX/httpd-$V/bin/httpd" -v
  test -f "$PREFIX/httpd-$V/modules/mod_http2.so" \
    || { echo "mod_http2.so missing for $V" >&2; exit 1; }

  # The MPM is linked statically by --with-mpm, so confirm the binary really
  # carries the threaded one rather than whatever was configured last.
  BUILT_MPM="$("$PREFIX/httpd-$V/bin/httpd" -V | sed -n 's/^Server MPM: *//p')"
  echo "httpd-$V MPM=$BUILT_MPM" >> "$REPORT"
  if [ "$MPM" != "prefork" ] && [ "${BUILT_MPM,,}" = "prefork" ]; then
    echo "build.sh: httpd $V was built with the prefork MPM despite MPM=$MPM" >&2
    exit 1
  fi
done

echo "===== build complete ====="
cat "$REPORT"