Sending SIM SMS over MSC

Hello,

When connecting to 2G broadcasting, a subscriber shares information such as IMEI and IMSI during the “Identity Request” and “Identity Response” procedures. Additionally, I want to retrieve information from the SIM card via SMS. I managed to send a SIM SMS by making a few adjustments to the silent-sms structure in the MSC. However, because the TP-User data contains meaningless hex data, empty response is received from the user’s SIM card.

TP-PID: SIM Data Download
DCS: Coding (8-bit data), Class (2, SIM-specific message)
My question here is: What format should I use to make the data sent to the SIM cards meaningful? Could you share a few examples and any resources you recommend?

I also saw the osmocom-pysim repo. I don’t have any SIM card readers or programmable SIMs. I saw that the codes here are for programmable SIMs. So, can I find the format for the data to be sent to the SIM cards from the codes here? I only want to read informations from the SIM card.

Finally, I saw the C files for SIM cards under libosmocore>src>sim. Are the codes here used in another repo?

I think what you’re referring to is OTA transport for SIM cards?
You might want to watch Detailed workings of OTA for SIM/USIM/eUICC - media.ccc.de then.

1 Like

Thanks for reply.

I watched the link you provided. It points to the elements in the “Secured Packet Structure: Command” table that @laforge mentioned at the beginning of the video. I need to correctly fill out the “User Data” section in the image I uploaded. I’ll need more detailed sources for these elements. Do you have any resources or code examples you can recommend?

1 Like

Sorry for not reading your first message properly.
You’re not going to get anything useful from commercial SIM cards without having some way of authenticating yourself against the card (which you won’t have unless you’re the card issuer/network operator).

Thank you for the information @Manawyrm. I have one more question: Is it possible to get information from commercial SIMs with a programmable SIM?

That question doesn’t make much sense to me.
A commercial SIM is the same type of SIM as a “programmable” SIM.
The only difference is who has the admin/secret keys to it.

With a programmable SIM, it’ll be you.
With a commercial SIM, it’ll be your provider.

You will never get keys to the SIM of a commercial provider.
For your own SIM cards, you can pretty much do what you want :slight_smile:

2 Likes

Thank you for your answers. Have you tried a programmable SIM card before and would recommend it? My goal here is to enable remote OTA SMS access using OTA key materials. Is the sysmoISIM-SJA2 a suitable card? The osmo-pysim user manual uses this card to install applets.

Another question: Are the keys(KIK, KIC, KID) specific to the product model or are they separate for each card in the product model?

Thanks.

Edit: sysmoISIM-SJA2’s status is “Discontinued Products”, how about sysmoISIM-SJA5?

When buying sysmocom cards, you’ll receive a file with various keys, one of them being the ADM pin, which can be used to get/set the keys on the cards.
You can set them however you like.

Sure, same with the SJA5.

Well, yes, that’s just part of regular work when dealing with mobile networks.
In order to operate your own cellular networks, you’ll need to provision SIM cards, so it’s a common thing to do.

1 Like

Thanks for your support. The SJA5s are also out of stock. I’ll wait for them to be in stock. I’ll start testing as soon as I receive them.

sysmoISIM-SJA5 should be back in stock at some point nex week. sorry for the inconvenience.