go Home Page

Data Security Insights

Exploring Open Databases Near You

How I Accessed Exposed SQL and MongoDB Servers

Are Your Databases Securely Locked Down?

In this write-up, I share my experience investigating public database exposures. By using publicly available tools and techniques, I discovered open-access SQL and MongoDB databases belonging to local companies—exposing sensitive data without proper protection. Let’s walk through the process and how organizations can better protect themselves.

Unsecured Databases: A Growing Concern

Most administrators assume that database access is limited to internal systems. However, many servers are accidentally exposed to the public internet—without passwords or encryption. Tools like Shodan make it shockingly easy to find them.

For instance, misconfigured MongoDB instances often expose full collections, while outdated SQL databases may allow remote connections without credentials.

Discovering Databases with Shodan

Shodan.io indexes services running on public IPs. By crafting the right search queries, I located dozens of unsecured databases in my city.

Shodan Query Example
product:"MongoDB" port:"27017" country:"TN" city:"Sfax"
            

Using queries like the one above, I found numerous targets. Some even allowed read/write access without authentication.

Testing Exposure

Once IPs were collected, I used basic scripts and tools such as mongo shell or mysql-client to test access. Here's how simple it was to connect:

# MongoDB
mongo --host  --port 27017

# MySQL
mysql -h  -P 3306 -u root
            

In many cases, no authentication was required. This is a critical oversight by admins unaware that their databases are public-facing.

Open MongoDB Open MySQL

Brute-Forcing Database Access

While many were open, some databases did require credentials. I used tools like Hydra to attempt common username-password combinations.

hydra -L users.txt -P passwords.txt mongodb://:27017/
            
Brute Test Result

Mitigation and Prevention

To ensure your databases are protected, consider implementing the following best practices:

  • Never expose databases directly to the internet.
  • Use firewalls to restrict IP access to trusted networks only.
  • Enable authentication and use strong, unique passwords.
  • Encrypt data in transit with SSL/TLS.
  • Regularly audit exposed services using Shodan or similar tools.

Disclaimer:

This tutorial is for educational and awareness purposes only. Do not attempt unauthorized access on any systems you do not own or manage.

Cybersecurity begins with awareness. Stay safe, stay informed.