Hi everyone,
We recently discovered a security vulnerability using Open edX Full Stack or native installation methods. Please read the post in openedx-ops for a thorough explanation.
Hi everyone,
We recently discovered a security vulnerability using Open edX Full Stack or native installation methods. The vulnerability is due to the fact that MongoDB will accept connections from outside the server, with the default admin user and password.
Am I Vulnerable?
There are two things to check, both require you to login into the server where your MongoDB is installed.
Is my port open to the world?
$ netstat -plunt | grep 27017 tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTENIf you see
0.0.0.0:27017, then your MongoDB is accepting connections from anyone who can reach this machine, unless you’ve activated a firewall on the machine or upstream in your network.Am I using the default admin account and password?
$ mongo admin -u admin -p password --eval "db.getMongo().getDBNames()" MongoDB shell version: 2.6.12 connecting to: admin admin,edxapp,local,cs_comments_service_developmentIf this command runs successfully, then you are using the default admin account and password.
If you’re able to complete both steps, then your MongoDB is vulnerable.
What Should I Do?
The quickest way to address this vulnerability is to configure your MongoDB to only accept requests from within the same server.
Edit
/etc/mongod.confand add the following line to the end of the file:bind_ip = 127.0.0.1Restart the
mongodservice.
If you’re on Ubuntu 12.04:
sudo service mongod restartIf you’re on Ubuntu 16.04:
sudo systemctl restart mongodVerify that MongoDB is now only listening on 127.0.0.1:
$ netstat -plunt | grep 27017 tcp 0 127.0.0.1:27017 0.0.0.0:* LISTENAnother additional step you can take is to install UFW and only allow specific ports for incoming requests (for example, http:80, https:443, ssh:22).
For future installations, please refer to https://openedx.atlassian.net/wiki/display/OpenOPS/How+to+Override+Default+Configuration+Passwords+and+Verify+Exposed+Services for more comprehensive security information.--George