SQL Injection in Oracle Escalates to SYSTEM Execution on Windows via Embedded Java Compilation

A real-world intrusion chain demonstrates how a basic SQL injection can lead to command execution on Windows with SYSTEM privileges. Attackers leveraged Oracle Database's ability to load, compile, and run Java code inside the database engine itself. After gaining initial database access through an internet-exposed application, the threat actors introduced Java source code, converted it into schema objects, and compiled it directly on the server. This technique, tracked under the artifact name khunt and linked to Huntress telemetry, minimizes reliance on traditional disk binaries and shifts tooling into the less-monitored database engine. When the Oracle process runs with elevated rights on Windows, the chained execution inherits high privileges up to SYSTEM level. The incident underscores the need for parameterized queries, disabling unnecessary Java functionality in Oracle, and monitoring specific DDL events such as CREATE JAVA SOURCE and CREATE JAVA CLASS.

HispasecTranslated from Spanish

Read at source

A real-world intrusion chain observed in active attacks shows how a simple SQL injection can escalate to full command execution on Windows with SYSTEM privileges. The pivot relies on Oracle Database and its built-in capability to load, compile, and execute Java inside the database engine, a powerful feature that significantly expands the attack surface when left enabled without proper controls.

The intrusion began with a basic SQL injection in an internet-facing application and progressed to command execution on a Windows server under SYSTEM rights. The critical turning point was not a new operating-system vulnerability but a legitimate Oracle Database function that allows Java source code to be loaded, compiled, and executed as part of the database's internal logic.

After obtaining database access, the attackers inserted Java source code, turned it into schema objects, and compiled it directly on the server. This post-exploitation method is particularly challenging for defenders because it reduces dependence on classic on-disk binaries and moves tooling inside the database engine, which is often monitored less rigorously than the operating system or web server.

The activity has been associated with an artifact named khunt, linked to telemetry from Huntress. The ultimate goal is to convert an application-level entry point into a pathway for executing actions on the host. When the Oracle process runs with elevated permissions on Windows, any execution chained from the database context can inherit very high privileges, up to SYSTEM, posing severe risks to the rest of the machine and its data.

The chain reinforces a well-known but frequently ignored principle: defense must start at the application layer. Remediation requires replacing string concatenation with parameterized queries and strict input validation. Database administrators should then evaluate whether Java support in Oracle is truly necessary; if not, it should be disabled or heavily restricted.

Security teams can improve visibility by monitoring specific signals inside Oracle, including statements and events such as CREATE JAVA SOURCE, CREATE JAVA CLASS, and compilation operations. Additional hardening steps include limiting users who can execute Java-related DDL, applying least-privilege principles to the application database account, and preventing the Oracle service from running with unnecessary Windows privileges.

Meridian digestThe week's most consequential security stories, distilled into one briefing.See the digest

More in Vulnerabilities & Exploits

Telegram for Android Patches Voice Call Vulnerability Enabling Code Execution
Yandex Patches Millions of Stations After eMudhra Certificate Keys Compromised
Cisco ASA and FTD Face DoS Vulnerability in SSL VPN Already Exploited in the Wild