0

We often hear TLS over TCP socket and very famliar with its use case e.g. HTTPS.
While I am learning Linux socket progamming, I read a An Introduction to OpenSSL Programming, Part I of II tutorial . (Obviously it's about TLS over TCP).

Later on I started to think about something like "TLS over UDP" and did some search, but didn't find anything popular. (I know there's something like DTLS, but in practice do people really use it?)

So my question is, in the fields that UDP dominates, for example game server (I know little about game development), do they use anything like TLS over TCP to authenticate and encrypt the communication/raw UDP packet?

Or is it just uncessary?

My guess:
In some ways I think it's uncessary to employ something like TLS. For example, one big usage of TLS is for authentication. But as for a game (sorry so far I only know UDP is widely used in gaming), you download the client, as long as the client is not modified by someone, you are done with authentication. And then for encryption, that might be necessary or might not. Because for a game you need to create your own application level protocol and that's a kind of encrytion. Beyond that, if necessary, one can use symmetric encryption like AES too.

Is my guess correct?

2 Answers 2

3

The reason why UDP is used instead of TCP for game servers is to minimize overhead and because usually it doesn't matter if some datagrams get lost. If you tell the server your position over time and one of the datagrams gets lost, the server can deem it plausible that you meant to say that you were in that specific location at the time, and the datagram just got lost.

Securing this with TLS or DTLS would be difficult, because it would negate quite some of the advantages that a reduced overhead would bring. Furthermore, many of the goals of TLS wouldn't really even help in this situation. For example:

  • Confidentiality: Where your position on the map is does not actually matter that much, except possibly on a LAN tournament. However, giving each player quite the additional ping just to make sure one rare attack vector is covered is not something that game designers want to do.
  • Integrity: A flipped bit in one of your datagrams could drastically change your position on a map. However, if the datagram that the server receives is grossly wrong, a well-written server would discard it as obviously wrong or an attempt at cheating. Don't be alarmed though. Even if your internet is bad, you won't get banned from CS:GO (although your teammates won't be happy if you play with 300ms ping and 49% packet loss).
  • Authenticity: A server authenticating you isn't really feasible, because the server can't know who you are when you buy the game. You authenticating the server, to ensure you connect to a legitimate lobby server, can be done over TCP and doesn't need to happen over UDP.

So as you see, you don't really have any advantage. But asking "Do we care less about UDP security?" is in my opinion the wrong question. The better question is: "Is UDP used for applications that require less security?" and the answer is an overwhelming yes.

Furthermore, if you really require encryption, you can encrypt individual packets with a key exchanged via TCP.

4
  • Do the client really need to authenticate the server? I think that's also a rare attack vector too.
    – Rick
    Nov 21, 2019 at 14:09
  • @Rick A client needs to authenticate the server if the client wants to make sure they actually talk to the server. On the web, this is done to prevent MitM attacks. Theoretically, the same applies to videogames too. You wouldn't want anyone to be able to impersonate you in a game.
    – user163495
    Nov 21, 2019 at 14:26
  • @Rick a quite popular attack vector widely used in online gaming is the concept of 'booting' i.e. forcing your opponents or players you dislike to disconnect from the game. Denial of service flooding attacks are sometimes used for that goal, but if the client doesn't authenticate the server at all, then you should expect someone to provide a simple tool that trivially allows you to send a UDP packet to the target player's client system saying "101% legit server here: the game, uh, suddenly ended and you lost with minus infinity points", and many players (ab)using that tool.
    – Peteris
    Nov 21, 2019 at 20:39
  • @Peteris That's new to me. Thank you for telling me that ;)
    – Rick
    Nov 22, 2019 at 1:09
3

If data needs to be secured does not depend on the transport protocol (UDP vs. TCP) but on the kind of data. For example there is HTTPS to protect HTTP traffic which is deemed to be often sensitive. And there is HTTP/3 for the same purpose as HTTP but on top of UDP - and it is secured on the same level as HTTPS is. Similar WebRTC uses UDP for real time transport of audio and video but these get encrypted too (SRTP). Also, the VPN OpenVPN by default uses encrypted UDP for data transport.

But it is kind of true that encryption does not see as much use with UDP based protocol as with TCP based. For example the majority of RTP traffic used in VoIP protocols like SIP is still unencrypted even though there are protocol like SRTP or ZRTP which support proper encryption on top of RTP (and thus UDP). Incidentally SIP itself (as the control layer in VoIP) is usually unencrypted too even if there is SIP over TLS (SIPS). This might be because some things like surfing the web or sending and receiving mail are more in the focus of attacks and there is more public awareness and pressure to implement encryption for these than for the other protocols.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .