Prerequisites for SQL Firewall

To start using SQL Firewall in DBSecCentral, you must register an Oracle AI Database 26ai target database in DBSecCentral and enable SQL Firewall on it.

Have an administrator follow these steps: Using SQL Firewall with DBSecCentral.

SQL Firewall retrieval

The SQL Firewall policies can be retrieved through the following methods:

Note:

Start Using SQL Firewall

In order to begin using SQL Firewall you need to complete the following steps.

These steps will walk you through:

  1. Step 1: Start SQL Learning for a Database User
  2. (Optional) Step 2: Manually Stop SQL Learning
  3. Step 3: Enable SQL Firewall Policies
  4. Step 4: Set SQL Firewall Behavior for Database Jobs
  5. Step 5: Start Audit Trail for SQL Firewall Violation Log
  6. Step 6: View SQL Firewall Violation Reports
  7. Follow-Up Actions for SQL Firewall

By completing these steps you will be taking steps to protect your database fleet against SQL injection attacks and compromised accounts.

Step 1: Start SQL Learning for a Database User

This step begins recording the usual SQL statements and connection paths for the database user. Run your normal application tasks from trusted connections.

  1. Log in to Oracle Database Security Central Console as an auditor.

  2. Select Policies.

  3. Expand the Firewall Policies tab on the left navigation menu.

  4. Select Oracle SQL Firewall.

  5. Select the database you want to start learning for.

  6. Expand the SQL learning for users section.

  7. Select the user(s) you want to start learning for.

  8. Select Start.

  9. Select the period of time you want to learn SQL statements for.

  10. Enable or disable Top level SQL.

    During the learning phase, SQL Firewall records the SQL workload to build the allowlist. If Top Level SQL is selected, only the top-level SQL or PL/SQL statement is learned. If Top Level SQL is not selected, SQL Firewall also learns and records all SQL statements executed within the PL/SQL statement.

  11. Select Start.

  12. Perform typical daily tasks in your applications for the selected database user until the end of the time period you selected.

(Optional) Step 2: Manually Stop SQL Learning

This step begins recording the usual SQL statements and connection paths for the database user. Run your normal application tasks from trusted connections.

This step is optional because you can wait until SQL learning stops automatically based on the time period you set in the previous step.

  1. Log in to Oracle Database Security Central Console as an auditor.

  2. Select Policies.

  3. Expand the Firewall Policies tab on the left navigation menu.

  4. Select Oracle SQL Firewall.

  5. Select the database of the user you want to stop learning for.

  6. Expand the SQL learning for users section.

  7. Select the user(s) you want to view the collected SQL data for.

  8. Select View learning data.

  9. Select Refresh learning data.

  10. View and filter the data to determine if you have collected a sufficient amount of SQL data.

    Data should be deemed sufficient if it appears that there is no uniquely new activity.

  11. Review the list of session context types and values.

    Reviewing the list of client IP addresses, client programs, and OS usernames allows you to determine where your traffic is coming from. With this information you can set up rules that log or block traffic from all other locations. This is further discussed inCreate a Session Context Only SQL Firewall Policy.

  12. Once you have collected a sufficient amount of unique SQL statements, select Cancel.

    You will be brought back to the overview page for the selected target database.

  13. Select the user(s) you want to stop collecting SQL data for.

  14. Select Stop.

  15. Select Ok.

  16. Refresh the page to see the stop state in the table.

    Note: When SQL learning is stopped, Oracle DBSec Central automatically generates the SQL Firewall policy for the user based off of the SQL statements and session context that was gathered during the learning.

Step 3: Enable SQL Firewall Policies

Review the SQL statements and database connections collected during the learning phase, and enable SQL Firewall policies based on the learned data. Once enabled, the policies determine which SQL statements and connection paths are allowed and whether unauthorized activity is logged or blocked.

  1. Log in to Oracle Database Security Central Console as an auditor.

  2. Select Policies.

  3. Expand the Firewall Policies tab on the left navigation menu.

  4. Select Oracle SQL Firewall.

  5. Select the database of the user you want to enable policies for.

  6. In the SQL Firewall details page for the selected target, expand the SQL Firewall policy for users section.

  7. Select the user(s) you want to enable SQL Firewall polices for.

  8. Select Enable.

  9. Select the Enforcement policy.

    • Session contexts - This option enforces the policy only on the database connection paths collected during learning.

    • SQL statements - This option enforces the policy only on the SQL statements collected during learning.

    • SQL statements & session contexts - This option enforces the policy for both the database connections paths and the SQL statements.

  10. Select the Action on violations

    • Allow and log violations - This option will observe and allow all SQL statements and connections to the database while logging any violations.

    • Block and log violations - This option will block any SQL statements and database connections not listed in the policy and log the violations. Consider this option when you want SQL Firewall to prevent unauthorized SQL traffic to the database.

  11. Select Enable.

Step 4: Set SQL Firewall Behavior for Database Jobs

SQL Firewall can be set to ignore SQL statements run during Oracle Scheduler jobs. This setting applies to all users set up for SQL Firewall monitoring

  1. Log in to Oracle Database Security Central Console as an auditor.

  2. Select Policies.

  3. Expand the Firewall Policies tab on the left navigation menu.

  4. Select Oracle SQL Firewall.

  5. Select the database you want to manage SQL Firewall configuration for Oracle Scheduler jobs.

  6. Select Include or Exclude for Database jobs.

    • This setting applies across the database.

    • When Include is selected, SQL statements and database connections generated by Scheduler jobs are included for database users that are currently in the SQL Firewall learning phase or have SQL Firewall policies, regardless of whether the policies are enabled or disabled.

    • When Exclude is selected, SQL statements and database connections generated by Oracle Scheduler jobs are excluded from SQL Firewall learning and enforcement.

Step 5: Start Audit Trail for SQL Firewall Violation Log

In this step you will start the audit trail to collect SQL Firewall violations which is necessary to view the SQL Firewall violations report.

Use the procedure documented in Configuring Audit Trail Collection to start the SYS.DBA_SQL_FIREWALL_VIOLATIONS audit trail.

Step 6: View SQL Firewall Violation Report

In this step you can view a report of violations for your enabled SQL Firewall policies.

Note: Violations are reported only when SQL statements or database connections do not match the configured SQL Firewall allowlists. As a result, you may not see any violations immediately after enabling a SQL Firewall policy.

The SQL Firewall Violations Report can be found in Activity Reports. For more information see SQL Firewall Violations Report.

Follow-Up Actions for SQL Firewall

In an ideal scenario where the SQL learning has captured all expected SQL statements and trusted database connections, violations indicate potential database attacks such as compromised account access and SQL Injection attacks. But if the collected statements or database connections are not complete or there are new authorized SQL statements following an application update, there is a possibility to see a surge in violations. To avoid false positives in the violations report you can update the SQL Firewall policy with additional context and SQL statements found in the violations report. If there are a large number of false violations, you can delete the current polices for the user and re-learn as necessary.

Related Topics