hacktricks/network-services-pentesting/cassandra.md
2023-07-07 23:42:27 +00:00

100 lines
6.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 9042/9160 - Pentesting Cassandra
<details>
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
- **サイバーセキュリティ会社**で働いていますか? **HackTricksで会社を宣伝**したいですか?または、**PEASSの最新バージョンにアクセスしたり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
- [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を見つけてください。独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
- [**公式のPEASSHackTricksのグッズ**](https://peass.creator-spring.com)を手に入れましょう。
- [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
- **ハッキングのトリックを共有するには、[hacktricksリポジトリ](https://github.com/carlospolop/hacktricks)と[hacktricks-cloudリポジトリ](https://github.com/carlospolop/hacktricks-cloud)**にPRを提出してください。
</details>
## 基本情報
Apache Cassandraは、大量のデータを多数のコモディティサーバー上で処理し、単一障害点のない高可用性を提供するために設計された、高いスケーラビリティと高性能を備えた分散データベースです。これはNoSQLデータベースの一種です。\
いくつかのケースでは、**cassandraは任意の資格情報を受け入れる**(設定されていないため)ため、データベースを列挙することができます。
**デフォルトポート:** 9042,9160
```
PORT STATE SERVICE REASON
9042/tcp open cassandra-native Apache Cassandra 3.10 or later (native protocol versions 3/v3, 4/v4, 5/v5-beta)
9160/tcp open cassandra syn-ack
```
## 列挙
### 手動
Cassandraは、データベースのバージョン情報を公開しないため、バージョンを特定するためには手動で列挙する必要があります。
1. Cassandraのデフォルトのポートである9042番ポートをスキャンします。
2. ポートが開いている場合、`cqlsh`コマンドを使用してCassandraに接続します。
3. 接続が成功した場合、`SELECT release_version FROM system.local;`コマンドを実行してバージョン情報を取得します。
```bash
cqlsh -u <username> -p <password> <target_ip> -e "SELECT release_version FROM system.local;"
```
4. バージョン情報が表示されれば、Cassandraのバージョンが特定できます。
### 自動化
自動化ツールを使用してCassandraのバージョンを特定することもできます。例えば、`nmap`を使用してバージョン情報を取得することができます。
```bash
nmap -p 9042 --script cassandra-info <target_ip>
```
または、`cassandra_version`モジュールを使用してバージョン情報を取得することもできます。
```bash
msfconsole -x "use auxiliary/scanner/cassandra/cassandra_version; set RHOSTS <target_ip>; run"
```
```bash
pip install cqlsh
cqlsh <IP>
#Basic info enumeration
SELECT cluster_name, thrift_version, data_center, partitioner, native_protocol_version, rack, release_version from system.local;
#Keyspace enumeration
SELECT keyspace_name FROM system.schema_keyspaces;
desc <Keyspace_name> #Decribe that DB
desc system_auth #Describe the DB called system_auth
SELECT * from system_auth.roles; #Retreive that info, can contain credential hashes
SELECT * from logdb.user_auth; #Can contain credential hashes
SELECT * from logdb.user;
SELECT * from configuration."config";
```
### 自動化
ここではあまりオプションはありませんし、nmapはあまり情報を取得しません。
```bash
nmap -sV --script cassandra-info -p <PORT> <IP>
```
### [**ブルートフォース**](../generic-methodologies-and-resources/brute-force.md#cassandra)
### **Shodan**
`port:9160 Cluster`\
`port:9042 "Invalid or unsupported protocol version"`
<details>
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
- **サイバーセキュリティ企業で働いていますか?** **HackTricksで会社を宣伝**したいですか?または、**PEASSの最新バージョンにアクセスしたり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
- [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を発見しましょう。独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
- [**公式のPEASSHackTricksのグッズ**](https://peass.creator-spring.com)を手に入れましょう。
- [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**をフォロー**してください。
- **ハッキングのトリックを共有するには、[hacktricksリポジトリ](https://github.com/carlospolop/hacktricks)と[hacktricks-cloudリポジトリ](https://github.com/carlospolop/hacktricks-cloud)にPRを提出**してください。
</details>