Unlock the bootloader in Developer options
Back up all data before starting
Install Samsung USB drivers on a Windows PC
Download the correct firmware for your exact S25 Ultra model and region
Extract the firmware and locate the AP file
Copy the AP file to your phone
Open Magisk on the phone and patch the AP file
Transfer the patched AP file back to the PC
Boot the phone into Download Mode
Flash the patched AP file with Odin along with BL, CP, and CSC or HOME_CSC from the same firmware
Let the phone reboot and finish setup
Open Magisk and complete the root setup
Verify root with a root checker app
Reflash stock firmware if the device bootloops or fails to start
Note that unlocking the bootloader will wipe the device and may trip Knox permanently
