Exploit databaseDownload repository ZIP
GH-49753b08fbcec64093787273ddec5dd7
rnw29/cve-2024-21626-runc-lab
Sources for CVE-2024-21626
15 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files13
rnw29/cve-2024-21626-runc-labRevision d33f0f7f8fe9
- ↑..Parent directory
- systemd/
- host-demo.c
- install-container-assets.sh
- prepare-host.sh
- reset-lab.sh
- restore-host.sh
- setup-lab.sh
- victim-attack2-job.sh
- victim-attack3b-audit-job.sh
- victim-attack3b-backup-job.sh
- victim-attack3b-health-job.sh
- victim-attack3b-host-job.sh
- victim-automation.sh
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
host/restore-host.sh
Shell · 1,453 bytes#!/usr/bin/env bash
set -Eeuo pipefail
INSTALL_ROOT="${HOST_INSTALL_ROOT:-}"
LAB_DIR="${INSTALL_ROOT}/opt/cve-2024-21626-lab"
TARGET="${LAB_DIR}/host-demo"
CLEAN_COPY="${LAB_DIR}/host-demo.clean"
INSTALL_OWNER_ARGS=()
die() {
printf '[-] %s\n' "$*" >&2
exit 1
}
(($# == 0)) || die 'Usage: sudo ./host/restore-host.sh'
if [[ -n "${INSTALL_ROOT}" ]]; then
[[ "${INSTALL_ROOT}" == /* && "${INSTALL_ROOT}" != '/' &&
-d "${INSTALL_ROOT}" && ! -L "${INSTALL_ROOT}" ]] ||
die 'HOST_INSTALL_ROOT must be an absolute, non-linked staging directory.'
else
((EUID == 0)) || die 'Run this script with sudo on the Ubuntu host.'
INSTALL_OWNER_ARGS=(-o root -g root)
fi
[[ -f "${CLEAN_COPY}" ]] || die "Missing clean backup: ${CLEAN_COPY}"
grep -aq 'CVE21626_HOST_DEMO' "${CLEAN_COPY}" ||
die 'Clean backup does not contain the sacrificial executable marker.'
RESTORE_TMP="${LAB_DIR}/host-demo.restore.$$"
cleanup() {
rm -f -- "${RESTORE_TMP}" 2>/dev/null || true
}
trap cleanup EXIT
install "${INSTALL_OWNER_ARGS[@]}" -m 0755 "${CLEAN_COPY}" "${RESTORE_TMP}"
mv -f -- "${RESTORE_TMP}" "${TARGET}"
cmp -s "${TARGET}" "${CLEAN_COPY}" || die 'Restored target does not match the clean backup.'
printf '[+] Restored %s from the clean lab copy.\n' "${TARGET}"
sha256sum "${TARGET}" "${CLEAN_COPY}"
printf '[!] A later Attack 3b attempt must repeat attacker-side FD discovery because restoration changes the target inode.\n'