open5gs/lib/crypt
Sukchan Lee 7c14073533 [UDM] Added validation for pubkey
a cryptographic vulnerability in the SUCI decryption routines
of Open5GS 5G—specifically Profile B, which uses P-256 (secp256r1)
for its elliptic curve routines.

If a mobile device user passes a public key within its SUCI
that does not correspond to a valid point on the P-256 elliptic curve,
the Open5GS UDM will not check the point
before running elliptic curve operations with it and returning a response
to the mobile device user.

If the public key is not checked to be a valid point, an attacker can leverage
this behavior to extract the Profile B private key from the UDM,
as has been done in other domains
(https://owasp.org/www-pdf-archive/Practical_Invalid_Curve_Attacks_on_TLS-ECDH_-_Juraj_Somorovsky.pdf).

Note that Profile A is not similarly vulnerable to this, as it is impossible
to construct an invalid point on a curve25519 elliptic curve.

There was some work that went into developing a practical proof of concept
of this kind of attack against free5gc last year; it can be found here:

https://www.gsma.com/security/wp-content/uploads/2023/10/0073-invalid_curve.pdf

And here is the free5gc security advisory:

https://github.com/advisories/GHSA-cqvv-r3g3-26rf

To mitigate this issue in Open5GS, the public key of the UE must be validated
by the UDM prior to use. Adding a validation function such as the following
should work:

I designed this code based on information from https://crypto.stackexchange.com/questions/90151/verify-that-a-point-belongs-to-secp256r1.
2024-03-24 14:09:10 +09:00
..
openssl Fixed MacOSX compile error (Follow-up on #2581) 2023-09-14 07:04:27 +09:00
curve25519-donna.c Introduced Subscription identifier de-concealing 2022-12-24 20:22:45 +09:00
ecc.c [UDM] Added validation for pubkey 2024-03-24 14:09:10 +09:00
ecc.h Introduced Subscription identifier de-concealing 2022-12-24 20:22:45 +09:00
kasumi.c Rename Project to Open5GS 2019-10-27 17:41:14 +09:00
kasumi.h Rename Project to Open5GS 2019-10-27 17:41:14 +09:00
meson.build [AMF/MME] Fix crash during snow-3g encrypt (#2581) 2023-09-13 23:22:46 +09:00
milenage.c Improve Milenage library for [R1-R5] (#1153) 2021-09-01 19:38:36 +09:00
milenage.h Rename Project to Open5GS 2019-10-27 17:41:14 +09:00
ogs-aes-cmac.c License update 2020-11-12 20:58:08 -05:00
ogs-aes-cmac.h License update 2020-11-12 20:58:08 -05:00
ogs-aes.c License update 2020-11-12 20:58:08 -05:00
ogs-aes.h License update 2020-11-12 20:58:08 -05:00
ogs-base64.c Introduced Subscription identifier de-concealing 2022-12-24 20:22:45 +09:00
ogs-base64.h Introduced Subscription identifier de-concealing 2022-12-24 20:22:45 +09:00
ogs-crypt.h [AMF/MME] Fix crash during snow-3g encrypt (#2581) 2023-09-13 23:22:46 +09:00
ogs-kdf.c [SEC] Several vulnerabilities have been resolved. 2024-02-03 10:41:12 +09:00
ogs-kdf.h [SEC] Several vulnerabilities have been resolved. 2024-02-03 10:41:12 +09:00
ogs-sha1-hmac.c License update 2020-11-12 20:58:08 -05:00
ogs-sha1-hmac.h License update 2020-11-12 20:58:08 -05:00
ogs-sha1.c License update 2020-11-12 20:58:08 -05:00
ogs-sha1.h License update 2020-11-12 20:58:08 -05:00
ogs-sha2-hmac.c License update 2020-11-12 20:58:08 -05:00
ogs-sha2-hmac.h License update 2020-11-12 20:58:08 -05:00
ogs-sha2.c License update 2020-11-12 20:58:08 -05:00
ogs-sha2.h License update 2020-11-12 20:58:08 -05:00
snow-3g.c Use talloc for all memory pool (#1263) 2022-01-04 08:29:18 +09:00
snow-3g.h Rename Project to Open5GS 2019-10-27 17:41:14 +09:00
zuc.c Remove not valid UTF-8 characters 2023-01-31 00:22:16 +09:00
zuc.h Rename Project to Open5GS 2019-10-27 17:41:14 +09:00