
• Literally a container of encryption keys
• Used to decrypt protected data
• (Also used for syncing and for remote unlock)
• Lock: delete in-memory bag
• Unlock: decrypt copy with passcode and load
into memory
• MDM sends “Clear Passcode”
• Device loads unlocked keybag
• But doesn’t set “keybag in memory” flag
–(Note: Inference. I don’t really know how it works)
• User sets new passcode and locks
• Device looks locked...but....
• ...device never clears in memory keybag
• SO DEVICE NOT COMPLETELY LOCKED
The keybag contains keys used to decrypt data on the device stored
with the various protection classes, for both files and keychain entries.
For example, data marked as "ProtectionComplete" is encrypted
whenever the device is locked. The key to decrypt this data is stored in
the keybag.
When you lock the device, the unencrypted keybag in memory is
deleted, which means the device no longer has access to keys for the
protected data. They simply don't exist in memory. So the device can no
longer access those protected files.
When you unlock the device, an encrypted copy of the keybag is
decrypted using the passcode, and loaded into memory, restoring the
keys for current use.
I don't know exactly how this bug works, but my supposition is this:
There's some flag that indicates that an unlocked keybag is currently
loaded into memory. When you unlock a device, and it decrypts the
keybag, this flag is set. Then, when you lock it again, the operating
system looks at that flag. If it's set, then it knows there's a keybag in
memory that needs to be deleted, and so it clears it.
It appears that this flag isn't set when the keybag in memory was loaded
through the MDM "ClearPasscode" command. So the device doesn't
even realize that the keybag is in memory, so it never takes steps to
clear it. Which means the keys remain available, and operations which
don't require direct user access (the screen is still locked) will succeed
even for what should be protected data.
Comentarios a estos manuales