The vulnerability is a path traversal issue (CWE-22) within the Mobile Verification Toolkit (MVT), originating from the direct use of the fileID field from an iOS backup's Manifest.db to construct filesystem paths. This fileID is device-controlled and can be manipulated by an attacker. The analysis of commit 2a3423d826f6453a28dc368f865632cacf02756a reveals that the developers patched this by adding validation to ensure the resolved file path is strictly within the intended parent directory, using Python's pathlib.Path.resolve() and is_relative_to() methods.
Two functions were identified as directly vulnerable:
-
Decryption.process_backup (src/mvt/ios/decrypt.py): This function is responsible for decrypting iOS backups. It was vulnerable to a file write path traversal because it used the unsanitized file_id to create both the source path for the encrypted file and the destination path for the decrypted output. An attacker could thereby write a file with controlled content to an arbitrary location on the analyst's machine, potentially leading to code execution.
-
IOSModule._get_backup_file_from_id (src/mvt/ios/modules/base.py): This is a utility function used by various analysis modules of the check-backup command. It was vulnerable to a file read path traversal. By crafting a malicious file_id, an attacker could trick MVT into reading and parsing arbitrary files from the analyst's filesystem, leading to information disclosure, assuming the file content was parsable by the specific MVT module.