Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

The other day I tried to withdraw some cash from an ATM in a hurry and punched in a wrong pin. I realized that only when I hit the "ok" button, but to my surprise the ATM did not complain. It showed the usual menu, asking me to select an operation. It's only when I selected withdrawal I was prompted that the pin is incorrect, and asked to re-enter. Which I did and received the cash.

Why do ATMs allow entering any garbage for a PIN, selecting an operation and only then complain?

EDIT: to add more information about some points discussed in answers and comments: the country where this happened is New Zealand. The card is a chip card which also happens to have a magnetic band, and I have no idea if the ATM can read the chip or not.

share|improve this question
9  
It must depend on your country: in some countries (USA for example), the ATM only reads the card's magnetic band, while in others, it really authenticate with the chip. If it uses the chip, it needs the correct pin. You can sometimes get a hint by looking at the ATM's behavior: if it spits back your card before asking for the pin, then it will not use the chip. –  T. Verron Jul 1 at 12:14
7  
@Verron: I'd be very surprised if it spit out the card before you enter the PIN (they sure don't do that here!). One of the "tasks" an ATM has to fulfill is confiscate the card if you fail entering the correct PIN 3 times. Which, of course, it can't do if it gives you back the card before prompting you. –  Damon Jul 1 at 15:02
3  
@Damon All ATMs I've used here (Chicago, US) in the past several years have been the type where you insert it, then it scans as you pull the card out, then you enter the PIN. We used to have ones that held your card (although I don't know about the confiscation feature), until around 4-5 years ago when I last remember using the old kind. –  Izkata Jul 1 at 16:43
1  
In India you get both kinds. In one you insert the card and do all operations. With the other type you insert, remove, and then enter PIN and continue up to 1 operation. For another operation, you will have to insert again and repeat the process. –  Rajib Jul 1 at 16:51
1  
@T.Verron: As far as the bank and large shops are concerned, yes. But a lot of small shops (at least in EU) still have a debit note system where you must present the phyiscal card and sign. Which of course works perfectly well with a stolen card and without PIN (I use mine like this all the time since I didn't remember the PIN when the bank changed it for no reason and the bank charges 15€ for sending you the PIN letter again, which I find outrageous). That's a likely reason ATMs are supposed to confiscate them, not all verifications are always done bank-side. –  Damon Jul 2 at 10:34

8 Answers 8

up vote 102 down vote accepted

This answer applies when the ATM uses the card's magnetic stripe, not when the card's chip is used.

The keyboard of an ATM is a completely separated device with special hardware security features (like self-destroying chips if someone tries to open it, etc.) because it's the bottleneck of the whole ATM security.

When you enter a pin, the ATM itself won't receive the PIN in plaintext, but rather get the PIN encrypted. When it sends a transaction to the main server, it cryptographically combines the encrypted PIN with the amount of money specified in the transaction to prevent attackers from modifying this amount.

If the ATM would have verified the PIN before the transaction (by sending it to the server), the specification of the amount of money couldn't be securely related to the knowledge of the PIN.

Therefore, the ATM can't verify whether the PIN is valid or not until it attempts to issue a transaction to the main bank servers (who know how to decrypt or otherwise verify the encrypted PIN).

share|improve this answer
9  
What about the case of chip cards, isn't PIN verified locally? Also, do you have any references for your described protocol? –  domen Jul 1 at 9:12
6  
@domen With such a small search space (10^4 possible PINs with most banks), there isn't any practical difference between saving the PIN itself and saving something that allows confirmation but not direct recovery (i.e. a hash): brute-forcing 10^4 possibilities offline is trivial. (Brute-forcing online is protected by the lock-after-three-failures behavior.) –  Gilles Jul 1 at 12:31
3  
@Gilles brute-forcing could be protected by a similar mechanism inside the chip. –  domen Jul 1 at 12:45
4  
One minor side note, the PIN COULD be verified before hand and sent again with transaction amount, but this would require more communication. It isn't like sending the encrypted PIN once prevents being able to send the PIN + transaction amount later. It still makes sense not to though as it makes it take longer to execute an attempt if they have to go through setting up the transaction as well. –  AJ Henderson Jul 1 at 12:53
10  
@jwg You're nitpicking. With that logic a harddisk or cd doesn't store my data either, since it applies some form of error coding. If the chip stores something from which you can compute the PIN, saying "it stores the PIN" is a perfectly fine abstraction. –  CodesInChaos Jul 1 at 14:17

Confirming the PIN when the card's magnetic stripe is used requires contacting the bank's server. Since this takes time (and took even more time back in the days of dialup), the ATM combines "verify the PIN" and "withdraw money" into a single contact.

The behavior might be different if the card has a chip and the ATM supports it.

share|improve this answer
5  
If there is a chip on the card, it can verify the pin locally. –  T. Verron Jul 1 at 12:17
1  
There is no industry-wide standard to perform just "verify PIN online" if chip isn't present, also what T Verron said, a lot of bad upvoted answers here –  bbozo Jul 1 at 16:26
1  
It's worth mentioning that the days of dialup are not over - standalone ATMs (like those in stores and restaurants) often still use landlines (sometimes cellular modems). –  Andrew Medico Jul 1 at 17:44
    
@T.Verron the chip on the card doesn't generally 'verify the pin'. It either accepts/denies a specific transaction in offline mode, or, in an ATM, signs a transaction before sending it to the bank - if it's an online transaction, then it defers all decisions to the central server. Both things are done after you have entered what you wish to do. –  Peteris Jul 2 at 8:56
    
@Peteris : I will check that next time I use an ATM here (in France). The order here is: insert the card, enter the pin, enter the operation, enter the amount, recover the card. I am pretty sure that if you enter a wrong pin, you are prompted for a new one immediately, but it is worth checking. –  T. Verron Jul 2 at 9:13

Most ATMs have to deal with 2 types of cards: old, magnetic ones and newer chip cards. Magnetic cards can't verify the PIN locally. Chip cards theoretically have this ability - but it doesn't mean that this functionality isn't limited.

The behavior you've described perfectly matches magnetic card flow. But - should chip card be verified using another path? There are 2 reasons it should not:

1) Implementing brand new second path costs money. ATM manufacturer surely want's to keep costs low and reuse as much of the code as possible.

2) Presenting consistent user experience. It's easy to imagine someone with 2 cards, one magnetic and one chip. Or a customer being issued new chip card to replace old magnetic-only one. There is no need to confuse users by providing them with 2 different paths. ATMs are scary enough.

/edit: Oh, I forgot one very important thing:

Local PIN on card can be out of date.

In many banks you can change card's PIN, but there is no way the card's chip can know about it. So if ATM would check PIN locally, it would reject correct, new PIN, but allow incorrect, old PIN. And ofc PIN check would succeed and transaction would fail.

share|improve this answer
1  
This is the only answer so far that isn't flawed in some way, +1 –  bbozo Jul 1 at 16:23
1  
This really depends on the country. There are countries where the pin check is almost mandatory, at least in shops. In these cases, if the bank offers you to change your pin, that should imply that they give you a new card with a new chip accepting the new pin (but I don't think the card number needs to be changed). –  T. Verron Jul 2 at 9:17
    
@T.Verron I think it's a misunderstanding. The original question was "why is the PIN checked during transaction but not when inserting card (offline)". Ofc PIN is always checked during transaction. –  Agent_L Jul 2 at 10:32
    
Sorry, it was a comment on "Local PIN on card can be out of date.". –  T. Verron Jul 2 at 11:36
    
Yeah. Local PIN on the chip card is updated only during transaction (which involves communication with central server). Because the card has no way of communication other than transaction terminal. Even cards with LCD (which claim to display your account balance) update only during transactions. Transactions in shops check PIN on the server, not locally on the card. (in some banks I got debit chip card with no PIN at all, I had to set it via WWW. Bank warned that first transaction may fail, but after that the PIN will be updated on the card.) –  Agent_L Jul 2 at 11:58

This is a question of policy in the ATM software. Many ATMs do in fact verify the PIN with the bank before allowing you to continue.

But the ATM itself doesn't know whether your PIN is correct. It has to ask the bank, and this takes time. How much time it takes will often determine whether or not the ATM will skip this step.

Each transaction between the ATM and the bank is separate, so each needs to be separately authenticated and therefore the PIN is validated with every transaction. This means from a practical standpoint, the ATM doesn't technically need to validate the PIN up front. It knows that an incorrect PIN will cause any other transaction to fail.

So there's a balance that needs to be struck, and each ATM may do this differently. Validating the PIN up front might be simpler for the user, but it might require extra time if the ATM doesn't have a dedicated line open to the bank. So imagine typing in your pin and waiting 20 seconds for the ATM to tell you if you did so correctly. To reduce the total time required, they can opt to skip that step.

share|improve this answer
1  
The one true answer. Everything else is just speculation based on potential knowledge of a single ATM's programming, or worse. Why would folks think they all work the same way? –  jmarkmurphy Jul 1 at 17:32

There is no reason to verify the pin at this stage, if anything it would be bad to.

  1. Waste of bandwidth/time to check as it most likely needs to be sent again with the transaction call anyway.

  2. If someone is attempting guess the pin, it takes considerably longer to find out if it is the correct pin. There is a higher chance of getting their face on a camera the longer they stand in front of the machine.

  3. There is no way to verify the pin against the card, it must involve the bank to verify otherwise you could do offline verification.
  4. This applies to both strip, and chip cards, the pin would never be stored in either of this places in any form.
share|improve this answer

user19426's answer is interesting-- I didn't know ATM keypads were implemented that way-- but it doesn't seem like it can be the whole explanation because there's still no reason you couldn't verify the PIN initially (without exposing its plaintext value), and then later use the PIN hash to sign the actual transaction. In the case of chip cards, this wouldn't even require any extra communication with the bank.

Anyone can privately verify the PIN for a chip card at any time, for example using the handheld authentication keypads European banks routinely mail out to their customers (I would guess the cards can disable themselves after a certain number of wrong attempts). An ATM that rejects a wrong PIN up front doesn't provide any attack vector that isn't available from an ATM that also requires you to attempt a transaction. Brute force is a non-issue since a 30-second delay just means it takes 90 seconds longer to hit the point where the machine confiscates the card.

As far as I can tell, there's only one security implication to not verifying the PIN upfront. If I put your stolen card into an ATM, and enter what I think is your PIN, and it tells me the PIN is wrong, then I walk away and the CCTV shows I'm guilty of trying to access your account. If I put in the PIN, and then ask for £200, the CCTV shows I'm guilty of trying to access your account and trying to steal £200 from it.

share|improve this answer
    
Local PIN check always is an attack vector. If you fail check PIN on the server, you get attempts count decreased on central server. After X attempts, the card is blocked worldwide. Even if a method of cloning chips or bypassing local disable is not known now, it may appear in the future. –  Agent_L Jul 1 at 15:48
    
That's a good point. Still, the behavior in question doesn't affect the extent to which ATMs can be used as PIN testing machines. It doesn't even affect the difficulty of creating a fake ATM to capture PINs, because no ATM verifies its own credentials (e.g. by showing your account balance) until a successful PIN entry. –  bobtato Jul 1 at 15:58
    
Perhaps chip cards don't answer to any PIN check requests. It's reasonable to require some kind of certificate. It's possible this feature is configured by the bank, so one cards can and other can't verify PIN. –  Agent_L Jul 1 at 16:07
1  
PIN hash is not used to generate client cryptogram –  bbozo Jul 1 at 16:21
    
If you have a card reader, chip and pin cards in the UK will verify the PIN locally straight away before going on to the next function. Don't know how it works with ATMs. Some shop card machines which don't require an online transaction accept the transaction straightaway. This is quite common with trains in the UK. –  Shaun McDonald Jul 5 at 0:42

This occurs because of two reasons:

  1. It is more secure and banks want to save on bandwidth.

    The bank usually stores your PIN in hashed form in its database. To be able to verify the PIN you've entered at the ATM, the ATM has to send to the bank server the hash of the PIN you've entered. These two hashes are then compared to check if the PIN you've entered is correct and only then, are you allowed to perform transactions. Of course, it is a rudimentary approach to security. There are things like replay and man-in-middle attacks to consider (for more info, read Challenge-response authentication).

    Instead of doing this, the bank can send your PIN together with the transaction itself, verifying your PIN and transaction at the same time. This saves bandwidth, and is potentially more secure since the attack window is decreased. For example, if the bank authenticates your session from the moment you've entered your PIN, it gives any potential attacker time to intercept the connection and make their own transaction(s).

    On the other hand, a proper secure connection is difficult to implement and bugs do occur. A one-off verification when you make a transaction allows the bank to identify you securely and saves bandwidth. Ultimately, it still depends on the ATM machine in question, since the bank can always verify your PIN at the start of each session and for each subsequent transaction.

  2. ATM cards do not store your PIN in the magnetic stripe. (Chip cards do.)

    In contrast to some answers, ATM cards cannot and will not store your PIN. The purpose of the ATM card is to achieve two factor authentication: something you have (the card) and something you know (the PIN). There have been instances where the ATM card has been breached by attackers.

    The ATM has to connect to the bank servers to verify you are who you say you are. ATM cards can and have been duplicated before (skimming). If the PIN could be verified off-line using only the data on the magnetic stripe on the ATM card, attackers could brute-force attack all 9999 possible PINs fairly rapidly with an off-line attack. So the system is designed to require contacting the bank for each guess, making it more difficult for attackers to steal your ATM card and withdraw all your money.

share|improve this answer
3  
Your 2nd point is false. EMV standard chip&pin cards do store the PIN and are able to verify it offline, though there are restrictions on the cases where they should do it; usually the card would be set to reject any offline ATM transactions (i.e., if the ATM 'says' that it won't/can't contact the bank but still wants a withdrawal) regardless of anything. –  Peteris Jul 2 at 9:01
    
Chip and pin cards will block transactions after 3 failed attempts. –  Shaun McDonald Jul 5 at 0:44
    
I think it's 10000 possible PINs. 0000 - 9999 –  Mew Jul 6 at 17:25

A popular scenario where this usually happens is, when the card you are using is from different bank and the ATM is of another bank.

Why?:

Different banks connect with each other through a country level national switch that connects different bank to one another. Just like VISA is an international switch there are national switch(es) for within country transactions.

While performing such a transaction, beside bandwidth there is also a particular amount that is being deducted on account of using that national switch, this amount is per transaction based.

So, instead of sending two transaction to that switch and eventually to that bank. Only one transaction is used in which entered PIN and the transactions details are sent. If the PIN is correct transaction is done if not it is declined.

The above scenario can also be used for same bank transactions but there won't be any financial benefits of it as its not saving any fee money but just a little bandwidth.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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