Database Least Privilege
Database users receive only the permissions required for their legitimate tasks.
Prevent unauthorized users from modifying or deleting sensitive records.
Organizations use PostgreSQL databases to store business-critical information such as customer records, employee information, financial data, application records, and operational data.
Unauthorized modification or deletion of database records can compromise data integrity and may result in incorrect business decisions, loss of important information, compliance issues, and operational disruption.
If a compromised or unauthorized database account has excessive privileges, an attacker may modify or delete sensitive records without authorization.
In this project, a real PostgreSQL application is deployed locally on Ubuntu Linux inside an isolated VirtualBox laboratory. Synthetic sensitive records are created and stored in the PostgreSQL database.
A controlled unauthorized database activity scenario is then simulated using a designated security-testing account. The account is intentionally provided with excessive database privileges for the purpose of the laboratory test.
The test account performs controlled modification and deletion of synthetic records. Wazuh is used to monitor relevant PostgreSQL and system activity, while OpenSearch is used for centralized security investigation.
Database integrity is validated by comparing the original database state with the modified state. After detection, the excessive privileges are removed and the affected records are restored from the controlled backup.
The same unauthorized activity is then retested to confirm that the account can no longer modify or delete protected records.
The complete workflow is: PostgreSQL → Synthetic Sensitive Records → Secure Baseline → Excessive Database Privileges → Controlled Unauthorized Modification/Deletion → Activity Monitoring → Wazuh Detection → OpenSearch Investigation → Integrity Assessment → Privilege Remediation → Data Restoration → Retesting → Integrity Validation
PostgreSQL is the real open-source database application used in this project. It is installed on Ubuntu Linux and configured as a local database server. The database contains synthetic records representing customer information, employee information, financial records, product information, and internal business records.
The security problem occurs when a database account has more privileges than required. An account with excessive privileges may be able to perform database operations that should be restricted, including modification and deletion of sensitive records.
The insecure situation occurs when excessive database privileges allow a database user to perform unauthorized UPDATE and DELETE operations against sensitive PostgreSQL tables, resulting in compromised data integrity.
The security problem is therefore:
The proposed solution introduces database least privilege, database activity monitoring, audit logging, data-integrity validation, backup and recovery, security alerting, centralized investigation, privilege remediation, post-remediation validation, and continuous monitoring.
The controlled attack scenario demonstrates how an account with excessive privileges could modify or delete sensitive database records. The activity is performed against the isolated laboratory using a designated test account and synthetic records only.
The assessment focuses on database-account privileges, unauthorized UPDATE operations, unauthorized DELETE operations, affected records, affected tables, database activity visibility, security-event monitoring, incident investigation, database-integrity impact, privilege remediation, data restoration, and post-remediation access restrictions.
The primary security concepts are Data Integrity, Database Activity Monitoring, Least-Privilege Access Control, and Unauthorized Change Detection.
Sensitive database records should not be modified or deleted unless the operation is authorized. The security workflow combines database access control, database activity monitoring, unauthorized-change detection, security investigation, privilege remediation, data restoration, integrity validation, and continuous monitoring.
The secure processing flow is:
Database users receive only the permissions required for their legitimate tasks.
Prevent unauthorized users from modifying or deleting sensitive records.
PostgreSQL activity is monitored for suspicious database operations.
Detect unexpected modification and deletion activity.
Relevant database activity is recorded.
Provide evidence for security investigation.
Database records are compared against the known-good baseline.
Identify unauthorized changes.
A controlled backup of the test database is maintained.
Allow affected records to be restored after a simulated integrity incident.
Suspicious database activity is monitored through Wazuh.
Provide visibility into potentially unauthorized database operations.
Security events are analyzed using OpenSearch.
Establish the timeline and investigate affected systems and accounts.
Excessive database permissions are removed.
Prevent the test account from continuing unauthorized database operations.
The same controlled activity is repeated after privilege remediation.
Verify that unauthorized modification and deletion are prevented.
Database and system monitoring remains active.
Detect future unauthorized database activity.
PostgreSQL is the real open-source database application used in the project.
Wazuh is used for centralized security monitoring.
OpenSearch is used to investigate the security events collected by Wazuh.
Kali Linux is used as the authorized security-testing system.
Python is used for synthetic data generation and database-integrity validation.
Ubuntu hosts PostgreSQL.
VirtualBox provides the isolated laboratory environment.