Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save henrik242/65d26a7deca30bdb9828e183809690bd to your computer and use it in GitHub Desktop.
Save henrik242/65d26a7deca30bdb9828e183809690bd to your computer and use it in GitHub Desktop.
@amylee-codes
Copy link

amylee-codes commented Feb 18, 2024

(This article got hidden because of a problem with my account, so I try again):

I managed getting rid of spyware and worse w/ Sonoma (14.3.1).

System Info (redacted, personal information filtered)

>sudo sysinfo
Software:

    System Software Overview:

      System Version: macOS 14.3.1 (23D60)
      Kernel Version: Darwin 23.3.0
      Boot Volume: Macintosh HD
      Boot Mode: Normal
      Computer Name: <>
      User Name: System Administrator (root)
      Secure Virtual Memory: Enabled
      System Integrity Protection: Enabled
      Time since boot: <>

Hardware:

    Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: Mac15,9
      Model Number: <>
      Chip: Apple M3 Max
      Total Number of Cores: 16 (12 performance and 4 efficiency)
      Memory: 128 GB
      System Firmware Version: 10151.81.1
      OS Loader Version: 10151.81.1
      Serial Number (system): <>
      Hardware UUID: <>
      Provisioning UDID: <>
      Activation Lock Status: Disabled
>sudo profiles list
There are no configuration profiles installed in the system domain

>sudo profiles show -type enrollment
Error fetching Device Enrollment configuration: We can't determine if this machine is DEP enabled.  Try again later.

Approach: Clean Wipe, Router Filter, skipmdm.com Script

This approach assumes you are able to create a bootable installer and wipe your system disk (be sure to have a backup in place!).

Prerequisites

Block Apple URLs

Before starting at all, make sure you block the following URLs in the internet router. I used a Fritz!Box and here the ("Blocked websites" filter) to block these URLs:

iprofiles.apple.com
mdmenrollment.apple.com
deviceenrollment.apple.com
gdmf.apple.com
acmdm.apple.com
albert.apple.com

Make sure the blocker works (i.e. ping from another device)!

Clean Install

In recovery mode, wipe the hard disk and start a clean install with the bootable installer.

Activate the system

Connect to the internet once to activate the system (I could not proceed without). As the installer fails to connect to the enrollment servers, an error message will be displayed indicating that the status of the enrollment could not be verified.

Run the Script

In recovery mode, open Terminal and e.g. try to delete /var/db/ConfigurationProfiles/Settings - you should get a prompt for the installation user (starting w/ "_m...") - which is a good sign (no other users set up so far)!

Now just run the script from the USB stick. Hint: directly enter the username you'd like to use later (instead going w/ Apple:1234 - saves some time). The script should run without any errors (despite the long previous discussions).

Postwork

Block URLs in /etc/hosts

Before you proceed with the installation, reboot in recovery mode and change /etc/hosts by adding:

0.0.0.0 iprofiles.apple.com
0.0.0.0 mdmenrollment.apple.com
0.0.0.0 deviceenrollment.apple.com
0.0.0.0 gdmf..apple.com
0.0.0.0 acmdm.apple.com
0.0.0.0 albert.apple.com

Disable agents

>sudo launchctl disable system/com.apple.ManagedClientAgent.enrollagent
>sudo launchctl disable system/com.apple.mdmclient.daemon
>sudo launchctl disable system/com.apple.devicemanagementclient.teslad
# You might check other services and disable them - know what you do!
>sudo launchctl print system | sort | grep enabled

Little Snitch

Finally a firewall comes in handy to possibly add even more security: I blocked

/usr/libexec/teslad
/usr/libexec/mdmclient

(for both user + system).

This works well for me and shows that it's possible to stop companies from installing spyware on their employees' devices - even on M3. B.t.w. - in many countries these practices are unlawful, so I see following this approach justified as a way of self-defense.

@icarus2712
Copy link

icarus2712 commented Mar 9, 2024

can any brother here guide me for amazon locked mac book pro 2017 non touch model inel model When i bought it used it was working perfectly, i even upgraded it to ventura, however when i formatted it for selling, it now asks for amaon remote. please help step by step.

@ooduck
Copy link

ooduck commented Mar 16, 2024

Hi even after holding on recovery it still opens up this screen, any way to bypass this? 20230423_125104

I have the same issue. I can't boot to recovery mode because of this. Do you have recommendations to go through this?
I have Macbook Pro M1 2021 14"
@aviloveN @predragcvetkovski @Jbb08 @eternalgod @maclover696 @mikevic18

@haohanw
Copy link

haohanw commented Mar 18, 2024

Hi even after holding on recovery it still opens up this screen, any way to bypass this? 20230423_125104

I have the same issue. I can't boot to recovery mode because of this. Do you have recommendations to go through this? I have Macbook Pro M1 2021 14" @aviloveN @predragcvetkovski @Jbb08 @eternalgod @maclover696 @mikevic18

Seems like it has been locked by administrator after being enrolled in the MDM. you need another device with T2 chip to reinstall this one via DFU mode.
Try this:https://www.youtube.com/watch?v=S8r9w4dduEw

@ooduck
Copy link

ooduck commented Apr 11, 2024

Hi even after holding on recovery it still opens up this screen, any way to bypass this? 20230423_125104

I have the same issue. I can't boot to recovery mode because of this. Do you have recommendations to go through this? I have Macbook Pro M1 2021 14" @aviloveN @predragcvetkovski @Jbb08 @eternalgod @maclover696 @mikevic18

Seems like it has been locked by administrator after being enrolled in the MDM. you need another device with T2 chip to reinstall this one via DFU mode. Try this:https://www.youtube.com/watch?v=S8r9w4dduEw

Worked like a charm with my MDM macbook.

Do you happen to know if this would also work with icloud issue macbook?

@c22dev
Copy link

c22dev commented Apr 14, 2024

If someone's interested, I made a gist with some sh scripts that should allow you to setup a MDM locked Mac as brand new;

https://gist.github.com/c22dev/e3a1223fa63b20f1b4e95a7119277cb9

@ooduck
Copy link

ooduck commented May 6, 2024

What is your model?

My model is M1 Pro 14inch 2021. The good news is I was able to bypass the login page while installing Monetery following a YT video.

The weird part is if I'm trying to add the apple domains in terminals it says denied.

I swear this took like 3 days seriously 😂

Attached picture.

16824543148281089740353010230330

@aviloveN I have the same activation lock but I can't get pass through it. Can you share the YT video or what you did to bypass the activation lock?

@devzw3
Copy link

devzw3 commented May 13, 2024

Hello my friends, you guys helped me tremendously back in August of 2020 with my 2019 MBP on 10.15.6 with blocking MDM using the steps pictured in the posted screenshot (sorry I found a quoted version first). Anyway, I try to never be that guy that doesn't read all of the posts on a thread before commenting but I've been reading through for about two hours and wow has this thread grown over the past almost 4 years now!

Anyhow, I have been scared to ever update the above said MBP and am still on that OS however now things are starting to kick me out because I am on such an old version. Can't even use Safari anymore without things not loading.

So my question: I have been reading all over the place on here as to what I should do step by step to update and still keep MDM blocked. I know things have changed a bit since 2020 lol. I have full admin access and no MDM issues as of right now. Does that mean I can do something without erasing the full hard drive? Will I have to do a reinstall? Would my ol' dusty 2015 non-MDM MBP be of any need? Should I "chip?" it to change the serial number? Would it be easier to just hit update and then use Checkm8 if I get to the "Remote Management" popup? Sorry for all these questions but that's where I got after reading through so many posts tonight. Any help would be awesome before I randomly just try to jump into something. Thanks a ton for now so far and ~4 years ago!

Screen Shot 2024-05-12 at 9 06 28 PM Screen Shot 2024-05-12 at 9 21 21 PM

@alucardness
Copy link

Updated to Sonoma for a week already. Using M1 MacBook Pro with only blocked hosts.

@Aooga776
Copy link

Updated to Sonoma for a week already. Using M1 MacBook Pro with only blocked hosts.

So I know just enough technical stuff to make myself dangerous, but I wanna make sure I understand. So I'm on Ventura 13.0. Are you saying you just went to system settings and updated to Sonoma without doing anything other than keeping the blocked hosts? Or did you have to remove the blocked hosts, update, then do it again. I'm just trying to find a step by step to not brick my machine.

@alucardness
Copy link

disable the usual suspects in the hosts file

0.0.0.0 iprofiles.apple.com
0.0.0.0 mdmenrollment.apple.com
0.0.0.0 deviceenrollment.apple.com
0.0.0.0 gdmf..apple.com
0.0.0.0 acmdm.apple.com
0.0.0.0 albert.apple.com

follow this:

image

If you want to feel safer, you can turn off your router after the GUI installation of the update (during the GUI installation it requires internet connection, but after that no)

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