Cloudanix Joins AWS ISV Accelerate Program

What Is Database Security? Access, Data, and Activity Controls Explained

Database security protects the data, access paths and activity around your databases. Learn the five layers, common failures and a practical order of work.

Database security is the set of controls that protect a database, the data inside it, and the ways people and applications reach it. It covers who can connect, what each connection is allowed to do, what data comes back, what is recorded, and how the database server itself is configured and patched. The goal is not a single product. It is a set of layers that still hold when one of them fails.

Databases deserve their own security discipline because they hold the thing attackers usually want: customer records, payment data, health information, credentials and intellectual property. Most other systems are a way to reach the database. And because databases are shared by applications, administrators, analysts, support staff and developers, they accumulate access faster than almost any other system.

This guide explains the layers of database security, how databases are actually compromised, how the layers fit together, and a practical order of work. Each section can be read on its own, and each links to a deeper page where one exists.

Why databases are a special case

Three properties make databases different from most workloads.

  • They concentrate value. A single table can hold millions of customer records. One successful query can take all of them.
  • They have many kinds of users. Applications connect with service accounts. Administrators manage the server. Developers debug. Analysts run reports. Support staff fix individual customer problems. Each group needs different access, and in practice they often share one or two broad accounts.
  • Their normal activity looks like attack activity. A person running SELECT * on a customer table might be debugging, or might be stealing data. The database cannot tell the difference without context about who they are and why they are there.

For these reasons, perimeter controls such as firewalls and network segmentation are necessary but incomplete. The attacker, or the careless insider, often arrives with a valid login.

The five layers of database security

1. Infrastructure and configuration

This is the database server and the environment around it: where it runs, who can reach it over the network, how it is configured, and whether it is patched.

  • Network exposure. A database should rarely have a public address. Private subnets, security groups and private endpoints keep it off the internet. A publicly reachable database turns any leaked credential into an immediate problem. See how to read the attack path of a publicly accessible database.
  • Hardening. Disable features and extensions you do not use, remove default accounts, require encrypted connections, and follow a published baseline such as the CIS Benchmark for PostgreSQL or the equivalent for your engine.
  • Patching. Database engines ship security fixes regularly. The November 2026 PostgreSQL release fixed 52 flaws, including one that let a user who can create objects run code on the server. We explain it in PostgreSQL’s 52 security fixes. Which fixes to apply first is a prioritization problem, covered in how to prioritize which CVEs to fix.
  • Encryption. Encrypt data in transit with TLS, and at rest with disk or database-level encryption and managed keys. Encryption protects stolen disks and backups. It does not protect against someone who has a valid login, which is why the next layers exist.

2. Identity and access control

This layer decides who may connect and what they may do.

  • Individual identity. Every human connection should be tied to a named person. A shared admin password cannot tell you who ran a query.
  • Least privilege. Grant only what each role needs, and nothing more. Applications rarely need to create tables. Analysts rarely need to write. See the principle of least privilege.
  • Time-limited access. Human access to production should be requested for a reason and expire. Standing access to production databases is the most common source of excess exposure. See zero standing privilege.
  • Service accounts and secrets. Application credentials should be stored in a secrets manager, rotated, and scoped to one application. See secret rotation and non-human identities.

Native database roles and grants are the foundation, but they are coarse. A grant such as SELECT on a table gives access to every row and every column. It cannot hide a column from one person and show it to another.

3. Data-level protection

This layer limits what a legitimate session can see and take.

  • Masking. Show only part of a sensitive value, such as the last four digits of a card number, or replace it with a token, depending on who is asking. See real-time data masking.
  • Row and column restrictions. Limit which rows and columns a role can read. PostgreSQL’s row-level security is one native tool, and it has had its own fixes, as the November 2026 release shows.
  • Query guardrails. Block statements that are almost never legitimate in production, such as a DELETE without a WHERE clause, a DROP, or a SELECT with no row limit on a customer table.
  • Data minimization. Data that is not stored cannot be stolen. Delete what you do not need, and keep non-production copies free of real customer data.

4. Monitoring and audit

This layer answers the questions that come after something goes wrong, and ideally during it: who connected, what did they run, what data came back, and when.

  • Native logs show connections and, depending on settings, statements. They rarely tie a shared account to a person.
  • Database activity monitoring (DAM) records each query with the identity behind it and can raise alerts on unusual patterns.
  • A durable audit trail is also a compliance requirement under frameworks such as SOC 2, HIPAA and PCI DSS. See database audit logging.

5. Response and recovery

Plan for the day a credential is stolen or a bad query runs. That means tested backups stored away from the database host, a way to revoke database access quickly, and a runbook for investigating what was read or changed. See incident response.

How databases are actually compromised

PatternWhat happensLayer that should stop it
Stolen or leaked credentialsA database password appears in a repository, a chat message or an infostealer log. The attacker connects as a legitimate user.Access control, time-limited access, monitoring
Excess standing accessA developer who needed access for a task a year ago still has write access to production.Least privilege, access expiry
SQL injectionAn application passes user input into a query, and the attacker changes what the query does.Application code, query guardrails, least privilege
Unpatched server flawsA bug in the engine lets a low-privilege user run code on the server.Patching, least privilege
Public exposureA database is reachable from the internet with weak or reused credentials.Network and configuration
Insider over-collectionA support engineer exports a table “to check something.”Masking, guardrails, audit
Unmonitored third-party accessA vendor holds a standing database login that nobody reviews.Access control, expiry, audit

Notice that most rows involve a valid login. That is why identity and data-level controls matter as much as the network and the patch level.

How the layers fit together

A useful way to think about it is as three questions that every database connection should be able to answer:

  1. Should this person or application be connected right now? (identity, approval, time limit)
  2. What should this session be allowed to do and see? (least privilege, guardrails, masking)
  3. Can we prove what happened afterward? (audit, monitoring)

If you can answer all three for every connection, you have a defensible program. If you can only answer the first one (“they have the password”), you have a gap.

A practical order of work

  1. Inventory your databases. List every instance, who owns it, what data it holds, and whether it is reachable from the internet. Include the forgotten ones.
  2. Close the network exposure. Remove public addresses and tighten security groups.
  3. Patch. Apply engine updates, ordered by exposure and by whether the flaw is being exploited. See what is the CISA KEV catalog.
  4. Reduce who can connect. Remove shared accounts. List every login and its privileges, and revoke what is not needed. Move human access to production onto requests that expire.
  5. Protect sensitive columns. Decide which data is sensitive, and mask or restrict it for roles that do not need it.
  6. Turn on query-level audit. Make sure you can answer who ran what, and keep the log somewhere the database host cannot alter.
  7. Rehearse the bad day. Practice revoking access and tracing what a compromised account read.

How Cloudanix helps

Cloudanix covers the access, data and activity layers, and connects them to the posture of the cloud around the database.

  • Database JIT gives people keyless, identity-stamped access to PostgreSQL, MySQL, MariaDB, SQL Server and CosmosDB, without shared passwords or a jump host. Access is requested, approved, time-boxed and revoked automatically.
  • Database Access Management (DAM) is an add-on to Database JIT. It runs as a query proxy inside your own environment, so the data it inspects stays in your infrastructure. For PostgreSQL, MySQL and MSSQL it sanity-checks queries for injection patterns, enforces guardrails (for example, blocking delete, drop and truncate, requiring a WHERE clause, restricting tables and columns, and capping row counts), masks sensitive values by role after the query runs, and logs every query to storage you own. DAM cannot be bought without Database JIT.
  • CSPM finds databases exposed to the internet, over-permissioned roles and weak network rules, and ranks them with contextual severity using exposure, environment, data sensitivity and identity.
  • Attack path analysis shows how an identity or misconfiguration leads to a database, which supports the inventory and exposure steps.

For examples, see the end of permanent access for database security, query-level audit and PII masking for databases behind ECS and data-sovereign DAM.

A note on boundaries. Cloudanix does not patch your database engine, and DAM is not an exploit shield for server flaws. Its value is in controlling who gets a session, narrowing what a session can do and see, and keeping a complete record.

Further reading

Frequently asked questions

What is database security?

Database security is the set of controls that protect a database and its data: network and configuration hardening, identity and access control, data-level protection such as masking, monitoring and audit, and recovery planning.

Is encryption enough to secure a database?

No. Encryption at rest protects stolen disks and backups, and encryption in transit protects network traffic. It does not stop someone who connects with a valid login from reading the data. You also need access control, data-level protection and audit.

What is the difference between database security and database activity monitoring?

Database security is the whole discipline. Database activity monitoring is one layer of it: recording and analyzing what users and applications do inside the database. See database activity monitoring and DSPM vs DAM.

Why is standing access to databases risky?

Because any leaked or stolen credential works immediately and indefinitely. Access that exists only while someone has an approved reason shrinks the number of live logins an attacker could use.

Do I need DAM if I already have native database logs?

Native logs show that a connection happened and, with the right settings, which statements ran. They usually do not name the person behind a shared account, mask sensitive columns, or block risky queries. See DAM vs native database logging.

People Also Read

What Our Users Are Saying

Customer Reviews

Cloudanix is trusted by security leaders worldwide to deliver proactive, reliable, and cutting-edge cloud security.

One day, I changed the password of a root account, and my CTO called me within less than a minute to confirm if I did so. I was not expecting a reaction this quick. He told me Cloudanix alerted him of this password change and that he wanted to confirm as it was a critical security notification. I couldn't believe it!

Ritesh Agarwal
Ritesh Agarwal
CEO, Airgap Networks

Compliance is one way of staying secure, but what I want is the ability to go deeper and attain 'true security.' Cloudanix provides us the capability to do so.

Vishal Madan
Vishal Madan
Head of Engineering, iMocha

Cloudanix is building for the future of the cloud, which makes the product all the more desirable.

Ritesh Agarwal
Ritesh Agarwal
CEO, Airgap Networks

Cloudanix gave us the visibility we were missing. Being able to move from permanent access to a robust Just-In-Time (JIT) workflow has fundamentally changed our security posture without slowing down our engineering velocity.

Pavan Kumar Lekkala
Pavan Kumar Lekkala
SRE Lead, HugoHub

We are excited to leverage Cloudanix's comprehensive multi-cloud DevSecOps solution to secure our production workloads on AWS. Cloudanix has demonstrated that it can solve many challenges that DevSecOps teams face while continually adding new features such as SOC2 compliance and drift detection.

Satish Mohan
Satish Mohan
Co-founder & CTO, Airgap Networks

Managing third-party partner access was once a major concern for our security posture. With Cloudanix JIT Cloud, we've effectively achieved zero third-party risk. We can now grant access confidently, knowing that it is temporary, audited, and automatically revoked, resulting in a 100% reduction in our privileged access exposure.

Okesh Badhiye
Okesh Badhiye
Head of Technical Engineering, Finfinity

The snooze feature and responsible alerts have helped us save time and prioritize what to tackle first.

Satish Mohan
Satish Mohan
Co-founder & CTO, Airgap Networks

Implementing Cloudanix JIT internally allowed us to practice what we preach. By eliminating permanent access to our own clouds and databases, we've neutralized the risk of standing privileges, ensuring our own 'keys to the kingdom' are never left exposed.

Girish Manghnani
Girish Manghnani
Managing Partner, Tech Inspira

The problem with permissions is a lot of times, the gaps are left open due to oversights from inside the organization itself. With Cloudanix's CIEM, we get a complete view of user permissions and access. This enables us to update the permissions, reducing the attack surface.

Nilesh Pethani
Nilesh Pethani
Application Architect, iMocha

In the world of Fintech, trust is our currency. Cloudanix provided the frictionless visibility we needed to secure our EKS workloads across AWS, ensuring we stay audit-ready for SOC2 and GDPR without slowing down our engineering velocity.

Amol Naik
Amol Naik
Head of Security & Infrastructure, HugoHub

Cloudanix delivered value within 5 minutes of onboarding. Continuous monitoring, timely detection, and excellent documentation helped us attain a great cloud security posture.

Divyanshu Shukla
Senior DevSecOps, Meesho

Technology strategies and business strategies are in a state of constant change which includes centralization and decentralization of responsibilities. Regardless of strategic shift, we still have intellectual property to protect. Cloudanix are critical partners for us in our public cloud security posture across our three cloud providers.

Jerry Locke
Jerry Locke
Senior Director Global Solutions Engineering, Eversana

Cloudanix has been amazing. They opened up a common Slack channel with us — and it feels like we are talking to our own team and getting things done with Cloud security. The support team is always available, friendly, helpful, and ready to go out of their way.

Satish Mohan
Satish Mohan
CTO, Airgap Networks

Beyond just access management, Cloudanix CSPM has given us a unified view of our AWS environment. The real-time alerting and anomaly detection allow us to prevent any untoward activity before it happens, which is critical for a marketplace connecting 50+ financial institutions.

Okesh Badhiye
Okesh Badhiye
Head of Technical Engineering, Finfinity

For a Fintech company, data is our most valuable — and most sensitive — asset. Cloudanix DAM hasn't just improved our visibility; it has given us control. The ability to mask data and prevent unauthorized queries in real-time is a game-changer for our compliance and customer trust.

Jiten Gala
Jiten Gala
President Engineering and Product, Kapittx

Our clients, especially in the Middle East financial sector, demand absolute accountability. Cloudanix JIT Cloud has been a competitive differentiator for us, allowing us to provide secure, governed access to customer accounts that meet their strictest audit and compliance requirements.

Girish Manghnani
Girish Manghnani
Managing Partner, Tech Inspira

Cloudanix is always on my team's lips because of its exceptional support. Be it a small or big query, Cloudanix has gone above and beyond to resolve them. This one's a keeper for us.

Sujit Karpe
Sujit Karpe
CTO, iMocha

For a long-lasting partnership, great support goes a long way. Cloudanix has delivered exceptional support whenever required. Their edge is their team is always ready to go beyond to solve any issues that we have. This speaks volumes about the culture at Cloudanix.

Akash Maheshwari
Akash Maheshwari
Co-founder, MoveInSync

Beyond the technology, Cloudanix feels like an extension of our own team. Their willingness to stand up a dedicated Middle East tenant for us and provide exceptional support at a sensible price makes them a long-term partner for Hugosave.

Surya Tamada
Surya Tamada
CTO, HugoHub

The real-time notifications that Cloudanix provides are a real lifesaver. Their adaptive notifications ensure that my team stays productive and doesn't get interrupted all the time.

Digvijay Singh
Staff Security Engineer, Meesho

The whole point in technological evolution is to help improve the world we live in. We must protect that and to do so requires an effective and efficient security strategy. The Cloudanix team helped make our public cloud security posture management strategy a reality. The symbiotic relationship we have allows for a continuous feedback loop which is how business should operate.

Larry Wheat
Larry Wheat
Staff Solutions Engineer, Eversana

Ready to see your graph?

Connect a cloud account in under 30 minutes. See every finding rooted in identity, asset, and blast radius — with a fix path attached.

Book a Demo