Drive-Trust-Alliance / sedutil

DTA sedutil Self encrypting drive software
610 stars 236 forks source link

[NVMe Samsung PM961 or 960 EVO OEM] is not detected and PBA does't find it. #155

Closed alexisfrjp closed 7 years ago

alexisfrjp commented 7 years ago

Hi guys, I open a new issue for my case not to disturb current conversations.

I have a Thinkpad T470s with the Samsung PM961 (I read somewhere it is the 960 EVO in the OEM version), it is supposed to be OPAL2.0.

1. Using Rescue

I flashed an usb drive with Rescue-1.12-nvmepba-docker.img.gz and I booted on it.

/dev/nvme0n1 OTHER SAMSUNG MZVLW512HMJP-000L7               6L7QCX*7 S359NX0J312***      
TPer function (0x0001)
    ACKNAK = N, ASYNC = N. BufferManagement = N, comIDManagement  = N, Streaming = Y, SYNC = Y
Locking function (0x0002)
    Locked = N, LockingEnabled = N, LockingSupported = Y, MBRDone = N, MBREnabled = N, MediaEncrypt = Y
Geometry function (0x0003)
    Align = Y, Alignment Granularity = 8 (4096), Logical Block size = 512, Lowest Aligned LBA = 0
DataStore function (0x0202)
    Max Tables = 9, Max Size Tables = 10485760, Table size alignment = 1
OPAL 2.0 function (0x0203)
    Base comID = 0x1004, Initial PIN = 0x0, Reverted PIN = 0x0, comIDs = 1
    Locking Admins = 4, Locking Users = 9, Range Crossing = N

TPer Properties: 
  MaxComPacketSize = 66048  MaxResponseComPacketSize = 66048
  MaxPacketSize = 66028  MaxIndTokenSize = 65540  MaxPackets = 1
  MaxSubpackets = 1  MaxMethods = 1  MaxAuthentications = 5
  MaxSessions = 1  MaxTransactionLimit = 1  DefSessionTimeout = 0

Host Properties: 
  MaxComPacketSize = 2048  MaxResponseComPacketSize = 2048
  MaxPacketSize = 2028  MaxIndTokenSize = 1992  MaxPackets = 1
  MaxSubpackets = 1  MaxMethods = 1

I didn't want to go further since the scan is supposed to have found my NVMe drive.

2. Using PBA

I flashed an usb drive with UEFI64_Release-1.12-nvmepba-docker.img.gz and I booted on it. It asks me to enter a pass phrase, I enter random pass phrase and then the laptop reboots 2sec later.

edit: I'll try with UEFI64_Debug-1.12-nvmepba-docker.img.gz

Is it the expected behavior ?

For now, I don't really care about S3 sleep, I always turn off my laptop.

This sedutil tool is a really great program if I can make it working. Good job all of you ! Thanks !

cristim commented 7 years ago

If the locking/unlocking works the drive should be locked before entering the password in the PBA, and unlocked after the PBA reboots the computer.

If you had an OS installed before first locking it, it should just boot when unlocked, otherwise you can boot from an USB stick after the PBA reboot and install the OS on the unlocked drive.

alexisfrjp commented 7 years ago

Hi cristim, Thank you for your reply. I didn't lock yet, I just want to know if my SSD is supported.

The wiki is pretty unclear, what does initialsetup (take ownership by setting an Admin password ?) What is the difference between enableMBR and locking a range ?

Before doing anything that can break my expensive drive, I like making clear the process. Especially because it's more professional and it's not so easy to find documentation.

DrEmpiricism commented 7 years ago

"SP" stands for Security Provider.

The LockingSP controls the data encryption and the locking/unlocking of LBA Ranges on the device. The AdminSP is the user (you) who authenticates to the LockingSP and retrieves the locking configurations.

As far as a Locking Range: There are Global Ranges and Local Ranges. Global Ranges encompass, for example, all partitions on a drive, while a Local Range can be isolated to a single partition on a drive. This basically allows for the Drive Owner/AdminSP to assign isolated read/write Ranges to anyone they desire while keeping other Ranges locked. And since each range has its own encryption key, each Range is as secure as the drive itself. That said, Local Ranges can only be unlocked by those users assigned to them. All locking is controlled exclusively by the AdminSP.

Non-enterprise software, or software like Sedutil, simply allows you to control the Global Range as the AdminSP since you have physical access to a drive. Some software like WinMagic (which I use both on my server and deployments), will allow for much more client granted authority by the AdminSP.

Enterprise software, on the other hand, allows for the aforementioned Local Range assignments as well as BandMaster0, EraseMaster, Administrator, Crypto-Officer, Master and User authorities to name just a few, and also deploy custom PBAs, biometric inclusion, 2-factor authentication, answer/response commands for drive access if a user forgets his/her password, and the list goes on. Such features as assigning specific users to their respective Local Range works well in NAS/SAN environments, but can also be done on a simple workstation system to assign unlocking access to a Global Range for a user who requires access to that device (though they're unable to lock the device or perform any cryptographic/firmware/TCG SET policies). This is fairly identical to the old ATA Enhanced Security feature that's still around where you have a Master and a User.

As the Drive Owner - the highest role in the Opal SSC - you have physical access to the drive. This allows you to attain SID Authority on the AdminSP which gives you you ability to lock and unlock your drive.

alexisfrjp commented 7 years ago

Thank you DrEmpiricism, it's more clear now and I read a lot on the TCG website, the Opal specification provides many options for the drive. Quite complete ! Your explanation should be in the wiki.

Another question, is it possible to backup everything in software in case we want to use the drive again quickly but still being able to unlock it if we remember the password some weeks later ? I guess it's not possible since the main key (MEK?!) is stored and not accessible.

alexisfrjp commented 7 years ago

I have installed and locked my drive with success but I've lost my grub boot. It continuously reboot on the PBA, I have to stop it by pressing a key, entering in the boot menu and I have only windows or Ubuntu. Only the windows boot option entry is working.

Should I change something in the PBA in order to boot from the UEFI partition ? (I have triple boot) Don't really know the bootflow used with the PBA.

DrEmpiricism commented 7 years ago

I don't understand entirely what your first post is asking. Backups are no problems on SEDs, specifically using the Opal SSC for its security protocol. Re-deploying your backups to a fresh drive, or to the same drive after it's just been formatted, will be no problems. Likewise, unlocking the drive on another devise is also no problem. Unlike ATA Enhanced Security passwords (HD passwords), Opal does not use any sort of keyboard scan-codes for the plaintext passwords, as these scan-codes often differ between machines.

MEK and DEK are synonymous with how SEDs function, as they both refer to the key used to do the actual encryption of that user data. The DEK is likewise encrypted by the KEK which is generated by your password upon initialization of the Opal SSC.

I personally have not used Sedutil on a multi-boot system, so I can't offer much from personal experience, but if you are booting into Grub, you want to load the Linux PBA regardless if Windows is on there or not.

alexisfrjp commented 7 years ago

I wasn't clear enough. The drive is locked, encrypted with a password. I don't remember the password, I might retrieve the password later, I don't want to loose my data then from a live usb I dd if=/dev/nvme0n1 of=image.img this will copy the encrypted drive to a binary format but there is no way to decrypt this image in software. I am pretty sure it's not even possible to re-deploy this image into a new drive. (since there is no way to backup the DEK, I guess there is a way to get the KEK generated from my password) Anyway, now it's more clear, I can go through the code and see what sedutil does. Thank you !

DrEmpiricism commented 7 years ago

Sorry for the delay in my reply. It's been a busy few weeks.

If your drive is locked and you forget the password and are unable to access the drive then yes, your data is completely undecipherable and will remain that way. Moreover, there are a few ways to dump the encrypted data. I have a very pricey DFL-SRP All-in-One USB 3.0 full data recovery equipment, and I've had some luck actually dumping the DEK blob and gaining access to a locked self-encrypting drive; however, the data is useless more of the time. On some drives, I have been able to dump the DEK blob and flash a tweaked firmware that will remove the locking range(s). Then I have reloaded the original DEK blob and after a power-cycle, the drive is not only completely unlocked but the data is decrypted (the DEK continues to encrypt/decrypt as before). Being able to do this depends on what security is being used to lock the device. If someone is using the TCG Opal SSC with key management, it's just not happening on Opal 2.0. Even business laptops that utilize true ATA security where TRUSTED_SEND and TRUSTED_RECEIVE commands are issued to the drive, as well as password salting that incorporates hash values and model numbers into it are extremely secure, and follow FIPS standards. ThinkPads do this (I have a T470s, too), as well as UEFI Dell Latitudes (I also have an E7470). With how these devices are specifically designed for encrypting hardware, their security is no joke.

alexisfrjp commented 7 years ago

Wow ! I didnt come here for a while, I've just seen the bookmark, opened it and I seen your reply " DrEmpiricism commented 2 minutes ago " if that is not amazing... lol

Don't worry, I didn't have time either, thank you for your useful explanation !

I see... it's really secure, not like a simple software encryption. That's good even if I don't need that much of security. (just want to be able to encrypt the whole drive in case of loss or theft)

I don't know why but now the UEFI is working very well. I turn on, enter the password, it reboots and display grub, as if it wasnt locked. I am very happy with that ! I can get my dual/triple boot without any problem with only one password.

Just if you have time, when I enter the pass phrase, it takes time to reboot. Is it because of sedutil/PBA/software or because of the OPAL hardware specification ? I read somewhere it's the normal OPAL implementation and it's more secure because it makes the brute force very slow since we need to wait some seconds between each try.

I am very happy that sedutil works in my T470s ! Don't know how it behaves when I'll get a dead sector or something like that tho. Recover may be more complicated or impossible.

r0m30 commented 7 years ago

The reboot is done by the PBA. UEFI doesn't have am MBR that you can load and jump into so "chain loading" in UEFI is much more complicated.

Im going to close this since you say you have it working.

maenpaa24 commented 7 years ago

Hi! I have almost the same problem that @alexis57 stated at the title of this thread but I can not see the answer here. Sedutil does see my samsung SAMSUNG MZVLW1T0HMLH-000L2 but it says that it is not opal compliant. However, as far as I know it is opal compliant, does anyone know how to fix this? Otherwise, how did you solve the problem stated in this thread? It may help me to solve mine.

Thank you.

r0m30 commented 7 years ago

I'm assuming you're using Windows. The simple answer is that the only NVMe ioctl that I have been able to get working so far is Identify so when the scan runs the basic drive info is all I can get. NVMe is fully supported in Linux so if you are a windows user you will need to set up the drive from the rescue system. See this wiki entry for instructions.

maenpaa24 commented 7 years ago

Oh! Sorry I forgot to tell you that I am using ubuntu 16.04. I have also boot the rescue image for 64bits from a pendrive and in both cases it says that it does not support opal, I mean the drive is detected in both cases (ubuntu and rescue img) but they always say that is not opal compliant. It is a lenovo miix 720. I think it must be that exactly this model of samsung pm961 mzvlw... is not opal compliant, but as far as I read on the internet it should be.

r0m30 commented 7 years ago

OEM drives can be tricky, the manufacture will drop features to shave a few dollars off the BOM. Looking at the Samsung site I don't see that they say OPAL, TCG or encryption on the page for your drive. They also don't list what the numbers after the dash mean. The only thing I can suggest is that if the laptop is easy to open you might have a look at the drive, if it's OPAL then it should have a 32 character PSID printed on the label.

maenpaa24 commented 7 years ago

Thank you very much for your support! I think I will return it and buy one which is guaranteed to be opal compliant by the manufacturer.

maenpaa24 commented 6 years ago

Hi @r0m30 ! I would like to ask you a question related to your latest answer in this forum. If an ssd has a PSID number on its label, does it mean that it is OPAL compliant? And if it is it will be OPAL 2, won't it? Because OPAL 1 does not support erasing the drive with the PSID number, does it? Thanks.

r0m30 commented 6 years ago

@maenpaa24 Unfortunatly the answer is not as simple as it should be. Some vendors added PSID support before it was finalized and they also backported the functionality to OPAL 1 drives and extended it to Enterprise drives as well.

oom-is commented 4 years ago

In case anyone comes to this (old, closed) issue report later and has similar questions to @maenpaa24 - I know of at least one drive (Seagate ST1000LM035) that has a PSID on the label but does not claim or contain TCG support for Opal/SED functions. This is apparently intentional - the drive DOES support "Seagate Secure Erase" and will allow the PSID to erase all data, but the drive does not actually provide TCG Opal functions to allow drive encryption, management/PBA, etc.

If you think you can buy a drive that has a PSID on the label and get TCG {Opal 2, Enterprise} support the answer is "definitely maybe".

brendanhoar commented 4 years ago

On the flip: if it doesn't have a PSID on the label, it's definitely not going to support TCG OPAL...and if appears to, run far far away.

[Also: <grumbles about the firmware running on the MSATA boards Samsung T3 and T5 USB 3.0 portable drives, in particular, the 2TB ones.>]