Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different readers return different value #36

Open
iBobik opened this issue May 27, 2019 · 11 comments
Open

Different readers return different value #36

iBobik opened this issue May 27, 2019 · 11 comments

Comments

@iBobik
Copy link

iBobik commented May 27, 2019

I tried to read tags with different readers, but it seems like decoding is reader-specific.

This two values are the same tag, but different reader:
7384CF
8C7B30

For both readers it prints W26 reader type.

Is there some way how to recalculate it, so I can use different readers in one access system?

@jpliew
Copy link
Collaborator

jpliew commented May 27, 2019

Hi @iBobik ,
Please provide a screen capture from an oscilloscope for D0 and D1 for both readers. The screen should look like this.

D0 D1

An example of data captured, 10000100100111011100000110, after removing the leading and trailing parity, the data is 000010010011101110000011, and equals to 0x93B83.

From the image, I can then see how many 0 and how many 1 and compare with the two readers.

Some readers have different specifications, even though they send data in wiegand, but the way the data is organised might be different.

Hope this helps.

@jpliew
Copy link
Collaborator

jpliew commented Jul 19, 2019

@iBobik do you still need help? If not I will close this issue.

@iBobik
Copy link
Author

iBobik commented Jul 19, 2019 via email

@JohnMcLear
Copy link

JohnMcLear commented Aug 25, 2019

I can replicate this bug.

  1. Plug in a reader, scan Mifare enabled card that has secure element (IE Mifare enabled P5/6//SLE77/78)
  2. Get ID
  3. Unplug Wiegand reader ~~~~ Don't restart usage logic or reload module / library etc.
  4. Plug in different Wiegand reader
  5. Scan same card. You will notice a different ID.

First scan will be Mifare ID (4 bytes)

Second scan will be non-Mifare ID (one assumes ~NTAG ID) which is longer in length (Documented as 7 but displays as 5).

To add to this, this library completely fails to scan UID or a non-Mifare enabled tag. While this is probably a separate issue it is something that needs documenting clearly in the README to ensure users who have non Mifare enabled Secure Element based cards (IE P5,6,77,78 -- which make up a huge amount of cards in circulation) are supported.

The correct patch fix here is to query the SEID through an applet for a usable UID. The correct long term fix is to bring in support for additional cryptographicly signed methods for getting a UID IE something that returns UID (from SEID) after 3Des handshake. This may be out of scope for this library though as IMHO this library has a primary use case of just returning UID and supporting any logic provided by third party smart card applets may be on a per applet basis.

So to summarize:

  1. This library fails to consistently gather the correct UID of any Mifare enabled tag should the Wiegand connected device be changed (I didn't check power drops or reconnecting same device).
  2. This library fails to gather the correct UID of some cards in circulation at current (namely smart cards without Mifare support)

Thanks to the author for his work so far and ongoing, I hope we can prioritise these fixes because IMHO they are quite critical to a lot of use cases currently consuming this library.

@jpliew If you want a proxmark dump I can probably get one but it might take me a month or so, it's likely you can replicate this bug much quicker by following the above steps <3

@jpliew
Copy link
Collaborator

jpliew commented Aug 25, 2019

Hey @JohnMcLear,

Thanks for your comment.

I am actually a bit confused here.

This library only reads wiegand data, it is not aware of what card being scanned. The card reader reads the card, process the ID and then send the value out as wiegand pulses.

It is the responsibility of the card reader to negotiate the RF part of the protocol with the card being scanned.

Hope this clears up the confusion.

Cheers
JP

@JohnMcLear
Copy link

JohnMcLear commented Aug 26, 2019

I commented here but including copy/paste here.

#40

@jpliew Oh. So the wiegand device is the limitation, very interesting and this would explain why certain readers read different values from the same card. Wow, what a fucked up situation to be in!

So TLDR; if you use Wiegand, you can't be consistent w/ UIDs if you use different makes/models of readers because the Wiegand logic implemented changes between devices (Despite being a standardized protocol [citation needed]).

This has to be flagged as "wont fix" because you can't fix. Basically the only fix here is for whoever consumes this software to ensure that the same exact make/model/software version of the Wiegand device is used upon replacing a reader, anything else might return a different value :(

The crux of the problem is due to Wiegand protocol being ?improperly? implemented on the reader

@iBobik
Copy link
Author

iBobik commented Aug 26, 2019 via email

@jpliew
Copy link
Collaborator

jpliew commented Aug 26, 2019

Before we go nuts over the this, it is better to checkout the specification of the card readers. As far I as know, there are card readers that will be able to be reconfigured for different types of data.

In this industry, the card readers (mostly high end type) has to be reprogrammed to suit the different systems use to ensure consistency.

@JohnMcLear
Copy link

JohnMcLear commented Aug 27, 2019 via email

@jpliew
Copy link
Collaborator

jpliew commented Sep 8, 2019

@iBobik I double check your data again and I can confirm that when you switched over the reader, the D0 and D1 are swapped.

7384CF
8C7B30

these values are NOT of each other, see binary data below

011100111000010011001111
100011000111101100110000

So your two readers producing the same data.

@jpliew jpliew added the question label Sep 8, 2019
@iBobik
Copy link
Author

iBobik commented Sep 8, 2019 via email

@jpliew jpliew added the solved label Sep 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants