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

Relaying a contact-based smart card with pcsc-relay NOT working NEED help #266

Open
0dayfrp opened this issue Feb 18, 2024 · 6 comments
Open

Comments

@0dayfrp
Copy link

0dayfrp commented Feb 18, 2024

Expected behavior.

Hello and Congrats for your hard work and dedication!!! (JUST SETTING UP THIS ALLREADY EXOSTED ME LOL)

When I hold phone to reader communication should start and exchange of apdu's should show on phone .

Actual behavior

ubuntu-22.04.3-desktop-amd64 on VBox everything installed and working.

In PC: ubuntu OMNIKEY 3121 working and detected.
In phone: Smart Card Emulator in S4 mini CM12.1 fail to read (reader: EMV Analytic Tool). Build in simulator is working.
Smart Card Reader in S4 mini CM12.1 connect but nothing happens. (I tested just to see if phone and pc are on the same network.)
Does the phone need to be rooted/magisk/exposed to work?
What phone is best used for this purpose?

Steps to reproduce

  1. install ubuntu-22.04.3-desktop-amd64 on VBox and vsmartcard
  2. start pcscd -f -d and pcsc-relay --emulator=vpcd and connect to phone
    3.no exchange happens

###Logs

https://gist.github.com/0dayfrp/7a21088b8fc85483003b3ded9807dc1d)

@frankmorgner
Copy link
Owner

could you elaborate on what you're tryping to do? what should be relayed where, what application should be able to use what card?

@0dayfrp
Copy link
Author

0dayfrp commented Feb 18, 2024

Thanks for quick answer, I'm trying to relay a contact emv card to a contactless reader ,I have used EMV Analytic Tool ( https://apkcombo.com/emv-analytic-tool/cz.pb.emv.analytic_tool/ )as a contactless reader to simulates a PoS which will send APDU commands.
I found that it was possible to extract Chip data with NFC technology. It is possible because both technologies shared the same application layer(APDU).
218640744-ff9cb22d-85c4-4928-99b8-a6f1fa3f7a12
This means that the EMV Chip Card does not need to have built-in NFC technology to be read it using NFC commands, which makes it quite interesting for research.

@frankmorgner
Copy link
Owner

Thanks for the explanation, I am aware of the protocol stack, but haven't tested EMV.

If I remember correctly, then this should work using the smart card emulator on the phone. There, you need to configure the remote virtual smart card instead of the built-in java card simulator. This explains, why you are connecting to a vicc, instead of using vpcd. Additionally, you want to use the "reversed" mode, where the card is waiting for an incoming connection. The latter is currently not possible with pcsc-relay (I believe), instead you should use vicc --reversed --type=relay. Now, vicc should wait for your app to connect, which will happen once you hold the phone near to the pos terminal simulator.

@0dayfrp
Copy link
Author

0dayfrp commented Feb 24, 2024

Hello and thanks again for your time. I have tried vicc --reversed --type=relay but could not get it to work instead I've switched to libnfc and after few attempts this is my results. This are 2 different PoS simulators,
lnfc c 212 error
lnfc c 235 error
Is this normal is this limitation(soft/hard) or is just code error.

@0dayfrp
Copy link
Author

0dayfrp commented Feb 27, 2024

@frankmorgner Any advice on what should I do next ? ( it keep me awake at night not knowing LOL :-) ). Thanks

@frankmorgner
Copy link
Owner

I pushed a new commit, which makes the error handling a little more relaxed by allowing no-ops (780cc7c), which may avoid the allocation error. However, I'm not sure what is going wrong inside libnfc.

Unfortunately, I cannot make any promises when/if I can reproduce any of the relay examples soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants