Blind SQL injection with out-of-band interaction for oracle database

Blind SQL Injection with Out-of-Band Interaction (Oracle Database)

Lab Overview

This lab demonstrates a blind SQL injection vulnerability in an Oracle database environment where the application does not return any visible database output, error messages, or timing differences that can reliably be used for inference. Instead, the vulnerability is confirmed through out-of-band (OOB) interaction using DNS lookup, triggered by SQL execution on the backend database.

The attack is validated using Burp Suite Collaborator, which detects external DNS requests initiated by the database server. When the database resolves a domain controlled by the attacker, it provides definitive proof that SQL injection is present and that arbitrary SQL execution is possible.

This technique is particularly important in real-world penetration testing scenarios where applications are heavily hardened, and traditional injection methods such as UNION-based, boolean-based, or time-based SQL injection are not viable.


Understanding Out-of-Band SQL Injection in Oracle

Out-of-band SQL injection is a technique where the attacker does not rely on the application’s HTTP response to retrieve data. Instead, the attacker forces the database to initiate an external network interaction.

In Oracle environments, this can occur through internal database functions capable of performing external resolution or network communication. When properly abused, these functions allow the database to make DNS requests to attacker-controlled domains.

The key idea is simple but powerful:

If the database performs a DNS lookup to a domain controlled by the attacker, SQL injection is confirmed.

This method bypasses all traditional response-based detection mechanisms, making it one of the most reliable techniques for blind SQL injection validation.


SQL Injection Context and String Manipulation

In Oracle-based applications, SQL injection often occurs within string concatenation contexts where user input is embedded into a query using the concatenation operator:

'|| <payload> ||'

This allows attackers to break out of the original SQL string context and inject custom SQL expressions.

A typical injection structure follows this pattern:

'|| (SELECT ... FROM dual) ||'

The dual table is a special Oracle system table used for evaluating expressions. It is commonly used in injection scenarios because it guarantees a valid query structure.

This mechanism becomes the foundation for embedding out-of-band payloads into SQL execution flow.


Triggering DNS Resolution via SQL Execution

The goal of this attack is to force the Oracle database to perform a DNS lookup to a domain controlled by Burp Collaborator.

This is achieved by injecting SQL expressions that indirectly trigger external name resolution.

The payload is designed so that when the database evaluates it, it performs a lookup to an attacker-controlled domain. Even though no output is returned to the application, the external DNS request is generated in the background.

This makes it possible to detect SQL injection even when:

  • No data is returned
  • No errors are shown
  • No timing differences exist

Burp Collaborator as the Validation Channel

Burp Suite Collaborator plays a critical role in this lab. It provides a unique domain that is fully controlled by the attacker and logs any interactions with it.

When the database triggers a DNS lookup, the following occurs:

  • The target server attempts to resolve the Collaborator domain
  • The request reaches Burp’s external server
  • The interaction is logged and displayed to the attacker

This creates a direct confirmation channel that bypasses the application entirely.

A single DNS interaction is sufficient to confirm SQL injection exploitation.


Constructing the OOB Payload

The payload is constructed to embed a Burp Collaborator domain inside SQL logic so that Oracle is forced to resolve it during query execution.

A conceptual payload structure looks like this:

'|| (SELECT SOME_FUNCTION('abc123xyz.oastify.com') FROM dual) ||'

In real-world scenarios, different Oracle functions or constructs may be used depending on database configuration. The key requirement is that the database processes the domain name in a way that triggers external resolution.

Once executed, the database attempts to resolve the domain, initiating a DNS request.


Injecting the Payload into the Application

The payload is delivered through a vulnerable parameter such as:

  • Query string parameters
  • Cookies (e.g., TrackingId)
  • HTTP headers

Example injection context:

Cookie: TrackingId='||<payload>||'; session=xyz

or:

GET /product?category='||<payload>||' HTTP/1.1

Once submitted:

  • The application shows no visible changes
  • No errors are generated
  • No timing differences are observed

From the user perspective, the request appears normal.

However, the backend database may be executing the injected SQL logic.


Confirming the Attack via DNS Interaction

After sending the payload, the attacker checks Burp Collaborator for any incoming interactions.

If successful, the following is observed:

  • DNS lookup request received
  • Domain matches attacker-controlled Collaborator URL
  • Source IP corresponds to target infrastructure
  • Timestamp confirms execution time

This confirms that:

  • SQL injection exists
  • The database executed injected logic
  • External network interaction is possible

Unlike other blind SQL injection techniques, this provides direct external proof of execution rather than inference.

LAB Example: 


Why DNS-Based Out-of-Band Injection Works

DNS-based exfiltration is widely used in out-of-band SQL injection because:

  • DNS traffic is rarely blocked in enterprise environments
  • It requires minimal payload complexity
  • It works even when HTTP responses are fully sanitized
  • It generates external observable logs

Even heavily secured applications may still allow backend DNS resolution, making this technique highly effective.


Oracle Database Considerations

Oracle databases can be particularly vulnerable to out-of-band SQL injection if network-related functionality is misconfigured or overly permissive.

In some environments, Oracle may support external resolution or network interactions through internal packages or functions such as:

  • XML processing functions
  • Network-related packages
  • External resolution utilities

If these capabilities are exposed to untrusted input, attackers can force:

  • DNS lookups
  • External HTTP requests
  • Data exfiltration via domain embedding

This makes Oracle environments especially sensitive when misconfigured.


Security Impact

Out-of-band SQL injection is considered critical severity because it allows:

  • Confirmation of SQL injection without response visibility
  • Bypassing of WAF and response filtering
  • External validation of backend execution
  • Potential data exfiltration via DNS channels

Even when no direct data extraction occurs, attackers gain proof of backend control, which is often the first step in full compromise.


Detection and Monitoring

Detection of OOB SQL injection is challenging because it does not rely on application responses.

However, it can be identified through:

  • Unexpected DNS requests from database servers
  • Outbound traffic to unknown or random domains
  • Repeated external resolution attempts
  • Suspicious patterns in application-triggered network activity

Security tools such as ModSecurity can help detect injection patterns at the application layer, but DNS-based attacks often require:

  • Network-level monitoring
  • DNS logging and inspection
  • Database activity auditing

Monitoring outbound DNS traffic from database servers is especially critical in preventing this type of exploitation.


Root Cause and Remediation

The root cause of this vulnerability is insecure SQL query construction combined with unnecessary or exposed database network capabilities.

Even though the application does not return output, the database still executes attacker-controlled logic.

Recommended mitigations include:

  • Use parameterized queries (prepared statements)
  • Eliminate dynamic SQL construction
  • Restrict or disable external network capabilities in the database
  • Block outbound DNS/HTTP traffic from database servers
  • Enforce strict least-privilege access controls

Additional hardening steps:

  • Monitor DNS logs for anomalies
  • Restrict Oracle network-related packages
  • Implement strict egress firewall rules
  • Audit database function usage regularly

Comments

Popular posts from this blog

Linux AAA

Peppermint Ticketing Software for help desk technicians.

What is Osint?