I'm hosting a Minecraft server from my own computer and use port forwarding so a couple of friends can connect. Recently, an unfamiliar account tried to join and was kicked immediately. I only shared my IP address with two friends, and they say they didn't pass it along, so I'm worried it may have been exposed or discovered through scanning. I've started using AI-generated code to monitor connection attempts and block unapproved IP addresses, but I don't fully understand what the code is doing or whether it could create security problems. I already have a whitelist enabled and would appreciate advice on securing the server, checking whether my computer is exposed, and choosing a safer setup.
3 Answers
If you’re forwarding a Minecraft port from your router, the server is visible to anyone scanning the internet for open Minecraft ports. That doesn’t necessarily mean your IP was leaked by one of your friends. Automated scanners can discover exposed servers, and some bots try joining them. Keep the whitelist enabled, use a strong server and account setup, update the server and plugins, and avoid exposing any other unnecessary ports. Also review the code generated by AI instead of blindly running it, especially anything that modifies firewall rules.
Using AI for guidance isn’t inherently bad, but generated security code can be wrong or even make things less safe. If you don’t understand a script, don’t run it with administrator privileges or rely on it as your main protection. Start with the server’s built-in whitelist, router port-forwarding rules, operating-system firewall, regular updates, and backups. Learning what each setting does will make troubleshooting much safer than copying code without being able to audit it.
A safer option is not to expose your home network directly at all. You could use a private mesh VPN such as Tailscale or ZeroTier, have your friends join that private network, and let them connect through it. That does require everyone to install and configure the client, but it avoids opening the Minecraft port publicly. A hosted server is another option if you want to keep the service separate from your personal computer.
A reverse proxy can help in some situations, but it isn’t automatically secure and may not be practical for every Minecraft setup. A private VPN or separate hosting provider is usually simpler for a small group of friends.

That makes sense. I was mainly worried that somebody had specifically received my address, but I hadn’t considered automated scanners finding it. I’m going to review the port-forwarding and firewall settings more carefully.