Apple Intelligence now features Image Playground, Genmoji, Writing Tools enhancements, seamless support for ChatGPT, and visual intelligence.

Apple Intelligence has also begun language expansion with localized English support for Australia, Canada, Ireland, New Zealand, South Africa, and the U.K. Learn more >

You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Diskutil eject does not 're-lock' Filevault encrypted volumes on external drive

Man documentation for diskutil...


http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/ man8/diskutil.8


... states that the diskutil eject command can be used to "re-lock" a corestorage volume that has been previously unlocked:


"To 're-lock' the volume, make it offline again by ejecting it, e.g. with diskutil eject."


I have an external hard drive with several Filevault 2 encrypted partitions (OSX 10.8.3) . Once a volume is unlocked using diskutil corestorage unlockVolume, when the volume is subsequently ejected using diskutil eject, it shows the disk as unlocked after ejecting. After ejecting, I can look with diskutil corestorage list and find:


| Encryption status: Unlocked


Indeed, after ejecting, the disk can be re-mounted and the files accessed without re-entering the Filevault password for the volume.


The only means I have for restoring the disk to the locked status is to restart the machine.


What is the correct way to "re-lock" a corestorage volume?


Below is the output for the drive using diskutil corestorage list after unlocking with diskutil corestorage unlockVolume and then ejecting with diskutil eject.



+-- Logical Volume Group ####

| =========================================================

| Name: ####

| Status: Online

| Size: 498058510336 B (498.1 GB)

| Free Space: 0 B (0 B)

| |

| +-< Physical Volume ####

| | ----------------------------------------------------

| | Index: 0

| | Disk: disk1s4

| | Status: Online

| | Size: 498058510336 B (498.1 GB)

| |

| +-> Logical Volume Family ####

| ----------------------------------------------------------

| Encryption Status: Unlocked

| Encryption Type: AES-XTS

| Conversion Status: Complete

| Conversion Direction: -none-

| Has Encrypted Extents: Yes

| Fully Secure: Yes

| Passphrase Required: Yes

| |

| +-> Logical Volume ####

| ---------------------------------------------------

| Disk: disk2

| Status: Online

| Size (Total): 497739735040 B (497.7 GB)

| Size (Converted): -none-

| Revertible: No

| LV Name: ####

| Volume Name: ####

| Content Hint: Apple_HFS

Mac mini, OS X Mountain Lion (10.8.3)

Posted on Apr 2, 2013 1:41 AM

Reply
25 replies

Apr 11, 2013 6:56 AM in response to MeMeMeMeMe

Whether or not the password is saved in the keychain is irrelevant to the lock status of the volume. The volume is unlocked when the key is in memory, and locked otherwise. Your diskutil output shows an unlocked volume, and I confirmed the behavior. That makes it even more important to secure a system that handles encrypted HFS data from local attack. At a minimum, the screen must be locked whenever you're away from the machine.

Apr 16, 2013 7:15 AM in response to MeMeMeMeMe

Bizarre. If there is no keychain entry for the volume then it should not automatically unlock if and when detected by the system (ie, the keychain password is quite relevant to the unlock status of an encrypted drive).


Since you do not have such a password in yoru keychain, if you eject and then disconnect the drive does it show a locked status if you then reconnect it? Additionally, if you try to directly mount the drive in Disk Utility does it automatically mount or does it require a password regardless of the unlock status designated in the corestorage volume list?

May 12, 2013 2:56 PM in response to Topher Kessler

Topher Kessler wrote:


Bizarre. If there is no keychain entry for the volume then it should not automatically unlock if and when detected by the system (ie, the keychain password is quite relevant to the unlock status of an encrypted drive).


Since you do not have such a password in yoru keychain, if you eject and then disconnect the drive does it show a locked status if you then reconnect it? Additionally, if you try to directly mount the drive in Disk Utility does it automatically mount or does it require a password regardless of the unlock status designated in the corestorage volume list?


It doesn't unlock automatically. What I'm saying is, if you unlock it once by manually entering the password (it is not in my keychain), then it is forever unlocked until the machine is rebooted. OSX documentation says that "diskutil eject" should re-lock the volume, but it doesn't. The volume can be re-mounted without re-entering the password (even though it is not in the keychain). The password must remain stored in memory somewhere even after the "diskutil eject" command is issued.


As I said in the original post, after issuing the "diskutil eject" command, the status of the drive still shows an unlocked status when running "diskutil corestorage list", even after the disk has been ejected.


The same behavior occurs if mount a locked disk and then unmount it using the graphical interface Disk Utility. No password stored in keychain. Manually enter the password, the disk mounts. Unmount the disk. It can be re-mounted from disk utility without entering the password a second time.


I tried logging out the user too. It doesn't matter. The only thing that re-locks the volume that I can discover is rebooting the computer.


This seems like a pretty big security hole for FileVault. Is Apple acknowledging this problem and working on a fix? How to bring it to their attention?

May 12, 2013 6:21 PM in response to Linc Davis

Linc Davis wrote:


Whether or not the password is saved in the keychain is irrelevant to the lock status of the volume. The volume is unlocked when the key is in memory, and locked otherwise. Your diskutil output shows an unlocked volume, and I confirmed the behavior. That makes it even more important to secure a system that handles encrypted HFS data from local attack. At a minimum, the screen must be locked whenever you're away from the machine.


I only have filevault enabled on my external drive.


You confirmed the behavior, but is yours an external or internal drive? Not sure it even matters. Could it be a problem with both?

May 23, 2013 10:15 AM in response to MeMeMeMeMe

This is a major issue. It's incredible to me that a) more people have not identified this problem and b) Apple is not saying anything about it.


Note that not only does `diskutil eject` not work as advertised, ejecting the volume in Finder also does not lock it. There appears to be absolutely not way, short of disconnecting the media (e.g., yanking the USB/FireWire/Thunderbolt cable or pulling the disk from the enclosure) of re-enabling encryption.


How is this okay? How did Apple let this happen? And why hasn't anyone else identified it?

Jun 9, 2013 5:23 AM in response to M. Anthony Aiello

M. Anthony Aiello wrote:


This is a major issue. It's incredible to me that a) more people have not identified this problem and b) Apple is not saying anything about it.


Note that not only does `diskutil eject` not work as advertised, ejecting the volume in Finder also does not lock it. There appears to be absolutely not way, short of disconnecting the media (e.g., yanking the USB/FireWire/Thunderbolt cable or pulling the disk from the enclosure) of re-enabling encryption.


How is this okay? How did Apple let this happen? And why hasn't anyone else identified it?


Maybe we're asking the wrong people. NSA? What do you think?

Jun 14, 2013 7:12 AM in response to MeMeMeMeMe

I'm having the same issue, but with an encrypted disk image, full of sensative financial docs. I tried encrypting an actual external drive and behaves the same as the DMG.


I'm not 100% certain, but I DON'T think Disk Utility used to behave this way, but rather actually DID relock encrypted volumes upon unmounting them. I'm not sure if Lion or Mountain Lion is responsible for the change in behavior, but I seriously doubt it's working as intended.


Apple needs to fix this before someone gets his identity stolen or worse, due to this gaping security hole and the false belief that encrypted volumes are actually secure in the current OSX + Disk Utility versions.

Nov 8, 2013 12:56 PM in response to fred724

Are you sure about that? That is not what is being reported by the other people here on this forum.


I wonder what the difference is between what you are doing and what other people are experiencing. Do your disks have more than one partition on them? I don't think this should make a difference, but I will check.


It seems implausible that Apple has not had the capabiity to fix this problem over such a long time period. I have to wonder if the NSA is preventing them from doing so. At the very least, they could update their diskutil corestorage man pages (e.g. man diskutil) to reflect what the actual behavior is, rather than having left it for over a year now giving people the impression that ejecting an encrypted disk provides security, when it doesn't.








Diskutil eject does not 're-lock' Filevault encrypted volumes on external drive

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.