Trustwave SpiderLabs Uncovers Critical Cybersecurity Vulnerabilities Exposing Manufacturers to Costly Attacks. Learn More

Trustwave SpiderLabs Uncovers Critical Cybersecurity Vulnerabilities Exposing Manufacturers to Costly Attacks. Learn More

Managed Detection & Response

Eradicate cyberthreats with world-class intel and expertise

Managed Security Services

Expand your team’s capabilities and strengthen your security posture

Consulting & Professional Services

Tap into our global team of tenured cybersecurity specialists

Penetration Testing

Subscription- or project-based testing, delivered by global experts

Database Security

Get ahead of database risk, protect data and exceed compliance requirements

Email Security & Management

Catch email threats others miss with layered security & maximum control

Co-Managed SOC (SIEM)

Eliminate alert fatigue, focus your SecOps team, stop threats fast, and reduce cyber risk

Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
The Trustwave Approach
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Platform
SpiderLabs Fusion Center
Security Operations Centers
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

Protecting Yourself from MongoDB Ransomware

In the realm of malware, ransomware has been king for the last few years, compromising unsecured hosts and kindly requesting payment from their rightful owners. Back in January 2017, an attacker extended the concept to MongoDB and was hitting unsecured servers and demanding bitcoin ransom to return the compromised data. By leveraging unauthenticated access, this attacker could gain control over sensitive data, export it to his domain, and leave a database/collection of his own explaining to the owners what he had done. Owners of these MongoDB installations were then forced to pay up or lose their data forever.

It's not really clear why so many MongoDB databases in use today are left unsecured and publicly accessible. Are admins lazy? Do they not follow the Security Checklist that is published by MongoDB? The number is staggering. In 2015 a Shodan search revealed at least 35,000 unsecured, publicly internet facing instances of MongoDB were. Today, in 2017, that number is predicted to grow over 90,000.

Running a business around a database environment that isn't secured is like playing Russian roulette. In this roulette game, with each click of the trigger, you may end up bringing your operation to a standstill, potentially losing out on crucial revenue needed to keep commerce going. When it comes to MongoDB, if you follow a few simple steps, you can ensure that your database has some basic protections.

MongoDB is a NoSQL database built on an architecture of collections and documents, as opposed to the standard rows and tables commonly found in more 'traditional' database formats. Configuring MongoDB is easy, by altering the YAML-based configuration file, mongod.conf, you can set certain reserved parameters to values that will ultimately secure the database instance.

NOTE: Although these parameters can be used in conjunction with others to provide a more astute database environment, here they are meant for single, non-sharded database instances.

Those parameters are:

authorization: true

When this parameter is set, the default authentication mechanism is SCRAM-SHA-1 which verifies the username and password to what is included within the authentication database. The authentication database is whichever database the user was created in.

What does this mean? By enabling the authorization parameter, you will need a user and password to connect to that MongoDB database. Simple, huh?

There is a caveat to this, you must create an admin/superuser account to administer user/role access BEFORE setting the authorization parameter. MongoDB, by default, doesn't create this account leaving it the number one thing an attacker will do when compromising your unsecured database. To create this account, follow the steps here.


port: <non-default port>

The default port for MongoDB is 27017. By changing this port, it makes it a bit more difficult for attackers to find the database.


bindIp: <comma separated IP addresses>

This parameter allows you to explicitly bind certain IP addresses to listen for connections from incoming applications. By binding MongoDB to only the appropriate network interface, you may be able to prevent the database from accidentally listening for connections on a publicly exposed address.

Along with applying certain parameters to the configuration file, you can also go one step further with enabling role-based access. By creating roles and assigning them certain aspects of database administration/access, you are establishing another layer of security.

To read more about RBAC (Role-based Access Control), please check out the MongoDB documentation.

In addition to these suggestions, as mentioned before, MongoDB publishes a Security Checklist. This checklist goes beyond what is mentioned here and helps to paint a complete security footprint for securing your MongoDB database. As a database security professional, I encourage you to evaluate your security posture when it comes to databases and ensure that you are protected from outside (and inside) attacks. In addition to this Checklist, Trustwave has tools available that will perform the compliance scanning and present the level of security to you. By following a few simple procedures, you are saving yourself countless hours of unneeded work and saving your organization revenue in the end.


Latest SpiderLabs Blogs

Trustwave SpiderLabs Report: LockBit 3.0 Ransomware Vs. the Manufacturing Sector

As the manufacturing sector continues its digital transformation, Operational Technology (OT), Industrial Control Systems (ICS), and Supervisory Control and Data Acquisition (SCADA) are becoming...

Read More

Overview of the Cyberwarfare used in Israel – Hamas War

On October 7, 2023, the Palestinian organization Hamas launched the biggest attack on Israel in years, resulting in numerous casualties and hostages taken. Israel responded with a large-scale ground...

Read More

The 2023 Retail Services Sector Threat Landscape: A Trustwave Threat Intelligence Briefing

The annual holiday shopping season is poised for a surge in spending, a fact well-known to retailers, consumers, and cybercriminals alike. The latter group, however, is poised to exploit any...

Read More