> For the complete documentation index, see [llms.txt](https://sayonara.gitbook.io/writeups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sayonara.gitbook.io/writeups/ctf/cybercoliseum-ii-ctf-2023/forensics/encrypted-traffic.md).

# encrypted traffic

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FdCUu1i34u8DSJNDTpzsQ%2Fimage.png?alt=media&amp;token=e850c4ac-a3a4-4186-9fff-f1bb3198150d" alt=""><figcaption></figcaption></figure></div>

### <mark style="color:red;">File Attachment :</mark>&#x20;

{% file src="/files/zSFIWwCBlNPXat7wmO0W" %}

### <mark style="color:purple;">Challenge Idea :</mark>&#x20;

the idea of this challenge is decrypting https traffic using a master log file and extracting a protected secret zip file that contains base64 encoded flag

### <mark style="color:red;">Walkthrough :</mark>&#x20;

first thing let's open the pcapng file in wireshark and analyze the traffic

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2F6rHlIV7RdB6vNVH0XYhF%2Fimage.png?alt=media&amp;token=83f7a38f-68b5-4dcf-87d1-b0100b3ede10" alt=""><figcaption></figcaption></figure></div>

first let's see what are all the protocols captured in this network file

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2Fcg9lXCemoqHDigCgMugI%2Fimage.png?alt=media&amp;token=ac8bd595-83a5-4aa7-8b64-a5c241330660" alt=""><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FVhJtOSLSnFeRUY7i7lXh%2Fimage.png?alt=media&amp;token=3db9e83d-c611-46e1-b232-1d7bf97aba02" alt=""><figcaption></figcaption></figure></div>

based on the name of the challenge which is `encrypted traffic` we should focus more on TLS protocol which is responsible for encrypting http traffic

in the task attachment we have `sslkey.log` which can be used as a pre-master secret log file to decrypt HTTPS traffic to do that go to edit -> preferences -> protocols -> TLS -> (pre)-master secret log filename and browse to the sslkey.log file and then click ok&#x20;

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FFkfpYMCFYIgNcIRE13z0%2Fimage.png?alt=media&amp;token=c1b5a98a-e283-42dc-a929-4d2ec831012e" alt=""><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FSTnjyGo0NCjFosbqQOIw%2Fimage.png?alt=media&amp;token=d602de09-7708-4ff7-ade5-d7d112674ff6" alt=""><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2F2A9UdJDjLvvTC7IJgpGb%2Fimage.png?alt=media&amp;token=980f5b4c-70df-4659-a3bf-a038908f1156" alt=""><figcaption></figcaption></figure></div>

again let's take a look at the protocol hierarchy at statistics -> protocol hierarchy&#x20;

we can notice that a new protocol is introduced which is a result of the decryption of https traffic

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FdLsgWwJGuyckGs4ZVn2b%2Fimage.png?alt=media&amp;token=65b6ebb6-3bf0-4b46-89a5-23dcac30a3d0" alt=""><figcaption></figcaption></figure></div>

in wireshark let's filter by http&#x20;

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FlC0eHWsR094nEV8MpHlI%2Fimage.png?alt=media&amp;token=2be0eebd-3d21-4cc3-8f84-d44c92945c89" alt=""><figcaption></figcaption></figure></div>

let's export http files and take a look at there content and try to search for the leaked information

go to file -> export objects -> http

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FpU35siACtQfMspjNj39F%2Fimage.png?alt=media&amp;token=a5f98848-e944-42ad-b276-1572f2463201" alt=""><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2Fh7BexPFKehSOoFFInvw9%2Fimage.png?alt=media&amp;token=467fb503-c6ee-4c20-b88a-7923456f7a5f" alt=""><figcaption></figcaption></figure></div>

let's save all the files and try to examine the files for any leaked infos.

first thing we have to check the files type because for exemple the file show is a png file but we can't see its content unless we have added the .png extention to the filename

after looking at all the files there's an interesting file which is a zip file

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2Fn9jxHDTYDHlJkebG1Zfp%2Fimage.png?alt=media&amp;token=b2d1221f-032f-4aa6-bd66-9dde2e2a224b" alt=""><figcaption></figcaption></figure></div>

let's change the name and add the extension of zip

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2F8S9qpvmnKhKOUKy8Blen%2Fimage.png?alt=media&amp;token=4beb89ec-43e9-4ac1-85af-627c9852634e" alt=""><figcaption></figcaption></figure></div>

unzipping the file asks for a password, in the beginning i have tried to crack it using john and then i tried to find the password from the http traffic but the password was in front of my eyes which was `CODEBY{w3ll_d0n3!}`&#x20;

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FWSlPeRhSjuHJj0G7ZkY3%2Fimage.png?alt=media&amp;token=cb2fa8cb-6627-4b13-86a0-5258db72a844" alt=""><figcaption></figcaption></figure></div>

a file called flag is extracted, examining its type it shows that its an executable

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FjgfNIivswZZz4wTtpl2k%2Fimage.png?alt=media&amp;token=f2e7efe9-0360-4d3f-b2bd-1df80d0b12e0" alt=""><figcaption></figcaption></figure></div>

### <mark style="color:red;">Flag :</mark>&#x20;

```
CODEBY{tls_4nd_w1resh4rk_<3}
```
