Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SECURITY ADVISORY: Discord Messenger does not check the server's certificate #45

Closed
iProgramMC opened this issue May 14, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@iProgramMC
Copy link
Contributor

Hello everyone.

I have just realized that me disabling server verification (src/windows/NetworkerThread.cpp) leads to the possibility of a man in the middle attack.

If using V1.00, ensure that you can access Discord and don't get certificate errors while connected to the network you're trying to use Discord Messenger from.

This will be fixed in a future version by bundling the certificate(s) for Discord into the client.

@iProgramMC iProgramMC added the bug Something isn't working label May 14, 2024
@iProgramMC iProgramMC pinned this issue May 14, 2024
@iProgramMC
Copy link
Contributor Author

More precisely, this assumption was fine back when Discord Messenger was still being developed, but not now.
https://github.com/DiscordMessenger/dm/blob/master/src/windows/NetworkerThread.cpp#L107

@iProgramMC
Copy link
Contributor Author

The plan is to export the Baltimore CyberTrust Root certificate and embed it into the executable as a resource. Then it'd be written to the cache and loaded by httplib.

image

@iProgramMC
Copy link
Contributor Author

To fix this, I ought to make httplib load the certificates from Discord. I don't know how to do that, so I'll do the next best thing - enable server verification by default and disable it if required to log in.

@iProgramMC
Copy link
Contributor Author

NOTE: HTTPS and Websocket traffic is always encrypted. However, disabling server verification puts you at risk of accessing a compromised service.

@iProgramMC
Copy link
Contributor Author

Ok, seems like I will also need to get websocketpp to work. Tried adding these to the tls init handler but it won't even connect to the websocket gateway on Win11 due to TLS handshake errors:

ctx->set_default_verify_paths();
ctx->set_verify_mode(websocketpp::lib::asio::ssl::verify_peer | websocketpp::lib::asio::ssl::verify_fail_if_no_peer_cert);

@Zero3K
Copy link

Zero3K commented May 19, 2024

I think this issue should be unpinned since it has been fixed.

@iProgramMC
Copy link
Contributor Author

True. There isn't a need to remind me though.

@iProgramMC iProgramMC unpinned this issue May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants