I was just watching the BBC show Sherlock, S3E3: His Last Vow and I got to the part where John and Sherlock are breaking into the penthouse office. The technique Sherlock employs to get into the office is corrupting a standard magnetic keycard and relying on the fact that it would not read as the wrong card. This question is twofold because I haven't found an answer to either part in my research.

First: Magnetic keycards function by lining up a bunch of tiny iron magnets, polarized to be pointing either one way or the other (I'll just call them up and down) in a strip. This strip then encodes a sequence of ups and downs that is unique to the keycard and can be read by a card reader. There is a widely disputed question as to whether or not these magnetic strips can be corrupted by being near external magnetic fields, such as a phone. Assuming they can be corrupted in this way, what is the mechanism of corruption? What does it actually mean for a magstrip to be "corrupted"?

Second: This question relies strongly on the answer to the first and is more tied in with the show I was watching. If a keycard is corrupted, would a keycard reader read the card as corrupted or just as the wrong card? If I were to assume the simplest mechanism I can think of for corrupting a keycard, which would have the external magnetic field flip random bits in the sequence, it would seem that there would be no noticeable difference between a corrupted and a non-corrupted keycard.

One way there might exist a difference is if all keycards for a specific reader possessed a very similar sequence that only differed by a few bits for each card. Then a card could be considered corrupted if the sequence that should be common to each card was different. But then, why not just use a card from a completely different reader to get the same effect of swiping a corrupted card?

The only other explanation I can think of is that the corruption manifests itself in some other way that makes it obvious that there is in fact corruption of the magstrip.

Thanks to anyone who can offer me helpful resources or explanations.

  • $\begingroup$ It just needs a magnetic field that is stronger than the coercive field of the magnetic strip. A phone won't do much. But neodymium magnet can reorient the magnetization. $\endgroup$ – Pieter Mar 13 '18 at 18:58
  • 1
    $\begingroup$ I can attest to neodymium magnets messing up key-card strips, I have accidentally done this a number of times, especially with hotel key-cards that are frequently recoded. None of these times did the key-card reader allow me through. It would be a very insecure and stupid system allowing unreadable cards access... although it might make normal users happy and hence reduce customer complaints. $\endgroup$ – Anders Sandberg Mar 13 '18 at 20:04

Have you read the Wikipedia article about Magnetic Stripe cards? To (briefly) answer your question:

  1. Physically, the coercivity of a magnet is what measures that magnets ability to withstand external magnetic fields without becoming demagnetized (assuming a fully saturated magnet). According to wikipedia, that value is around 300 Oersteds (Oe) or 30 milli-Teslas (mT) for cheap magstripe cards. The values goes up to about 4 kOe / 400mT for 'hardened' magstripe cards. For reference, here is a table of various magnetic flux values taken from the internet: B According to this table, you would need something slightly stronger than a fridge magnet for a cheap magstripe card (like one used at a hotel) and a very strong magnet for hardened magstripe card (like a government id) to do any corrupting. I don't have the exact value for a cellular phone, but seeing as they transmit at the ~1 Watt level, their magnetic fields are miniscule.
  2. What is actually being corrupted when you coerce a magstripe card is.. well everything. Here is a picture of a magstripe with iron oxide powder used to show the encoding: magstripe iron filings The iron oxide powder clings to regions of high magnetic field flux. It doesn't indicate polarity. If you corrupt a magstripe with a big fat magnet, not only will you obliterate the bits but also the regular bit bracketing (see left of image) so chances are it won't even read. And if it did read, it would read all '0's.
  3. Even if it did manage to read after corruption, I can't imagine any modern mag-stripe protocol not including a checksum. With a checksum, a card reader could compare the checksum to what was read out on the magstripe and decide if the card was corrupted or just the wrong card.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.