To prevent this attack, you need to run some kind of code analysis, then make sure that
- a code that uses joinServer api generates some secret stuff that goes into server id
- that secret stuff is not sent to the party that client is talking to (the MITM)
- if that secret stuff needs to be sent, it is only sent to the party that will do /hasJoined api call
It's practically impossible to prevent.
To prevent this attack, you need to run some kind of code analysis, then make sure that
It's practically impossible to prevent.