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

Add various GETDATA commands to extract GlobalPlatform metadata (atop of CPLC) #203

Open
petrs opened this issue Feb 29, 2020 · 0 comments

Comments

@petrs
Copy link
Member

petrs commented Feb 29, 2020

Add collection and parsing of GlobalPlatform information same as the GlobalPlatformPro tool.
GlobalPlatformPro issues and parses following commands:

80CA0066 00 GET DATA(Card Data)
80CA0067 00 GET DATA(Card Capabilities)
80CA00E0 00 GET DATA(Key Info Template)
80CA0042 00 GET DATA(IIN)
80CA0045 00 GET DATA(CIN)

Out of these, following commands are meaningful with GlobalPlatform-related info:
80CA0066 00 GET DATA(Card Data)
80CA0067 00 GET DATA(Card Capabilities)

GPro performs parsing in GPData.java file, additional dependencies are required.

Example output from GPPro:

[TRACE] GPData - GET DATA(IIN)
A>> T=1 (4+0000) 80CA0042 00
A<< (0003+2) (16ms) 420100 9000
IIN: 420100
[TRACE] GPData - GET DATA(CIN)
A>> T=1 (4+0000) 80CA0045 00
A<< (0010+2) (16ms) 45080000000000000000 9000
CIN: 45080000000000000000
Card Data:
[TRACE] GPData - GET DATA(Card Data)
A>> T=1 (4+0000) 80CA0066 00
A<< (0065+2) (23ms) 663F733D06072A864886FC6B01600C060A2A864886FC6B02020101630906072A864886FC6B03640B06092A864886FC6B040255660C060A2B060104012A026E0102 9000
[TRACE] GPData -  [66]
[TRACE] GPData -      [73]
[TRACE] GPData -          [06] 2A864886FC6B01
[TRACE] GPData -          [60]
[TRACE] GPData -              [06] 2A864886FC6B02020101
[TRACE] GPData -          [63]
[TRACE] GPData -              [06] 2A864886FC6B03
[TRACE] GPData -          [64]
[TRACE] GPData -              [06] 2A864886FC6B040255
[TRACE] GPData -          [66]
[TRACE] GPData -              [06] 2B060104012A026E0102
Tag 6: 1.2.840.114283.1
-> Global Platform card
Tag 60: 1.2.840.114283.2.2.1.1
-> GP Version: 2.1.1
Tag 63: 1.2.840.114283.3
Tag 64: 1.2.840.114283.4.2.85
-> GP SCP02 i=55
Tag 66: 1.3.6.1.4.1.42.2.110.1.2
-> JavaCard v2
Card Capabilities:
[TRACE] GPData - GET DATA(Card Capabilities)
A>> T=1 (4+0000) 80CA0067 00
A<< (0060+2) (20ms) 673A6738A006800102810155A00A8001038102001082010781039EFE8082031E03008301028504010208408602040887040102084088050102030405 9000
[WARN] GPData - Bogus data detected, fixing double tag
[TRACE] GPData -  [67]
[TRACE] GPData -      [A0]
[TRACE] GPData -          [80] 02
[TRACE] GPData -          [81] 55
[TRACE] GPData -      [A0]
[TRACE] GPData -          [80] 03
[TRACE] GPData -          [81] 0010
[TRACE] GPData -          [82] 07
[TRACE] GPData -      [81] 9EFE80
[TRACE] GPData -      [82] 1E0300
[TRACE] GPData -      [83] 02
[TRACE] GPData -      [85] 01020840
[TRACE] GPData -      [86] 0408
[TRACE] GPData -      [87] 01020840
[TRACE] GPData -      [88] 0102030405
Supports: SCP02 i=55
Supports: SCP03 i=00 i=10 with AES-128 AES-196 AES-256
Supported DOM privileges: SecurityDomain, CardLock, CardTerminate, CardReset, CVMManagement, TrustedPath, AuthorizedManagement, TokenVerification, GlobalDelete, GlobalLock, GlobalRegistry, FinalApplication, ReceiptGeneration
Supported APP privileges: CardLock, CardTerminate, CardReset, CVMManagement, FinalApplication, GlobalService
Supported LFDB hash: 02
Supported Token Verification ciphers: 01020840
Supported Receipt Generation ciphers: 0408
Supported DAP Verification ciphers: 01020840
Supported ECC Key Parameters: 0102030405
[TRACE] GPData - GET DATA(Key Info Template)
A>> T=1 (4+0000) 80CA00E0 00
A<< (0020+2) (21ms) E012C00401FF8010C00402FF8010C00403FF8010 9000
[TRACE] GPKeyInfo -  [E0]
[TRACE] GPKeyInfo -      [C0] 01FF8010
[TRACE] GPKeyInfo -      [C0] 02FF8010
[TRACE] GPKeyInfo -      [C0] 03FF8010
Version: 255 (0xFF) ID:   1 (0x01) type: DES3 length:  16
Version: 255 (0xFF) ID:   2 (0x02) type: DES3 length:  16
Version: 255 (0xFF) ID:   3 (0x03) type: DES3 length:  16
Key version suggests factory keys
SCardEndTransaction("Alcor Micro USB Smart Card Reader 0")
SCardDisconnect("Alcor Micro USB Smart Card Reader 0", true) tx:35/rx:235

NXP-specific command IDENTIFY
00A4040009A000000167413000FF00
80CA00FE02DF2800
source: https://blog.quarkslab.com/how-a-security-anomaly-was-accidentally-found-in-an-eal6-javacard.html

@petrs petrs changed the title Add various GETDATA commands to extract card metadata (atop of CPLC) Add various GETDATA commands to extract GlobalPlatform metadata (atop of CPLC) Jan 24, 2022
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

1 participant