Glossary

Database firewall

Also called SQL firewall, database gateway, SQL gateway, database activity monitoring and protection

A database firewall, also called a SQL firewall or database gateway, sits in the network path between applications and a database and checks each SQL statement against a policy before it reaches the database, then allows, alerts on or blocks it.

Rudratic glossary

Most database attacks arrive as ordinary SQL: a statement that reads a whole customer table, drops a schema, or grants a role it should not. Audit trails record these after they run. A database firewall stops them before they run, by deciding each statement against a policy in the path between the application and the database.

How it works

  1. Sit in the path. Applications and tools connect to the firewall, which speaks the database’s own wire protocol and forwards traffic to the real database.
  2. Read each statement. The firewall parses the SQL, works out the statement type, the tables it touches and the identity that sent it.
  3. Decide. Rules match on facts such as the user, the source address, sensitive tables and the statement type, and each rule allows, alerts on or blocks the statement.
  4. Answer. An allowed statement goes to the database. A blocked one gets an error back, and nothing reaches the database.
  5. Record. Every decision is logged for investigation and audit evidence.

Why it matters

Application code should use prepared statements and parameterised queries, which the OWASP SQL Injection Prevention Cheat Sheet names as the primary defence. But many accounts reach a database without passing through that code: administrators, reporting tools, scripts and service accounts. A firewall applies one policy to all of them. Vendors document the approach in their own products, for example Oracle’s Audit Vault and Database Firewall. It also supports controls such as NIST SP 800-53 AC-6 (least privilege) by limiting what a privileged account can do in practice.

Database firewall vs DAM

Database firewall DAM
When it acts Before the statement runs After, from audit records or captured traffic
Can it stop a statement? Yes No, it alerts
Typical output Allow, alert or block decisions Risk scores, alerts, forensic audit log

Examples

  • A reporting account sends SELECT * on a card table from an unfamiliar address, and the statement is blocked.
  • DROP TABLE on a production schema is refused outside an approved change.
  • A new policy runs in monitor mode for a week, showing what it would block, before it is switched to protect.

How SWOT supports it

SWOT DAM includes a database firewall, its SQL Gateway, for Oracle, SQL Server, PostgreSQL and MySQL. It decides every statement against your policy before it runs, with nothing installed on the database; a blocked statement returns the database’s own policy error and the session stays open. The same product reads each native audit trail for database activity monitoring. Each engine has its own page: Oracle database firewall, PostgreSQL database firewall, SQL Server database firewall and MySQL database firewall. See database security.

Questions

How is a database firewall different from database activity monitoring?
Database activity monitoring records and analyses what happened in a database, usually from audit trails or captured traffic, and alerts on it. A database firewall acts before a statement runs: it decides each statement against a policy and can stop it. Many teams use both, monitoring for evidence and investigation, and a firewall for the statements that must never run.
Does a database firewall replace parameterised queries?
No. Prepared statements with parameterised queries remain the primary defence against SQL injection in application code. A database firewall adds a control outside the application, which also covers accounts and tools the application team does not own, such as administrators, reporting tools and service accounts.
Does a database firewall need software on the database server?
Not when it runs as a gateway in the network path. The application connects to the gateway instead of the database, and the gateway forwards allowed statements. Other designs use an agent on the database host.

In SWOT

Sources

  1. OWASP Cheat Sheet Series: SQL Injection Prevention
  2. Oracle documentation: Audit Vault and Database Firewall
  3. NIST SP 800-53 Rev. 5: Security and Privacy Controls for Information Systems and Organizations

Related terms