Samsung Pay:
Tokenized Numbers,Flaws and Issues
Salvador Mendoza
Twitter: @Netxing
Salvador_m_g@msn.com

About MeSalvador Mendoza● Researchero Android apps and tokenization mechanisms.
● College student
o A. S. Computer Science Degreeo Computer Network Administration Certificate
o Computer Programming Specialist Certificate

Agenda● Terminology● Tokenized numbers● Numbers and analyzing a token● MST and NFC protocols● Fragile tokenized process and storage● Possible attacks● JamPay toolTerminology● NFC: Near Field Communication● MST: Magnetic Secure Transmission● VST: Visa Token Service● Tokenized numbers: A process where the primary account number (PAN) is
replaced with a surrogate value = Token.
● Token: An authorized voucher to interchange for goods or service.
● TSP: Token Service Provider● PAN: Primary Account Number

Analyzing Tokenized Numbers (Token)%4012300001234567^21041010647020079616?;
4012300001234567^21041010647020079616?
~4012300001234567^21041010647020079616?
% = Start sentinel for first track^ = Separator? = End sentinel for every track; = Start sentinel for second track~ = Start sentinel for third track
A tokenized number follows exactly the same format of IATA/ABA; emulating perfectly aswiping physical card.

Analyzing a Track
Second track ;4012300001234567^21041010647020079616?
The first 16 digits are the new assigned CC number: 4012300001234567
401230-000-1234567

40123000001234567

New CC numberPrivate BIN #Never change, fromoriginal CC

Still
researchingAnalyzing a Track
Second track = ;4012300001234567^21041010647020079616?
The last 20 digits are the token’s heart: 21041010647020079616
2104-1010647020079616

Token’s heart.

21/04

101New expiration Service code:date.
1: Available forinternational
interchange.
0: Transactions areauthorized
following thenormal rules.
1: No restrictions.

064702-0079-616

064702: It handles transaction’s
range/CVV role.
0079: Transaction’s id, increase+1 in each transaction.
616: Random numbers, to fill
IATA/ABA format, generated froma cryptogram/array method.

NFC/MST offline/online mode
Without internet; did not change the middle counter%4012300001234567^2104101082000(constant)0216242?
%4012300001234567^21041010820000217826?
%4012300001234567^21041010820000218380?
[…]
With internet, the middle counter increased +1:%4012300001234567^21041010820000233969?
4012300001234567^21041010820000234196?
%4012300001234567^21041010820010235585? ← +1%

Token Phases●Active: Normal status after generated.
●Pending: Waiting for TSP’s response.
●Disposed: Destroyed token.
●Enrolled: Registered token.
●Expired: Became invalid after period of time.
●Suspended_provision: Valid PAN, requesting more info.
●Suspended: VST will decline the transaction with asuspended token.

Updating Token Status//SAMPLE REQUEST URL
https://sandbox.api.visa.com/vts/provisionedTokens/{vProvisionedTokenID}/suspend?apikey={apikey}// Header
content-type: application/jsonx-pay-token: {generated from request data}// Body{"updateReason": {"reasonCode": "CUSTOMER_CONFIRMED","reasonDesc": "Customer called"}}// SAMPLE RESPONSE// Body{}
Source: Visa Developer Center

Files Structure
Databases > 20

Directories/files

vasdata.db, suggestions.db, mc_enc.db/system/csc/sales_code.dat, SPayLogs/spay.db, spayEuFw.db, PlccCardData_enc.db

B1.dat, B2.dat, pf.log, /dev/mst_ctrl

membership.db, image_disk_cache.db, loyaltyData.
db/efs/prov_data/plcc_pay/plcc_pay_enc.dat

transit.db, GiftCardData.db, personalcard.db/efs/prov_data/plcc_pay/plcc_pay_sign.dat

CERT.db, MyAddressInfoDB.db, serverCertData.db/sdcard/dstk/conf/rootcaoper.dergtm_urls.db, statistics.db, mc_enc.db/efs/pfw_data, /efs/prov_data/pfw_data

spayfw_enc.db, collector_enc.db, cbp_jan_enc.db/sys/class/mstldo/mst_drv/transmit… many more

cbp_jan_enc.db
CREATE TABLE tbl_enhanced_token_info (_id INTEGER PRIMARY KEY
AUTOINCREMENT, vPanEnrollmentID TEXT, vProvisionedTokenID
TEXT, token_requester_id TEXT, encryption_metadata TEXT, tokenStatus
TEXT, payment_instrument_last4 TEXT,
payment_instrument_expiration_month TEXT,
payment_instrument_expiration_year TEXT, token_expirationDate_monthTEXT, token_expirationDate_year TEXT, appPrgrmID TEXT, static_params...
https://sandbox.api.visa.com/vts/provisionedTokens/{vProvisionedTokenID}/suspend?apikey={apikey}

Flaws and Issues● paramString = LFWrapper.encrypt("OverseaMstSeq", paramString);● bool1 = b.edit().putString(paramString, LFWrapper.encrypt("PropertyUtil", null)).commit();● String str = LFWrapper.encrypt("tui_lfw_seed", Integer.toString(paramInt));

Flaws and Issues●●Token expiration date is in blank.
ivdRetryExpiryTime implements timestamp format.

●If Samsung Pay generated a token, but it is not used tomake a purchase, that token still active/alive.

Attacks
Different scenarios:● Social engineering (Video)● Jamming MST signal (video/tool)● Reversing the encrypt/decrypt function● Guessing the next token

Social Engineeringhttps://www.youtube.com/watch?v=QMR2JiH_ymU

JamPay
https://www.youtube.com/watch?v=CujkEaemdyEEncrypt/Decrypt Functions

Guessing a Token?

Samsung Pay in Mexico?
https://www.youtube.com/watch?v=EphR18sSjgA

We did it first: Thanks @Sabasacustivo

Greetz, Hugs & Stuff
Samy Kamkar (@samykamkar)
Pedro Joaquin (@_hkm)
Andres Sabas (@Sabasacustico)
Luis Colunga (@sinnet3000)
RMHT (raza-mexicana.org)
The Extra’s mom

Questions?
Thank you!
Salvador Mendoza
Twitter: @Netxing
Salvador_m_g@msn.com

Black Hat Sound Bytes● Samsung Pay has some levels of security, but it is a fact that
could be a target for malicious attacks.
● Samsung Pay has some limitations in the tokenization
process which could affect customers’ security.
● Finally, tokens generated by Samsung Pay could be used inanother hardware.
Salvador Mendoza (@Netxing)