LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices



Reply
 
Search this Thread
Old 12-27-2012, 03:12 PM   #1
malloc
Member
 
Registered: Jul 2010
Posts: 111

Rep: Reputation: 4
SD card security


I recently thought my own 16 GiB microSD card was defective because I was unable to get it detected as a device in GNU/Linux.

I inserted the card into the card drive and did fdisk /dev/sdd, which is the device of my "USB SD reader" according to lsscsi. However I got the error message that no medium was found. I also got some error messages from dmesg, sorry I don't have the error messages any longer.

I tried the card in a different computer to rule out a bad reader, I even tried on a Windows computer. Windows didn't respond at all, and I couldn't find any error in the event log, Linux seems to be the only OS that even reported an error.

Then I inserted the card back into the smartphone I used it in, and apparently I had encrypted it a while back. Apparently the smartphone did something beyond just encrypting the data, but what? After some searching I found that it is probably this:

Quote:
Card password

A host device can lock an SD card using a password of up to 16 bytes, typically supplied by the user. A locked card interacts normally with the host device except that it rejects commands to read and write data. A locked card can be unlocked only by providing the same password. The host device can, after supplying the old password, specify a new password or disable locking. Without the password (typically, in the case that the user forgets the password), the host device can command the card to erase all the data on the card for future re-use (except card data under DRM), but there is no way to gain access to the existing data.
(from Wikipedia)

Some more searching tells me that the command is:

CMD42 LOCK_UNLOCK

However, how does one send raw commands to an SD card in GNU/Linux? Does SD cards use ATA or SCSI commands? I looked through hdparm and sdparm's manpages to no avail.

Even if I managed to send CMD42 to the card, what if I don't remember the password and just want to delete the data on it and use the card for something else? Surely there must be some way to just make fdisk allow me to create a filesystem so I can format it?

In the end I solved my problems by inserting the card into the original smartphone, which seems to be the only device I've tried that doesn't indicate the card is defective. I then selected "format" from the menu, which obviously does more than a simple format, because now the card is immediately detected in my GNU/Linux system and I can format it, interact with it, everything.

My question is in short: How does one deal with this from GNU/Linux, without having the original smartphone? How does one lock/unlock an SD card, and how does one simply unlock it and discard the data when the key is lost?

No, I'm not asking for how to "crack" the card or break the security, the latter case is just to remove whatever is on it, so it can be used again.
 
Old 12-27-2012, 05:51 PM   #2
jefro
Guru
 
Registered: Mar 2008
Posts: 12,082

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
Not a solution, just some ideas.

Look in a folder called mmcstore just to check if it is simple password.

I'd also see what fdisk can do with it. Some card readers need some extra lines for some of this security deal. Not all of the readers have that.

Last edited by jefro; 12-27-2012 at 05:54 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Facebook and Credit Card Security? Novatian General 5 11-05-2011 11:10 PM
[SOLVED] Best Wifi Card for WEP Wireless Security Testing? DoctorZeus Linux - Security 5 09-09-2011 09:24 PM
Recommendations for Camera Card for Security DVR (probably zoneminder) damgar Linux - Hardware 0 09-13-2010 10:30 PM
micro sd card built-in security? plebetan Linux - Hardware 2 06-09-2009 05:42 PM


All times are GMT -5. The time now is 09:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration