Force package installation with FUSE unless the package stores on device
The non-A/B package installation is subject to TOC/TOU flaw if the attacker can switch the package in the middle of installation. And the most pratical case is to store the package on an external device, e.g. a sdcard, and swap the device in the middle. To prevent that, we can adopt the same protection as used in sideloading a package with FUSE. Specifically, when we install the package with FUSE, we read the entire package to cryptographically verify its signature. The hash for each transfer block is recorded in the memory (TOC), and the subsequent reads (TOU) will be rejected upon dectecting a mismatch. This CL forces the package installation with FUSE when the package stays on a removable media. Bug: 136498130 Test: Run bin/recovery --update_package with various paths; and packages are installed from FUSE as expected Test: recovery_component_test - all passing Merged-In: Ibc9b095036a2fa624e8edf6c347ed4f12aef072f Change-Id: Ibc9b095036a2fa624e8edf6c347ed4f12aef072f
This commit is contained in:
@@ -69,3 +69,7 @@ bool verify_package_compatibility(ZipArchiveHandle package_zip);
|
||||
// Mandatory checks: ota-type, pre-device and serial number(if presents)
|
||||
// AB OTA specific checks: pre-build version, fingerprint, timestamp.
|
||||
int CheckPackageMetadata(const std::map<std::string, std::string>& metadata, OtaType ota_type);
|
||||
|
||||
// Ensures the path to the update package is mounted. Also set the |should_use_fuse| to true if the
|
||||
// package stays on a removable media.
|
||||
bool SetupPackageMount(const std::string& package_path, bool* should_use_fuse);
|
||||
|
||||
Reference in New Issue
Block a user