
Sperimentazione sull'affidabilità di exploit in C++ per una vulnerabilità del kernel FreeBSD di PlayStation 5, con build del kernel in VM e configurazione di debug remoto con GDB.
Il bug è stato trovato all'inizio di dicembre 2020, non da me, ma da un genio che ha guardato fbsd per 15 minuti e lo ha subito individuato 🙇♂️. Questa implementazione C++ è stata realizzata mentre si sperimentava per aumentare l'affidabilità dell'exploit dopo che il kernel della PS5 ha aggiunto alcune funzionalità di randomizzazione dell'heap.
wget http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/VM-IMAGES/11.0-RELEASE/amd64/Latest/FreeBSD-11.0-RELEASE-amd64.vhd.xz
nella VM: adduser, aggiungi sshd_enable="YES" a /etc/rc.conf, esegui /etc/rc.d/sshd start
Compila NELLA VM perché il sistema di build di FreeBSD è incompatibile con i sistemi non-FreeBSD (hanno abilitato la compatibilità intorno a fbsd 12/13, ma a noi serve l'11...)
vedi https://docs.freebsd.org/en/books/handbook/kernelconfig/ oppure semplicemente:
cd /usr/src/sys/amd64/conf
cp GENERIC /root/CONFIG
ln -s /root/CONFIG
modifica CONFIG per rimuovere options DDB e aggiungere options GDB
compila e installa:
cd /src/src
make buildkernel KERNCONF=CONFIG
make installkernel KERNCONF=CONFIG
reboot
copia /usr/obj/usr/src/sys/CONFIG/kernel.debug fuori dalla VM per usarlo con gdb.
git clone -b releng/11.0 https://github.com/freebsd/freebsd.git
scarica l'ultima versione da https://ftp.gnu.org/gnu/gdb/ ed estrai
mkdir build
cd build
../configure --disable-binutils --disable-ld --disable-gold --disable-gas --disable-sim --disable-gprof --target=x86_64-unknown-freebsd
make -j64
set substitute-path /usr/src /home/shawn/freebsd
set disassembly-flavor intel
file kernel.debug
target remote /tmp/fbsd11
https://github.com/weltling/convey
https://github.com/jstarks/npiperelay
#!/bin/sh
GDB_PATH=/home/shawn/gdb-10.1/build/gdb
PATH=$GDB_PATH:$PATH
gdb --data-directory=/home/shawn/gdb-10.1/build/gdb/data-directory
nella VM:
sysctl debug.kdb.enter=1