Can carrierToken property of CTSubscriberInfo be used to detect SIM Swap?

I am doing some R&D to detect whether we can detect sim swap in the phone. From my tests it looks like this property returns different values for different SIM cards. Will there be any issues using this API to detect SIM card change?


Here is the sample code


let sub = CTSubscriberInfo.subscriber()

if let token = sub.carrierToken {

let carrierToken:NSString? = NSString(data: token, encoding: NSUTF8StringEncoding)

print(carrierToken)

}

Replies

The carrier token is not intended to be used as a mechanism to detect SIM changes. Rather, it is intended to be used by carriers for their own authentication schemes. Unless you’re working on behalf of a carrier, I recommend you steer clear of it.

Two points:

  • Just FYI, on the devices here in my office the

    carrierToken
    property is always nil.
  • The format of the carrier token is not documented; you cannot, for example, assume that it’s a UTF-8 string, as you do in the code you posted.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

thank you. Do you have any recommendations on how to detect sim swap?

Do you have any recommendations on how to detect sim swap?

If you care about carrier changes (that is, the user has inserted a SIM from a new carrier), you can use CTTelephonyNetworkInfo’s

subscriberCellularProvider
property to determine the user’s current carrier and
subscriberCellularProviderDidUpdateNotifier
to learn about changes.

OTOH, if you care about the user changing between two different SIMs from the same carrier, AFAIK there’s no supported way to detect that.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"