AWS - MSK Enum

Impara l'hacking di AWS da zero a eroe con htARTE (HackTricks AWS Red Team Expert)!

Altri modi per supportare HackTricks:

Amazon MSK

Amazon Managed Streaming for Apache Kafka (Amazon MSK) è un servizio completamente gestito che facilita lo sviluppo e l'esecuzione di applicazioni che elaborano dati in streaming tramite Apache Kafka. Amazon MSK offre operazioni di controllo, inclusa la creazione, l'aggiornamento e l'eliminazione di cluster. Il servizio consente l'utilizzo delle operazioni di data-plane di Apache Kafka, comprese la produzione e il consumo di dati. Opera su versioni open-source di Apache Kafka, garantendo la compatibilità con le applicazioni, gli strumenti e i plugin esistenti sia dai partner che dalla comunità di Apache Kafka, eliminando la necessità di apportare modifiche al codice dell'applicazione.

Per quanto riguarda l'affidabilità, Amazon MSK è progettato per rilevare e ripristinare automaticamente i comuni scenari di guasto del cluster, garantendo che le applicazioni produttrici e consumatrici continuino le loro attività di scrittura e lettura dei dati con una minima interruzione. Inoltre, mira ad ottimizzare i processi di replica dei dati cercando di riutilizzare lo storage dei broker sostituiti, riducendo così il volume di dati che deve essere replicato da Apache Kafka.

Tipi

Ci sono 2 tipi di cluster Kafka che AWS consente di creare: Provisioned e Serverless.

Dal punto di vista di un attaccante, è necessario sapere che:

  • Serverless non può essere pubblico direttamente (può essere eseguito solo in una VPN senza alcun IP esposto pubblicamente). Tuttavia, Provisioned può essere configurato per ottenere un IP pubblico (per impostazione predefinita non lo ha) e configurare il gruppo di sicurezza per esporre le porte rilevanti.

  • Serverless supporta solo l'autenticazione IAM come metodo di autenticazione. Provisioned supporta l'autenticazione SASL/SCRAM (password), l'autenticazione IAM, l'autenticazione del Certificate Manager (ACM) di AWS e l'accesso non autenticato.

  • Nota che non è possibile esporre pubblicamente un Kafka Provisioned se l'accesso non autenticato è abilitato

Enumerazione

#Get clusters
aws kafka list-clusters
aws kafka list-clusters-v2

# Check the supported authentication
aws kafka list-clusters |  jq -r ".ClusterInfoList[].ClientAuthentication"

# Get Zookeeper endpoints
aws kafka list-clusters | jq -r ".ClusterInfoList[].ZookeeperConnectString, .ClusterInfoList[].ZookeeperConnectStringTls"

# Get nodes and node enspoints
aws kafka kafka list-nodes --cluster-arn <cluster-arn>
aws kafka kafka list-nodes --cluster-arn <cluster-arn> | jq -r ".NodeInfoList[].BrokerNodeInfo.Endpoints" # Get endpoints

# Get used kafka configs
aws kafka list-configurations #Get Kafka config file
aws kafka describe-configuration --arn <config-arn> # Get version of config
aws kafka describe-configuration-revision --arn <config-arn> --revision <version> # Get content of config version

# If using SCRAN authentication, get used AWS secret name (not secret value)
aws kafka list-scram-secrets --cluster-arn <cluster-arn>

Accesso IAM a Kafka (in serverless)

AWS Managed Streaming for Apache Kafka (MSK) è un servizio completamente gestito che semplifica la creazione e la gestione di cluster Apache Kafka su AWS. Quando si utilizza MSK in un ambiente serverless, è importante configurare correttamente l'accesso IAM per garantire la sicurezza del cluster.

Politiche IAM per MSK

Per consentire l'accesso IAM a MSK, è necessario creare una politica IAM che definisca i permessi necessari. Di seguito è riportato un esempio di politica IAM che consente di leggere e scrivere su un cluster MSK:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "kafka:Describe*",
                "kafka:List*",
                "kafka:Get*",
                "kafka:DescribeCluster",
                "kafka:DescribeConfiguration",
                "kafka:DescribeConfigurationRevision",
                "kafka:GetBootstrapBrokers",
                "kafka:GetCompatibleKafkaVersions",
                "kafka:ListClusterOperations",
                "kafka:ListConfigurations",
                "kafka:ListNodes",
                "kafka:ListTagsForResource",
                "kafka:View*",
                "kafka:Connect*",
                "kafka:Create*",
                "kafka:Update*",
                "kafka:Delete*",
                "kafka:TagResource",
                "kafka:UntagResource",
                "kafka:BatchAssociateScramSecret",
                "kafka:BatchDisassociateScramSecret",
                "kafka:BatchUpdateKafkaVersion",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdateClusterConfiguration",
                "kafka:BatchUpdateMonitoring",
                "kafka:BatchUpdateSecurity",
                "kafka:BatchUpdateMaintenanceWindow",
                "kafka:BatchUpdateBrokerCount",
                "kafka:BatchUpdate
```bash
# Guide from https://docs.aws.amazon.com/msk/latest/developerguide/create-serverless-cluster.html
# Download Kafka
wget https://archive.apache.org/dist/kafka/2.8.1/kafka_2.12-2.8.1.tgz
tar -xzf kafka_2.12-2.8.1.tgz

# In kafka_2.12-2.8.1/libs download the MSK IAM JAR file.
cd kafka_2.12-2.8.1/libs
wget https://github.com/aws/aws-msk-iam-auth/releases/download/v1.1.1/aws-msk-iam-auth-1.1.1-all.jar

# Create file client.properties in kafka_2.12-2.8.1/bin
security.protocol=SASL_SSL
sasl.mechanism=AWS_MSK_IAM
sasl.jaas.config=software.amazon.msk.auth.iam.IAMLoginModule required;
sasl.client.callback.handler.class=software.amazon.msk.auth.iam.IAMClientCallbackHandler

# Export endpoints address
export BS=boot-ok2ngypz.c2.kafka-serverless.us-east-1.amazonaws.com:9098
## Make sure you will be able to access the port 9098 from the EC2 instance (check VPS, subnets and SG)

# Create a topic called msk-serverless-tutorial
kafka_2.12-2.8.1/bin/kafka-topics.sh --bootstrap-server $BS --command-config client.properties --create --topic msk-serverless-tutorial --partitions 6

# Send message of every new line
kafka_2.12-2.8.1/bin/kafka-console-producer.sh --broker-list $BS --producer.config client.properties --topic msk-serverless-tutorial

# Read messages
kafka_2.12-2.8.1/bin/kafka-console-consumer.sh --bootstrap-server $BS --consumer.config client.properties --topic msk-serverless-tutorial --from-beginning

Privesc

pageAWS - MSK Privesc

Accesso non autenticato

pageAWS - MSK Unauthenticated Enum

Persistenza

Se hai accesso alla VPC in cui si trova un Kafka Provisionato, puoi abilitare l'accesso non autorizzato, se l'autenticazione SASL/SCRAM è abilitata, leggere la password dal segreto, dare alcune altre autorizzazioni IAM controllate (se viene utilizzato IAM o serverless) o persistere con certificati.

Riferimenti

Impara l'hacking di AWS da zero a eroe con htARTE (HackTricks AWS Red Team Expert)!

Altri modi per supportare HackTricks:

Last updated