Magisk (software)
View on Wikipedia| Magisk | |
|---|---|
| Original author | John Wu (topjohnwu) |
| Initial release | August 2016[1] |
| Stable release | 29.0
/ May 14, 2025[2] |
| Repository | github |
| Written in | C++ , Kotlin , Rust[3] |
| Operating system | Android |
| Platform | Android |
| License | GPL-3.0 |
| Website | github |
Magisk is a free and open-source software used for userspace systemless rooting of Android devices, developed by John Wu. Magisk supports devices running Android 6.0 or higher.[3]
Overview
[edit]Magisk is a free and open-source software that enables users to gain root access to their Android devices. With Magisk, users can install various modifications and customizations, making it a popular choice for Android enthusiasts. Additionally, Magisk comes with a built-in Magisk Manager app, which allows users to manage root permissions and install various modules.[3]
Magisk has a modular design and uses magic mounts for a systemless approach; it offers a safe and easy way to root an Android device to add new features and functionality.
How it works
[edit]Users download their firmware (init_boot.img or boot.img) and use Magisk to patch the file. After unlocking the bootloader, the patched file is flashed by using fastboot or Odin (for Samsung devices). By doing so, Magisk gains root access by replacing init with magiskinit in the booting process of Android devices.[citation needed]
History
[edit]Magisk started out as a small project created by John Wu. However, it has now grown to more than 252 contributors. In version 21, support for Android 11 was added.[4] In version 22, support for the Samsung Galaxy S21 was added.[5] In version 26, support for Android 5 and below was removed.[6] The original developer John Wu started working for the Android security team in May 2021.[7]
See also
[edit]References
[edit]- ^ "State of Magisk: 2020". Medium.com. 2020-01-24. Retrieved 2025-06-19.
- ^ "Release Magisk 29.0". GitHub. 2025-05-14.
- ^ a b c Wu, John (2022-12-12), topjohnwu/Magisk, retrieved 2022-12-12
- ^ "Root-methode Magisk krijgt ondersteuning voor Android 11". Tweakers (in Dutch). Retrieved 2021-09-11.
- ^ Wilde, Damien (2021-02-24). "Magisk v22.0 adds support for Galaxy S21 series, app hiding improvements, plus more". 9to5Google. Retrieved 2021-09-11.
- ^ Wilde, Damien (2021-05-13). "Magisk v23 drop pre-Android 5 device support". 9to5Google. Retrieved 2021-09-11.
- ^ Schoon, Ben (2021-05-17). "Google hires John Wu, the creator of Magisk, for Android security team". 9to5Google. Retrieved 19 June 2025.
External links
[edit]Magisk (software)
View on GrokipediaOverview and Purpose
Definition and Core Functionality
Magisk is a free and open-source software suite for customizing Android devices, renowned for enabling systemless rooting in the userspace without altering the core system partition. It targets devices running Android 6.0 (API level 23) or higher, allowing users to gain elevated privileges while maintaining the integrity of the original firmware.[1] Developed by John Wu under the GitHub handle topjohnwu, Magisk began as a personal endeavor to explore and advance Android modification techniques beyond traditional rooting methods.[5] The core functionality of Magisk revolves around providing root access via MagiskSU, a superuser implementation that operates without direct modifications to the read-only system partition. This is achieved through boot image patching, where the device's boot image is altered to include custom ramdisk scripts, and bind mounts (Magisk's magic mount mechanism) that overlay modifications on top of the existing system. These overlays enable seamless customizations—such as injecting scripts, replacing files, or adding new components—while ensuring the underlying system remains untouched, thereby preserving over-the-air (OTA) update compatibility and device verification checks like SafetyNet or Play Integrity.[2] Key components include the Magisk app, a user interface for managing installations, modules, and root permissions; the Magisk core, which handles boot-stage modifications and runtime environments; and supporting binaries like BusyBox for shell utilities and Zygisk for process-level code injection. Released under the GNU General Public License version 3.0 or later (GPL-3.0-or-later), the project is hosted on GitHub, where it has garnered contributions from a large community of developers.[1] This modular architecture extends to a system of add-on modules, allowing targeted enhancements without core changes, though detailed module integration is handled separately.[2]Primary Use Cases
Magisk primarily enables users to gain superuser access on Android devices, allowing advanced tweaks such as running applications that require root privileges, including backup tools like Titanium Backup or compatibility layers for frameworks like Xposed.[1] This systemless rooting method provides elevated permissions without directly modifying the system partition, facilitating modifications that would otherwise be restricted by Android's security model.[1] A key application is hiding root detection from third-party applications, particularly those with strict security requirements. Through its DenyList feature, which succeeded the deprecated MagiskHide, Magisk allows users to selectively conceal root status, enabling compatibility with banking apps, payment services, or games that check for modifications via mechanisms like SafetyNet or Play Integrity API.[6] This ensures that rooted devices can still access services that prohibit tampering, maintaining functionality in sensitive environments.[6] Magisk supports over-the-air (OTA) firmware updates without necessitating the loss of root access, a significant advantage over traditional rooting methods that often require re-rooting after each update.[1] The systemless approach overlays changes via modules, preserving the integrity of the original system files during updates and allowing users to retain customizations seamlessly.[1] For device customization, Magisk's module system permits installations that enhance user experience, such as ad-blocking filters, custom themes, or performance optimizations like kernel tweaks.[1] These modifications are applied non-destructively, potentially avoiding warranty voidance since the core system remains unaltered.[1] In mobile security testing and development, Magisk is widely used to root physical devices or emulators, providing controlled superuser access for vulnerability assessment, reverse engineering, and penetration testing scenarios.[7] This enables testers to simulate privileged environments, bypass restrictions, and evaluate app behaviors under rooted conditions without permanent system changes.[8]Technical Architecture
Installation and Setup
Installing Magisk on an Android device requires several prerequisites to ensure a successful and safe process. The device's bootloader must be unlocked, which typically involves enabling OEM unlocking in the developer options and using fastboot commands to issue the unlock directive from a computer.[9] Users should have basic familiarity with Android Debug Bridge (ADB) and Fastboot tools, available via the Android SDK Platform-Tools.[9] Additionally, download and install the latest Magisk APK from the official GitHub repository, as it serves as the manager for the installation process.[3] It is strongly recommended to back up all device data beforehand, since unlocking the bootloader or certain flashing steps may necessitate a factory reset, particularly on devices like Samsung models.[9] The standard installation method uses image patching to achieve systemless root. First, extract the stockboot.img (or equivalent) from the device's official firmware package, which can be obtained from the manufacturer's website or trusted sources. Transfer this image file to the device's internal storage using ADB (e.g., adb push boot.img /sdcard/). Open the Magisk app, navigate to the Install section, select "Select and Patch a File," choose the image, and allow the app to generate the patched version, typically named magisk_patched-[random_string].img. Retrieve the patched file to the computer via adb pull /sdcard/Download/magisk_patched-[random_string].img. Then, boot the device into fastboot mode and flash the image using the command fastboot flash boot magisk_patched-[random_string].img, followed by fastboot [reboot](/page/Reboot). If the device prompts for environment fixes upon reboot, complete them within the Magisk app.[9]
For modern Android devices without a traditional ramdisk in the boot partition, such as Google Pixel phones running Android 12 and later, the process adapts by patching init_boot.img instead of boot.img. The steps remain similar: extract init_boot.img from the factory image, patch it via the Magisk app, and flash using fastboot flash init_boot magisk_patched-[random_string].img. Starting with Magisk v30.3, support extends to devices utilizing the vendor_boot partition, allowing patching and installation into this partition for enhanced compatibility with advanced boot configurations introduced in recent Android versions.[9][10] Custom recovery methods, like flashing via TWRP, are deprecated in favor of this patching approach for better reliability.[9]
After installation, verify the setup by launching the Magisk app, which displays the root status and confirms successful integration. Initial configuration includes granting necessary superuser permissions to the app and optionally setting up the DenyList to hide root access from banking or other sensitive applications, ensuring compatibility with SafetyNet or Play Integrity checks.[9]
To uninstall Magisk, users can utilize the built-in uninstaller within the app, which restores the stock boot environment and removes root privileges. Alternatively, flash the original stock boot.img or init_boot.img via fastboot, or download the Magisk APK, rename it to uninstall.zip, and flash it through fastboot or recovery if accessible. This reverts the device to its unrooted state without additional modifications.[9]
Device-specific considerations apply for optimal results. On Samsung Galaxy devices, patch the AP_[model].tar.md5 file from the firmware using the Magisk app's "Patch a File" option, then flash the resulting magisk_patched.tar via the Odin tool; this process irrevocably trips the Knox warranty bit and often requires wiping user data. Google Pixel devices benefit from streamlined support, with official factory images readily available for extracting and patching init_boot.img directly via fastboot, minimizing compatibility issues. For devices lacking a boot ramdisk entirely, Magisk installs into the recovery partition, bootable via specific key combinations during startup.[9]
Systemless Rooting Process
Magisk achieves systemless root access by integrating into the Android boot process without modifying the system partition. During installation, the boot image (boot.img) is patched to replace the stock ramdisk's init with magiskinit, a custom initializer developed by Magisk. Upon device boot, magiskinit detects the presence of Magisk and orchestrates early-stage modifications, such as loading overlays and preparing the environment for runtime operations, ensuring that root functionality activates seamlessly before the full system initializes. This bootstage integration maintains the integrity of the original partitions, allowing over-the-air (OTA) updates to proceed without conflicts.[1] At runtime, Magisk employs the Magic Mount mechanism to apply modifications non-destructively. This system leverages overlayfs on kernels that support it or falls back to bind mounts to superimpose altered files and directories over read-only partitions like /system. For instance, changes to system files are stored in a separate, modifiable location and transparently overlaid, presenting the illusion of a modified system to applications while leaving the underlying partition untouched. The root daemon, magiskd, operates as a persistent background service post-boot, intercepting superuser (su) requests and delegating them to the MagiskSU binary, which enforces process isolation and authorization policies to grant elevated privileges only to approved applications.[1][11][3] Introduced in Magisk version 24, Zygisk enhances the runtime mechanics by injecting Magisk's code directly into the Zygote process, the parent of all Android application processes. This allows for granular, per-app modifications and root hiding without propagating root exposure across the entire system, enabling modules to execute targeted code in isolated contexts. Security enhancements further bolster this framework; starting with version 30, MagiskSU includes options to restrict Linux capabilities for processes running as uid=0 (root), mitigating potential exploits by limiting privileges like network access or file system manipulations even under superuser mode. Additionally, Magisk supports the new sepolicy binary format debuted in Android 16's QPR2, ensuring compatibility with updated SELinux policies for refined access controls.[2][12] In contrast to traditional rooting methods, which typically remount /system as read-write and directly edit files—triggering detection by integrity checks in services like Google Play Integrity—Magisk's systemless approach evades such scrutiny by operating entirely in user space and memory. This preserves OTA eligibility and reduces the risk of bricking devices during updates, as no persistent changes are made to protected partitions.[1][10]Module and Extension System
Magisk's module and extension system provides a flexible framework for users to add custom functionalities to rooted Android devices without permanently modifying the system partition. Modules are packaged as ZIP archives that adhere to a specific directory structure, enabling seamless integration during the boot process. This architecture leverages Magisk's overlay filesystem to apply changes dynamically, preserving the integrity of the original ROM.[2] At the heart of each module is themodule.prop file, a properties file containing essential metadata such as the module ID, name, version (including versionCode), author, description, and an optional update JSON URL for automated updates. Supporting files include the system directory, whose contents are overlaid onto the /system partition unless disabled; system.prop for injecting custom system properties; and executable scripts like post-fs-data.[sh](/page/.sh), which runs early in the boot sequence after filesystem data is mounted, and service.[sh](/page/.sh), which executes later in the late-start service phase. Additional optional components encompass sepolicy.rule for custom SELinux policies, uninstall.[sh](/page/.sh) for cleanup on removal, and a zygisk directory for native libraries in Zygisk-enabled modules. Modules are stored as folders in /data/adb/modules, identified by their unique ID, with flag files like disable or remove controlling their activation status.[2]
Installation occurs exclusively through the Magisk app, where users select a compatible ZIP file—structured with an update-binary script (typically module_installer.sh) and a minimal updater-script marked #MAGISK—and flash it directly. The installer extracts the module to /data/adb/modules, sets appropriate permissions using functions like set_perm, and optionally runs a customize.sh script for advanced setup. During subsequent boots, Magisk mounts the module's overlays, ensuring modifications take effect systemlessly. This process supports variables such as MODPATH (module installation path) and MAGISK_VER for compatibility checks.[2]
Magisk categorizes modules into types based on their integration method: standard modules primarily use file-based overlays from the system folder to replace or add system resources; Zygisk modules deploy shared object files (e.g., .so libraries) in the zygisk directory to inject code into Zygote-forked app processes, enabling runtime modifications without altering binaries; and systemless hosts, such as those for the Xposed framework, facilitate compatibility layers for legacy or advanced extensions. Zygisk, introduced as a core feature, serves as the enabler for these injection-based modules, tying into Magisk's rooting process for process-level access.[2][13]
A prominent community-hosted Magisk modules repository, hosted on GitHub under the Magisk-Modules-Repo organization, serves as the primary distribution hub for verified and community-contributed modules, allowing developers to submit and maintain their packages. Notable examples include AdAway, a DNS-based ad blocker that overlays a customized hosts file to filter advertisements at the network level, and Viper4Android, an audio processing module that injects effects into the media pipeline for enhanced sound customization.[14]
With the release of Magisk v24.0 in January 2022, the legacy MagiskHide feature—which previously handled root concealment—was fully deprecated and removed to streamline the codebase and address evolving detection methods. It was succeeded by the integrated DenyList mechanism, configurable via the Magisk app to selectively exclude apps from root access and module visibility. For more robust hiding against sophisticated detections, the community module Shamiko—a Zygisk-based tool developed by the LSPosed team—extends DenyList functionality by masking Magisk's presence, Zygisk itself, and other modules at the process level.[10][15]
Users manage modules directly in the Magisk app, where they can toggle enable/disable states (via the disable flag), monitor installation status, and receive automatic update notifications if a module's module.prop specifies a valid JSON endpoint. The app also handles conflict resolution, such as prioritizing overlays or alerting on incompatible modules during boot or installation, ensuring stable operation across the module ecosystem.[2]