# 554,8554 - Pentesting RTSP {% hint style="success" %} Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks * Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! * **Join the** ๐Ÿ’ฌ [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** ๐Ÿฆ [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** * **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %} ## Basic Information From [wikipedia](https://en.wikipedia.org/wiki/Real\_Time\_Streaming\_Protocol): > **์‹ค์‹œ๊ฐ„ ์ŠคํŠธ๋ฆฌ๋ฐ ํ”„๋กœํ† ์ฝœ** (**RTSP**)๋Š” ์ŠคํŠธ๋ฆฌ๋ฐ ๋ฏธ๋””์–ด ์„œ๋ฒ„๋ฅผ ์ œ์–ดํ•˜๊ธฐ ์œ„ํ•ด ์—”ํ„ฐํ…Œ์ธ๋จผํŠธ ๋ฐ ํ†ต์‹  ์‹œ์Šคํ…œ์—์„œ ์‚ฌ์šฉํ•˜๋„๋ก ์„ค๊ณ„๋œ ๋„คํŠธ์›Œํฌ ์ œ์–ด ํ”„๋กœํ† ์ฝœ์ž…๋‹ˆ๋‹ค. ์ด ํ”„๋กœํ† ์ฝœ์€ ์—”๋“œ ํฌ์ธํŠธ ๊ฐ„์˜ ๋ฏธ๋””์–ด ์„ธ์…˜์„ ์„ค์ •ํ•˜๊ณ  ์ œ์–ดํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ๋ฏธ๋””์–ด ์„œ๋ฒ„์˜ ํด๋ผ์ด์–ธํŠธ๋Š” ์„œ๋ฒ„์—์„œ ํด๋ผ์ด์–ธํŠธ๋กœ์˜ ๋ฏธ๋””์–ด ์ŠคํŠธ๋ฆฌ๋ฐ(์ฃผ๋ฌธํ˜• ๋น„๋””์˜ค) ๋˜๋Š” ํด๋ผ์ด์–ธํŠธ์—์„œ ์„œ๋ฒ„๋กœ์˜ ๋ฏธ๋””์–ด ์ŠคํŠธ๋ฆฌ๋ฐ(์Œ์„ฑ ๋…น์Œ)์„ ์‹ค์‹œ๊ฐ„์œผ๋กœ ์ œ์–ดํ•˜๊ธฐ ์œ„ํ•ด ์žฌ์ƒ, ๋…นํ™” ๋ฐ ์ผ์‹œ ์ •์ง€์™€ ๊ฐ™์€ VHS ์Šคํƒ€์ผ์˜ ๋ช…๋ น์„ ๋ฐœํ–‰ํ•ฉ๋‹ˆ๋‹ค. > > ์ŠคํŠธ๋ฆฌ๋ฐ ๋ฐ์ดํ„ฐ ์ž์ฒด์˜ ์ „์†ก์€ RTSP์˜ ์ž‘์—…์ด ์•„๋‹™๋‹ˆ๋‹ค. ๋Œ€๋ถ€๋ถ„์˜ RTSP ์„œ๋ฒ„๋Š” ๋ฏธ๋””์–ด ์ŠคํŠธ๋ฆผ ์ „์†ก์„ ์œ„ํ•ด ์‹ค์‹œ๊ฐ„ ์ „์†ก ํ”„๋กœํ† ์ฝœ(RTP)๊ณผ ์‹ค์‹œ๊ฐ„ ์ œ์–ด ํ”„๋กœํ† ์ฝœ(RTCP)์„ ํ•จ๊ป˜ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ผ๋ถ€ ๊ณต๊ธ‰์—…์ฒด๋Š” ๋…์  ์ „์†ก ํ”„๋กœํ† ์ฝœ์„ ๊ตฌํ˜„ํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, RealNetworks์˜ RTSP ์„œ๋ฒ„ ์†Œํ”„ํŠธ์›จ์–ด๋Š” RealNetworks์˜ ๋…์ ์ ์ธ ์‹ค์‹œ๊ฐ„ ๋ฐ์ดํ„ฐ ์ „์†ก(RDT)๋„ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค. **๊ธฐ๋ณธ ํฌํŠธ:** 554,8554 ``` PORT STATE SERVICE 554/tcp open rtsp ``` ## Key Details **RTSP**๋Š” HTTP์™€ ์œ ์‚ฌํ•˜์ง€๋งŒ ๋ฏธ๋””์–ด ์ŠคํŠธ๋ฆฌ๋ฐ์„ ์œ„ํ•ด ํŠน๋ณ„ํžˆ ์„ค๊ณ„๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๊ฐ„๋‹จํ•œ ์‚ฌ์–‘์ด ์ •์˜๋˜์–ด ์žˆ์œผ๋ฉฐ, ์—ฌ๊ธฐ์—์„œ ์ฐพ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค: [RTSP โ€“ RFC2326](https://tools.ietf.org/html/rfc2326) ์žฅ์น˜๋Š” **์ธ์ฆ๋˜์ง€ ์•Š์€** ๋˜๋Š” **์ธ์ฆ๋œ** ์•ก์„ธ์Šค๋ฅผ ํ—ˆ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด "DESCRIBE" ์š”์ฒญ์ด ์ „์†ก๋ฉ๋‹ˆ๋‹ค. ๊ธฐ๋ณธ ์˜ˆ์‹œ๋Š” ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค: `DESCRIBE rtsp://: RTSP/1.0\r\nCSeq: 2\r` ์˜ฌ๋ฐ”๋ฅธ ํ˜•์‹์€ ์ผ๊ด€๋œ ์‘๋‹ต์„ ์œ„ํ•ด ์ด์ค‘ "\r\n"์„ ํฌํ•จํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. "200 OK" ์‘๋‹ต์€ **์ธ์ฆ๋˜์ง€ ์•Š์€ ์•ก์„ธ์Šค**๋ฅผ ๋‚˜ํƒ€๋‚ด๊ณ , "401 Unauthorized"๋Š” ์ธ์ฆ์ด ํ•„์š”ํ•จ์„ ๋‚˜ํƒ€๋‚ด๋ฉฐ, **Basic** ๋˜๋Š” **Digest authentication**์ด ํ•„์š”ํ•œ์ง€ ์—ฌ๋ถ€๋ฅผ ๋“œ๋Ÿฌ๋ƒ…๋‹ˆ๋‹ค. **Basic authentication**์˜ ๊ฒฝ์šฐ, ์‚ฌ์šฉ์ž ์ด๋ฆ„๊ณผ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ base64๋กœ ์ธ์ฝ”๋”ฉํ•˜๊ณ  ์š”์ฒญ์— ๋‹ค์Œ๊ณผ ๊ฐ™์ด ํฌํ•จํ•ฉ๋‹ˆ๋‹ค: `DESCRIBE rtsp://: RTSP/1.0\r\nCSeq: 2\r\nAuthorization: Basic YWRtaW46MTIzNA==\r` ์ด ์˜ˆ์‹œ๋Š” ์ž๊ฒฉ ์ฆ๋ช…์œผ๋กœ "admin"๊ณผ "1234"๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์Œ์€ ๊ทธ๋Ÿฌํ•œ ์š”์ฒญ์„ ๋ณด๋‚ด๊ธฐ ์œ„ํ•œ **Python ์Šคํฌ๋ฆฝํŠธ**์ž…๋‹ˆ๋‹ค: ```python import socket req = "DESCRIBE rtsp://: RTSP/1.0\r\nCSeq: 2\r\nAuthorization: Basic YWRtaW46MTIzNA==\r\n\r\n" s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(("192.168.1.1", 554)) s.sendall(req) data = s.recv(1024) print(data) ``` **๊ธฐ๋ณธ ์ธ์ฆ**์€ ๋” ๊ฐ„๋‹จํ•˜๊ณ  ์„ ํ˜ธ๋ฉ๋‹ˆ๋‹ค. **๋‹ค์ด์ œ์ŠคํŠธ ์ธ์ฆ**์€ "401 Unauthorized" ์‘๋‹ต์— ์ œ๊ณต๋œ ์ธ์ฆ ์„ธ๋ถ€์ •๋ณด๋ฅผ ์‹ ์ค‘ํ•˜๊ฒŒ ์ฒ˜๋ฆฌํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด ๊ฐœ์š”๋Š” RTSP ์ŠคํŠธ๋ฆผ์— ์ ‘๊ทผํ•˜๋Š” ๊ณผ์ •์„ ๋‹จ์ˆœํ™”ํ•˜๋ฉฐ, ์ดˆ๊ธฐ ์‹œ๋„์—์„œ์˜ ๋‹จ์ˆœ์„ฑ๊ณผ ์‹ค์šฉ์„ฑ์„ ์œ„ํ•ด **๊ธฐ๋ณธ ์ธ์ฆ**์— ์ค‘์ ์„ ๋‘ก๋‹ˆ๋‹ค. ## ์—ด๊ฑฐ ์œ ํšจํ•œ ๋ฉ”์„œ๋“œ์™€ ์ง€์›๋˜๋Š” URL์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ์–ป๊ณ , ์ฝ˜ํ…์ธ ์— ์ ‘๊ทผํ•˜๊ธฐ ์œ„ํ•ด (ํ•„์š”ํ•œ ๊ฒฝ์šฐ) ๋ฌด์ฐจ๋ณ„ ๋Œ€์ž… ๊ณต๊ฒฉ์„ ์‹œ๋„ํ•ด ๋ด…์‹œ๋‹ค. ```bash nmap -sV --script "rtsp-*" -p ``` ### [Brute Force](../generic-methodologies-and-resources/brute-force.md#rtsp) ### **๊ธฐํƒ€ ์œ ์šฉํ•œ ํ”„๋กœ๊ทธ๋žจ** Bruteforce๋ฅผ ์œ„ํ•ด: [https://github.com/Tek-Security-Group/rtsp\_authgrinder](https://github.com/Tek-Security-Group/rtsp\_authgrinder) [**Cameradar**](https://github.com/Ullaakut/cameradar) * ์ ‘๊ทผ ๊ฐ€๋Šฅํ•œ ๋Œ€์ƒ์—์„œ ์—ด๋ฆฐ RTSP ํ˜ธ์ŠคํŠธ ๊ฐ์ง€ * ๊ทธ๋“ค์˜ ๊ณต๊ฐœ ์ •๋ณด(ํ˜ธ์ŠคํŠธ ์ด๋ฆ„, ํฌํŠธ, ์นด๋ฉ”๋ผ ๋ชจ๋ธ ๋“ฑ) ๊ฐ€์ ธ์˜ค๊ธฐ * ์ŠคํŠธ๋ฆผ ๊ฒฝ๋กœ๋ฅผ ์–ป๊ธฐ ์œ„ํ•ด ์ž๋™ํ™”๋œ ์‚ฌ์ „ ๊ณต๊ฒฉ ์‹œ์ž‘(์˜ˆ: /live.sdp) * ์นด๋ฉ”๋ผ์˜ ์‚ฌ์šฉ์ž ์ด๋ฆ„๊ณผ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์–ป๊ธฐ ์œ„ํ•ด ์ž๋™ํ™”๋œ ์‚ฌ์ „ ๊ณต๊ฒฉ ์‹œ์ž‘ * ์ŠคํŠธ๋ฆผ์ด ์œ ํšจํ•œ์ง€ ํ™•์ธํ•˜๊ณ  ์ฝ˜ํ…์ธ ์˜ ๋น ๋ฅธ ๋ฏธ๋ฆฌ๋ณด๊ธฐ๋ฅผ ์œ„ํ•ด ์ธ๋„ค์ผ ์ƒ์„ฑ * ์ œ๋Œ€๋กœ ์ธ์ฝ”๋”ฉ๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด Gstreamer ํŒŒ์ดํ”„๋ผ์ธ ์ƒ์„ฑ ์‹œ๋„ * Cameradar๊ฐ€ ์–ป์„ ์ˆ˜ ์žˆ๋Š” ๋ชจ๋“  ์ •๋ณด์˜ ์š”์•ฝ ์ธ์‡„ ## References * [https://en.wikipedia.org/wiki/Real\_Time\_Streaming\_Protocol](https://en.wikipedia.org/wiki/Real\_Time\_Streaming\_Protocol) * [http://badguyfu.net/rtsp-brute-forcing-for-fun-and-naked-pictures/](http://badguyfu.net/rtsp-brute-forcing-for-fun-and-naked-pictures/) * [https://github.com/Ullaakut/cameradar](https://github.com/Ullaakut/cameradar) {% hint style="success" %} Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks * Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! * **Join the** ๐Ÿ’ฌ [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** ๐Ÿฆ [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** * **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %}