Project

General

Profile

Bug #1967

osmo-sim-auth: NoneType exception with AUTN generated from OP

Added by neels about 2 months ago. Updated about 2 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
03/07/2017
Due date:
% Done:

0%

Spec Reference:

Description

Take a brand new sysmoUSIM and attempt a UMTS authentication using osmo-sim-auth and a card reader.
The USIM database has an OPC that works, but on our sysmoUSIM, there's actually an OP.
Using the OP and KI from the card, the result is an exception without sensible error message; transcript follows.

two issues:
a) does osmo-auc-gen produce proper AUTN from OP? If not, create a new issue and fix it.
b) osmo-sim-auth should reply with a useful error message.

History

#1 Updated by neels about 2 months ago

transcript:

▶ ./sysmo-usim-tool.sjs1.py -a 94736127 -o
sysmoUSIM-SJS1 parameterization tool
Copyright (c)2017 Sysmocom s.f.m.c. GmbH

Initializing smartcard terminal...
 * Terminal: SCM Microsystems Inc. SCR 3310 [CCID Interface] 00 00
 * Protocol: 1

Reading OP/C value...
 * Initalizing...
 * Authenticating at card as administrator...
 * Reading...
 * Current OPc setting:
   OP: 0x0
   OP/OPc: $OP

Done!

▶ osmo-auc-gen -3 -a milenage -k 46F5C2A19D2CC186A971D5015D4CCDBF -O $OP
osmo-auc-gen (C) 2011-2012 by Harald Welte
This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY

WARNING: We're using really weak random numbers!

RAND:    c204ba0b40a32653156bf463d7a5276a
AUTN:    49be6a6a168500006d59b40ab98709e8
[...]

▶ ./osmo-sim-auth.py -r c204ba0b40a32653156bf463d7a5276a -a 49be6a6a168500006d59b40ab98709e8
[+] UICC AID found:
found [AID 1] 3GPP || USIM || (255, 255) || (255, 255) || (137, 7, 9, 0, 0)
[+] USIM AID selection succeeded

Testing USIM card with IMSI 901700000014702

UMTS Authentication
Traceback (most recent call last):
  File "./osmo-sim-auth.py", line 114, in <module>
    handle_usim(options, rand_bin, autn_bin)
  File "./osmo-sim-auth.py", line 44, in handle_usim
    if len(ret) == 1:
TypeError: object of type 'NoneType' has no len()

Adding some aggressive debug output, I get:

▶ ./osmo-sim-auth.py -r c204ba0b40a32653156bf463d7a5276a -a 49be6a6a168500006d59b40ab98709e8
[+] UICC AID found:
found [AID 1] 3GPP || USIM || (255, 255) || (255, 255) || (137, 7, 9, 0, 0)
[+] USIM AID selection succeeded

Testing USIM card with IMSI 901700000014702

UMTS Authentication
Authenticating with '3G'
[+] authentication error: ['INTERNAL AUTHENTICATE apdu: 00 88 00 81 22 10 C2 04 BA 0B 40 A3 26 53 15 6B F4 63 D7 A5 27 6A 10 49 BE 6A 6A 16 85 00 00 6D 59 B4 0A B9 87 09 E8', 'sw1, sw2: 98 62 - undefined status', (152, 98), []]
ret = None
Traceback (most recent call last):
  File "./osmo-sim-auth.py", line 115, in <module>
    handle_usim(options, rand_bin, autn_bin)
  File "./osmo-sim-auth.py", line 45, in handle_usim
    if len(ret) == 1:
TypeError: object of type 'NoneType' has no len()

Also available in: Atom PDF