SECURITY
SQL

How to Protect Your Database From the Threats Outlined in OWASP Top 10?

intro

Let’s learn everything to protect our database management systems from injection and other threats in the OWASP Top 10 2024. Dive in!

Tools used in the tutorial
Tool Description Link

You don’t need to be an elite security expert to understand that data breaches are a common problem. They’ve been a common problem for decades and, experts say, they will continue to be a headache for years to come.

Part of the reason why that’s happening is because developers fail to protect their most precious assets — applications and databases — from the threats outlined in the OWASP Top 10 2024.

Why Protect Your Application and Databases?

We will start by addressing the elephant in the room — you should protect your application and databases because if you don’t, you can be sure that it’s only a matter of time when they will be compromised and you will start seeing the names of your application and/or company in data breach search engines/directories like BreachDirectory and the like.

Take a look into the older versions of OWASP Top 10 and you will quickly understand that injection — SQL injection — tops the charts and that’s not without a reason; your database holds all of the sensitive data that is interacted with by your users making it a prime target for attackers.

The Most Dangerous Flaws in OWASP Top 10 2024

Dangerous and interesting, right? What’s also very interesting is the fact that the OWASP Top 10 2024 list hasn’t been released and the next OWASP Top 10 list will only be coming up in 2025. That’s because the OWASP team only releases security advisories once every three or four years; however, judging by what’s already been released previously, we can make some assumptions about some of the most dangerous flaws that are likely to be in the list:

  1. Injection is likely to top the list — injection has been there for ages and even with hundreds of tutorials on how to protect yourself and your applications from injection attacks, developers still make crucial mistakes that make their database — and the application behind it — susceptible to data breaches. Sadly, this is unlikely to change.
  2. Broken access control is likely to light OWASP on fire again: with many CVE entries mentioning access-level flaws, we are very likely to see broken access control in the list as well.
  3. Cross-Site Request Forgery may come back — CSRF has been on the OWASP’s radar for decades now, it is still a dangerous application security flaw as it enables an attacker to do things on behalf of a user and it may well be making a comeback towards the OWASP Top 10 2024.
  4. Cryptographic failures are likely to remain part of the OWASP list — security issues that are introduced to the application due to its design are indeed some of the most dangerous ones: cryptographic failures are easy to implement (i.e. for some, using vanilla MD5 is way easier than opting to use salted Blowfish hashes) and hard to change or modify once we have a lot of users. Security should be built into the design of our application: if it isn’t, security issues like cryptographic failures shouldn’t be all that surprising.

Of course, there will be others; some security issues may be removed from the list while some may be added. Not all of them will necessitate protecting your database from them, too: those that will, however, are likely to pose an extremely serious risk to the users and consumers of your application.

Protecting Your Database From OWASP Top 10 2024

To protect your database from the threats outlined in OWASP Top 10 2024, start from the bottom:

  1. Identify the threats that are likely to target your database: most likely it will be a singular threat — injection — but that doesn’t mean that you should discount the others like XSS, CSRF, and the like either. Your database is only a part of the entire game.
  2. Be aware of ways to thwart injection: practice parameterizing your queries and separating user input from the query wherever possible.
  3. Remember that threats to your database are likely to come in multiple forms: injection is like a hydra that can have multiple forms: it can come in the form of a classic SQL injection, out-of-bound SQL injection, or blind SQL injection, and you need to be prepared for them all. The best way to prepare for SQL injection and related attacks is to verify any and all of the input provided by your users and, last but not least, “cleanse” it before passing it on to a database. “Cleansing” input like this certainly won’t fly because all you will be doing is querying the database with user input using PDO:
Protecting against SQL injection by using PDO
“Protecting” against SQL injection by using PDO

The code snippet above would still leave your application and database susceptible to SQL injection.

However, if you would parameterize your queries like so:

Properly Parameterizing Queries Using PDO
Properly Parameterizing Queries Using PDO

You would avoid SQL injection because user input and the query that’s being provided to the database beforehand would be separated. Actually, you would also avoid XSS as well because the line #10 in our code snippet evades all HTML entities before returning anything containing itself to the user: have you noticed that one? XSS was a part of the OWASP Top 10 in 2017 and its previous editions too and it’s pretty dangerous as it is, so protecting your application against it never hurts.

Finally, to further your security fortress, opt to execute SQL queries using SQL clients like DbVisualizer: with its extensive support for more than 50 data sources, you will certainly find your database in the list, and with exclusive features like autocomplete, ER diagrams, and data export tools, DbVisualizer is sure to make your day-to-day database management tasks so much easier. Give DbVisualizer Pro a spin by using a 21-day free trial!

Summary

The OWASP Top 10 2024 was never a thing; however, an OWASP Top 10 2025 version is coming up sooner than we may expect and this blog has shown you what you can expect from the threats that may be coming up in this edition.

I hope that you have enjoyed reading this blog and that you will come back for more, but for now, stay safe, stay educated by reading books on databases and cybersecurity like “Hacking MySQL: Breaking, Optimizing, and Securing MySQL for Your Use Case,” and I’ll see you in the next one. Bye for now.

FAQ

What is the OWASP Top 10 2024?

The OWASP Top 10 is the list of the most dangerous security flaws targeting web applications that’s updated every 3 to 4 years. The next update of OWASP is planned somewhere in 2025.

Why should I use DbVisualizer Pro?

Consider using the Pro version of DbVisualizer because it will allow you to export data in various formats, edit data as if it were a spreadsheet, view XML data in a tree or text format, come with a SQL formatter with extensive customization options, and so much more. Try DbVisualizer Pro today!

Where can I learn more about SQL and databases in general?

To learn more about SQL and databasing in general, we suggest you read books, attend seminars, conferences, and workshops, and network with professionals in your field. Reading books like “Hacking MySQL: Breaking, Optimizing, and Securing MySQL for Your Use Case” will be a good place to start and reading blogs like TheTable will also be a great place if you want to expand your existing knowledge.

Dbvis download link img
About the author
LukasVileikisPhoto
Lukas Vileikis
Lukas Vileikis is an ethical hacker and a frequent conference speaker. He runs one of the biggest & fastest data breach search engines in the world - BreachDirectory.com, frequently speaks at conferences and blogs in multiple places including his blog over at lukasvileikis.com.
The Table Icon
Sign up to receive The Table's roundup
More from the table
Title Author Tags Length Published
title

The Best MariaDB Clients in 2025

author Lukas Vileikis tags DbVisualizer MARIADB SQL 10 min 2025-07-08
title

Top Serverless SQL and NoSQL Database Platforms in 2025

author Antonello Zanini tags NOSQL SQL 8 min 2025-07-02
title

SQL DROP TABLE IF EXISTS: The Database Migration Lifesaver

author Leslie S. Gyamfi tags MySQL ORACLE POSTGRESQL SQL SQL SERVER 10 min 2025-06-25
title

Top Internal Tool Builders and Low-Code Platforms for SQL Apps in 2025

author Antonello Zanini tags Internal Tool Builders Low-Code No-Code SQL 9 min 2025-06-17
title

Database Security: The Most Common Mistakes to Avoid

author Lukas Vileikis tags MARIADB MySQL SECURITY SQL 6 min 2025-06-09
title

How to Compare Datetimes in SQL: Multiple Approaches

author TheTable tags MySQL ORACLE POSTGRESQL SQL SQL SERVER 5 min 2025-06-04
title

The Complete Guide to CONCAT in SQL Queries: Syntax, Examples, and Best Practices

author Leslie S. Gyamfi tags MySQL ORACLE POSTGRESQL SQL SQL SERVER 7 min 2025-06-03
title

How Often Should SQL Transaction Logs Be Backed Up?

author Antonello Zanini tags MySQL POSTGRESQL SQL SQL SERVER 7 min 2025-06-02
title

What Is a Database Catalog?

author Antonello Zanini tags MySQL ORACLE POSTGRESQL SQL SQL SERVER 6 min 2025-05-27
title

The Most Common MySQL Error Codes (and How to Avoid Them)

author Lukas Vileikis tags MARIADB MySQL SQL 5 min 2025-05-26

The content provided on dbvis.com/thetable, including but not limited to code and examples, is intended for educational and informational purposes only. We do not make any warranties or representations of any kind. Read more here.