MongoDB is using 27017, 27018 and 27019 ports for mongod daemon when running. whose ports are open on your virtual machine and allows all incoming traffic from the Internet. In order to keep security best practices and decrease the risk for malicious activities, you should restrict access to be only from allowed IP addresses.