Skip to content

Latest commit

 

History

History
86 lines (77 loc) · 13.2 KB

File metadata and controls

86 lines (77 loc) · 13.2 KB

Mitigation Strategies Analysis for mariadb/server

  • Mitigation Strategy: Principle of Least Privilege for Database Users (Server-Side)
  • Description:
    1. Identify application database operations: Determine the specific database operations (SELECT, INSERT, UPDATE, DELETE, CREATE, etc.) required by your application. This is done by analyzing application code and database interaction patterns.
    2. Create dedicated database users on MariaDB: Using MariaDB's CREATE USER statement, create dedicated MariaDB user accounts specifically for your application. Avoid using the root user or overly permissive accounts.
    3. Grant minimal required privileges using MariaDB's GRANT statement: Grant only the necessary privileges to each application user account using the GRANT statement. For example, if an application module only needs to read data from a table, grant only SELECT privileges on that table using GRANT SELECT ON database.table TO 'user'@'host';. Avoid granting GRANT ALL or excessive privileges.
    4. Revoke unnecessary privileges using MariaDB's REVOKE statement: Review existing database users and revoke any privileges that are not strictly required for their intended purpose using the REVOKE statement.
    5. Regularly review user privileges using MariaDB's information schema: Periodically audit database user privileges using MariaDB's information schema tables (e.g., information_schema.user_privileges, information_schema.schema_privileges, information_schema.table_privileges) to ensure they still adhere to the principle of least privilege and adjust as application requirements change.
  • Threats Mitigated:
    • Unauthorized Data Access (Medium Severity): If an application or its credentials are compromised, limiting server-side privileges restricts the attacker's ability to access sensitive data beyond what the application legitimately needs.
    • Data Manipulation (Medium Severity): Server-side privilege restrictions limit the potential damage an attacker can cause if they gain unauthorized access, preventing them from modifying or deleting data if the compromised account lacks those privileges.
    • Privilege Escalation (Low Severity): While not directly preventing privilege escalation vulnerabilities in MariaDB itself, least privilege reduces the impact if such a vulnerability is exploited through a compromised application account.
  • Impact:
    • Unauthorized Data Access (Medium Impact): Significantly reduces the scope of data accessible in case of application compromise due to server-enforced access controls.
    • Data Manipulation (Medium Impact): Limits the ability to modify or delete data if an application account is compromised due to server-enforced write restrictions.
    • Privilege Escalation (Low Impact): Indirectly reduces the impact of potential privilege escalation by limiting the initial privileges available to a compromised account.
  • Currently Implemented:
    • Partially Implemented: Dedicated user accounts are created for the application in database_setup.sql, but initial privilege assignment might be overly broad.
  • Missing Implementation:
    • Granular privilege review and refinement on MariaDB server: A detailed review of currently granted privileges on the MariaDB server is needed to further restrict them to the absolute minimum required for each application module. This needs to be done for all application database users directly on the MariaDB server using GRANT and REVOKE statements and documented in database_user_privileges.md.
  • Mitigation Strategy: Secure Connection Encryption (TLS/SSL) - Server Configuration
  • Description:
    1. Obtain TLS/SSL certificates for MariaDB server: Acquire TLS/SSL certificates specifically for your MariaDB server. You can use certificates from a Certificate Authority (CA) or generate self-signed certificates for testing environments (not recommended for production).
    2. Configure MariaDB server for TLS/SSL in my.cnf or mariadb.conf.d/server.cnf: Modify the MariaDB server configuration file (my.cnf or files in mariadb.conf.d/) to enable TLS/SSL encryption. This involves adding configuration directives like ssl-cert, ssl-key, and ssl-ca to specify the paths to the server certificate, private key, and CA certificate (if applicable).
    3. Enforce TLS/SSL connections on MariaDB server using require_ssl: Configure MariaDB to require TLS/SSL connections for all client connections by setting require_ssl=1 in the server configuration. This ensures that all communication to the server is encrypted.
    4. Restart MariaDB server: After modifying the configuration file, restart the MariaDB server for the changes to take effect.
    5. Verify TLS/SSL encryption using MariaDB client or monitoring tools: Test the connection to the MariaDB server using a MariaDB client or network monitoring tools to confirm that TLS/SSL encryption is active and working correctly. Check server logs for TLS/SSL related messages.
  • Threats Mitigated:
    • Man-in-the-Middle (MitM) Attacks (High Severity): Server-enforced TLS/SSL prevents attackers from eavesdropping on or intercepting communication between the application and the database server, protecting sensitive data in transit.
    • Data Eavesdropping (High Severity): Server-side encryption of data transmitted over the network makes it unreadable to unauthorized parties who might intercept network traffic.
  • Impact:
    • Man-in-the-Middle (MitM) Attacks (High Impact): Effectively mitigates the risk of MitM attacks on database connections due to server-side enforcement.
    • Data Eavesdropping (High Impact): Protects sensitive data from being eavesdropped during transmission by server-side encryption.
  • Currently Implemented:
    • Not Implemented: TLS/SSL encryption is not currently configured on the MariaDB server.
  • Missing Implementation:
    • Server-side TLS/SSL configuration: TLS/SSL needs to be configured on the MariaDB server by modifying the server configuration files (my.cnf or mariadb.conf.d/server.cnf) and installing certificates on the server.
  • Mitigation Strategy: Regular Security Patching and Updates - MariaDB Server
  • Description:
    1. Establish update schedule for MariaDB server: Define a regular schedule for applying security patches and updates specifically to the MariaDB server software and its underlying operating system. Monthly patching is a good starting point, but critical security updates should be applied as soon as possible after release.
    2. Subscribe to MariaDB security mailing lists and advisories: Subscribe to the official MariaDB security mailing list and other relevant security advisories to stay informed about newly discovered vulnerabilities and available patches for the MariaDB server.
    3. Monitor CVE databases for MariaDB vulnerabilities: Regularly monitor Common Vulnerabilities and Exposures (CVE) databases specifically for reported vulnerabilities affecting the MariaDB server versions you are using.
    4. Test MariaDB server updates in a staging environment: Before applying updates to the production MariaDB server, thoroughly test them in a dedicated staging or testing environment that mirrors the production server configuration. This ensures compatibility and prevents unexpected issues on the live server.
    5. Apply MariaDB server updates promptly on production: Once updates are tested and verified in staging, apply them to the production MariaDB server as quickly as possible, especially for critical security patches. Follow vendor-recommended update procedures.
    6. Document MariaDB server update process: Document the specific update process for the MariaDB server, including steps for testing, applying updates, and rollback procedures in case of issues. Keep this documentation updated.
  • Threats Mitigated:
    • Exploitation of Known MariaDB Vulnerabilities (High Severity): Unpatched vulnerabilities in the MariaDB server software can be exploited by attackers to gain unauthorized access to the server and database, execute arbitrary code on the server, or cause denial of service.
  • Impact:
    • Exploitation of Known MariaDB Vulnerabilities (High Impact): Significantly reduces the risk of exploitation of known vulnerabilities in the MariaDB server by keeping the server software up-to-date with vendor-provided security patches.
  • Currently Implemented:
    • Partially Implemented: Operating system updates are generally applied monthly, but MariaDB server software updates are not performed regularly and are often delayed.
  • Missing Implementation:
    • Automated MariaDB server update process: Implement a process for regularly checking for and applying MariaDB server software updates. This could involve using package managers (like apt, yum) or automation tools specifically designed for MariaDB updates.
    • Staging environment updates mirroring production MariaDB: Ensure that the staging environment also has MariaDB server software updated regularly to mirror the production environment's patch level for accurate testing.
    • Documentation of MariaDB server update procedures: Formalize and document the MariaDB server update process, including testing and rollback procedures, in a dedicated security operations manual or server maintenance guide.
  • Mitigation Strategy: Restrict Network Access to MariaDB Server - Server Firewall
  • Description:
    1. Identify necessary access to MariaDB server: Determine which systems and networks legitimately require network access to the MariaDB server. Typically, only application servers and administrative workstations should need direct network access to the database port.
    2. Configure server-level firewall rules (e.g., iptables, firewalld on the MariaDB server host): Implement firewall rules directly on the MariaDB server's host operating system using tools like iptables or firewalld.
    3. Allow only necessary ports and sources in server firewall: Allow inbound connections to the MariaDB server only on the required port (default 3306) and only from trusted source IP addresses or networks (e.g., application server IP ranges, administrator IP addresses). Use specific source IP addresses or network ranges in your firewall rules.
    4. Deny all other access in server firewall: Set the default firewall policy on the MariaDB server to deny all other inbound connections to the MariaDB server port. This acts as a last line of defense on the server itself.
    5. Regularly review server firewall rules: Periodically review and update the firewall rules configured on the MariaDB server to ensure they remain effective and aligned with current access requirements. Remove any obsolete or overly permissive rules.
  • Threats Mitigated:
    • Unauthorized Network Access to MariaDB Server (High Severity): Server-level firewall prevents unauthorized users and systems from directly connecting to the MariaDB server from the network, reducing the attack surface at the server level.
    • Brute-Force Attacks Against MariaDB Authentication (Medium Severity): Limiting network access at the server level can make brute-force attacks against MariaDB authentication more difficult by restricting the number of potential attack sources that can even reach the server's port.
  • Impact:
    • Unauthorized Network Access to MariaDB Server (High Impact): Significantly reduces the risk of unauthorized network access to the database server by enforcing access control directly on the server.
    • Brute-Force Attacks Against MariaDB Authentication (Medium Impact): Makes brute-force attacks more challenging by limiting attack sources that can reach the server's authentication mechanisms.
  • Currently Implemented:
    • Partially Implemented: Basic firewall rules might be in place on the server's operating system, but they might be default rules and not specifically configured for MariaDB access control.
  • Missing Implementation:
    • Strict server-level firewall configuration for MariaDB: Implement specific and restrictive firewall rules on the MariaDB server host using iptables or firewalld to precisely control access to the MariaDB port (3306) from only authorized sources.
    • Detailed server firewall rule documentation: Document the specific firewall rules configured on the MariaDB server and the rationale behind them in server security documentation.