I have been having this issue, along with many other server owners where people are able to send invalid login packets to crash the server. I was able to get the same results using a bot using the code given.
In order to reproduce you must start a BDS server. Once it is online, run the code given to make a bot join the server and send a login packet with a invalid certificate json. You may have to run it twice but it should cause the server to crash.
We expect this to not crash the server, and that it should handle this without a crash.
The actual result ends up being the crash.
In order to run the code for the bot, you must have node installed along with using “npm i bedrock-protocol” to install the package needed to run. Then run “node ./main,js". You may have to run the bot twice in order to reproduce. I've also included a video to help show.
Environment
Windows 11
I realize my version is outdated but it works on the latest and I can also provide an updated video if needed.