48 lines
2.0 KiB
Markdown

# 9042/9160 - Pentesting Cassandra
{{#include ../banners/hacktricks-training.md}}
## 基本情報
**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
```
## 列挙
### 手動
```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-hacking/brute-force.md#cassandra)
### **ショーダン**
`port:9160 クラスター`\
`port:9042 "無効またはサポートされていないプロトコルバージョン"`
{{#include ../banners/hacktricks-training.md}}