Exploit database

GH-bb869ee2ecd06b833875f4f79893e7d7

yavuzsemih/brotli-secfix

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-111497

61 sources

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

Repository files3
yavuzsemih/brotli-secfixRevision b8773fc14e90

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

scripts/build-ubuntu2404.sh

Shell · 5,697 bytes
#!/usr/bin/env bash
# Build-only workflow. Never installs a package or restarts a service.
set -euo pipefail

usage() {
  cat >&2 <<'USAGE'
Usage: DEBFULLNAME='Operator' DEBEMAIL='[email protected]' \
  ./scripts/build-ubuntu2404.sh /path/to/pristine/brotli-1.1.0 [output-directory]

Run as a non-root user on a disposable Ubuntu 24.04 amd64 build host.
The source and all build dependencies must be provisioned from approved sources.
The script performs no network access, package installation or service restart.
USAGE
}
[[ $# == 1 || $# == 2 ]] || { usage; exit 2; }
REPO=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd -P)
SOURCE=$(realpath -e -- "$1")
OUT=$(realpath -m -- "${2:-$REPO/dist}")
VERSION='1.1.0-2build2+secfix1'
PATCH="$REPO/patches/google-brotli-da980636.patch"

stop() { printf 'STOP: %s\n' "$*" >&2; exit 1; }
[[ $EUID != 0 ]] || stop 'Use an unprivileged build account, never production root.'
[[ -n ${DEBFULLNAME:-} && -n ${DEBEMAIL:-} ]] || stop 'Set DEBFULLNAME and DEBEMAIL.'
[[ $DEBEMAIL =~ ^[^[:space:]@]+@[^[:space:]@]+\.[^[:space:]@]+$ ]] || stop 'Invalid DEBEMAIL format.'
# Skipping the upstream package test suite must not silently produce a release artifact.
[[ " ${DEB_BUILD_OPTIONS:-} " != *' nocheck '* ]] || stop 'DEB_BUILD_OPTIONS=nocheck is forbidden.'
. /etc/os-release
[[ $ID == ubuntu && $VERSION_ID == 24.04 ]] || stop 'Ubuntu 24.04 is required.'
[[ $(dpkg --print-architecture) == amd64 ]] || stop 'amd64 required.'
for tool in git python3 dpkg-parsechangelog dpkg-checkbuilddeps \
            dpkg-buildpackage dpkg-deb dch sha256sum realpath mktemp; do
  command -v "$tool" >/dev/null || stop "Missing required tool: $tool"
done
[[ -f "$SOURCE/debian/changelog" && -f "$SOURCE/debian/patches/series" ]] || stop 'Incomplete Ubuntu source directory.'
[[ $(cd "$SOURCE" && dpkg-parsechangelog -S Source) == brotli ]] || stop 'Wrong source package.'
[[ $(cd "$SOURCE" && dpkg-parsechangelog -S Version) == 1.1.0-2build2 ]] || stop 'Source must be Ubuntu 1.1.0-2build2.'
[[ $(cat "$SOURCE/debian/source/format") == '3.0 (quilt)' ]] || stop 'Unsupported source package format.'
[[ $OUT != "$SOURCE" && $OUT != "$SOURCE/"* ]] || stop 'Output directory cannot be inside source tree.'
[[ $SOURCE != "$OUT" && $SOURCE != "$OUT/"* ]] || stop 'Source directory cannot be inside output directory.'
[[ ! -e "$OUT" || -d "$OUT" ]] || stop 'Output path exists and is not a directory.'
[[ ! -e "$OUT/SHA256SUMS" ]] || stop 'Output already contains a manifest; choose a clean directory.'
# Stale output packages must not be silently mixed with a new build.
if [[ -d $OUT ]]; then
  shopt -s nullglob
  previous=("$OUT"/*.deb "$OUT"/*.ddeb "$OUT"/*.changes "$OUT"/*.buildinfo)
  (( ${#previous[@]} == 0 )) || stop 'Output already has package artifacts; choose a clean directory.'
fi

mkdir -p -- "$OUT"
WORK=$(mktemp -d "$OUT/.build.XXXXXXXX")
STAGED="$WORK/brotli-1.1.0"
cp -a -- "$SOURCE" "$STAGED"
QPATCH="$STAGED/debian/patches/CVE-2026-111497.patch"
[[ ! -e $QPATCH ]] || stop 'Source already contains CVE patch.'
grep -Fqx 'CVE-2026-111497.patch' "$STAGED/debian/patches/series" && stop 'Patch already listed.'
python3 "$REPO/scripts/prepare_quilt_patch.py" \
  --source "$STAGED" --upstream-patch "$PATCH" --output "$QPATCH"
# Ensure appended patch name is a distinct line even if original series lacks terminal LF.
[[ ! -s "$STAGED/debian/patches/series" ]] || \
  [[ $(tail -c 1 "$STAGED/debian/patches/series" | od -An -tu1 | tr -d ' ') == 10 ]] || \
  printf '\n' >> "$STAGED/debian/patches/series"
printf '%s\n' 'CVE-2026-111497.patch' >> "$STAGED/debian/patches/series"

cd "$STAGED"
export DEBFULLNAME DEBEMAIL
dch --newversion "$VERSION" --distribution noble --force-distribution --no-auto-nmu \
  'Backport CVE-2026-111497 from google/brotli@da9806362874b9bd4b552a3af360b5d6347beb12.'
[[ $(dpkg-parsechangelog -S Version) == "$VERSION" ]] || stop 'Changelog version mismatch.'
dpkg-checkbuilddeps
# Binary-only build intentionally avoids publishing an incomplete source package.
# Retain original source package and generated quilt patch in the private evidence store.
dpkg-buildpackage -b -us -uc

NEW="$WORK/libbrotli1_${VERSION}_amd64.deb"
[[ -f $NEW ]] || stop 'Expected libbrotli1 binary missing.'
[[ $(dpkg-deb -f "$NEW" Package) == libbrotli1 ]] || stop 'Unexpected binary package name.'
[[ $(dpkg-deb -f "$NEW" Version) == "$VERSION" ]] || stop 'Unexpected binary package version.'
[[ $(dpkg-deb -f "$NEW" Architecture) == amd64 ]] || stop 'Unexpected binary architecture.'
dpkg-deb -c "$NEW" > "$WORK/deb-file-list.txt"
grep -Fq 'libbrotlidec.so.1.1.0' "$WORK/deb-file-list.txt" || stop 'Decoder shared object missing.'

# Retain all binaries from this source build: e.g. libbrotli-dev has an exact
# versioned dependency on libbrotli1 and must not be silently overlooked.
shopt -s nullglob
outputs=("$WORK"/*_"$VERSION"_*.deb "$WORK"/*_"$VERSION"_*.ddeb \
         "$WORK"/*_"$VERSION"_*.changes "$WORK"/*_"$VERSION"_*.buildinfo)
(( ${#outputs[@]} >= 1 )) || stop 'No expected output artifacts.'
for f in "${outputs[@]}"; do
  [[ ! -e "$OUT/$(basename -- "$f")" ]] || stop "Output collision: $(basename -- "$f")"
done
cp -- "${outputs[@]}" "$OUT/"
cp -- "$QPATCH" "$OUT/CVE-2026-111497-ubuntu-quilt.patch"
cp -- debian/changelog "$OUT/ubuntu-debian-changelog.txt"
(
  cd "$OUT"
  sha256sum -- *.deb *.ddeb *.changes *.buildinfo \
    CVE-2026-111497-ubuntu-quilt.patch ubuntu-debian-changelog.txt > SHA256SUMS
  sha256sum -c SHA256SUMS
)

printf 'BUILD COMPLETE; NOT INSTALLED\nArtifacts: %s\nWorking copy retained: %s\n' "$OUT" "$WORK"
printf 'CAUTION: Tests, runtime/ABI compatibility and deployment approval are separate gates.\n'