---
# System prepended metadata

title: SpringForwardCTF 2023 | Cryptography Writeup
tags: [Writeup, Cryptography, Documentation, SpringForwardCTF]

---

---
title: 'SpringForwardCTF 2023 | Cryptography Writeup'
---

SpringForwardCTF 2023 Cryptography Writeup 
===

![Awesome](https://awesome.re/badge.svg)

![SpringForwardCTF 2023](https://ctftime.org/media/cache/a4/97/a497ca3c0174b22d4d371f74f39c81e2.png)

## Cryptography/A new hope

>So we found this on a thumbdrive.
I know, I know, don't load random USBs, but look... 
Things are weird right now and I figured it might be something.
All it has is this half of a program and a weird mashing of letters and numbers.
Maybe it's nothing, but it might be something. Think you can check?
Developed by [Cyb3rSw0rd](https://github.com/AlfredSimpson)

[log.txt](log.txt) [encrypt.py](encrypt.py)

---
#### Analysis

Given 2 files `log.txt` and `encrypt.py`
> log.txt
```=
SWYgeW91J3JlIHJlYWRpbmcgdGhpcywgeW91IGJldHRlciBiZSBtZS4KTW9zdCBsaWtlbHkgeW91IGZvcmdvdCwgdGhhdCB0aW1lIGlzIHRoZSBrZXkuCg==
mpq_wxkdim_qe_WTNQ
tvp euaapnbqpr vafhlk abtx ogwi aaif qr xxeg qe


072923373661312c3f2d66273661276537203f652429232b73352f283661312c3f2d6627362f22653124202a2124663c3c346a65322f22652a2e3365302028653b242a357334352d363366313b2835653a2f68653d28252628297529231e2b760c7124740c36062b2e6f661c3c3466282632326520282b353f3866233c2d2a2a2461322d36613624272966233c3366203d2d2f223b35232b3e2428317d616b1711
```
> encrypt.py
```python=
def encrypt(message, key):
    encrypted = ""
    for i in range(len(message)):
        encrypted += chr(ord(message[i]) ^ ord(key[i % len(key)]))
    return encrypted.encode("utf-8").hex()

message = #//////ERROR ERROR ERROR
key = #/////// ERROR OERROR ERROR ERROR
encrypted = encrypt(message,key)
```

It is looking this python code doing xor function and converting hex. In the question it says we only have half of the program.

* For 1st line ensure that it is base64 encrypted. Here's the result:
```
If you're reading this, you better be me.
Most likely you forgot, that time is the key.
```
* For 2nd and 3rd line looks like encrypted by password from 1st line answer. After finding the method, we can ensure this is `Vigenère Cipher`. Here's the result from [2nd](https://gchq.github.io/CyberChef/#recipe=Vigen%C3%A8re_Decode('time')&input=bXBxX3d4a2RpbV9xZV9XVE5R) and [3rd](https://gchq.github.io/CyberChef/#recipe=Vigen%C3%A8re_Decode('time')&input=dHZwIGV1YWFwbmJxcHIgdmFmaGxrIGFidHggb2d3aSBhYWlmIHFyIHh4ZWcgcWU). 
```
2nd = the_secret_is_SAFE
3rd = and absolutely nobody will know what my plan is
``` 

After get the secret key, we can decode it [HEX - XOR](https://gchq.github.io/CyberChef/#recipe=From_Hex('Auto')XOR(%7B'option':'UTF8','string':'SAFE'%7D,'Standard',false)&input=MDcyOTIzMzczNjYxMzEyYzNmMmQ2NjI3MzY2MTI3NjUzNzIwM2Y2NTI0MjkyMzJiNzMzNTJmMjgzNjYxMzEyYzNmMmQ2NjI3MzYyZjIyNjUzMTI0MjAyYTIxMjQ2NjNjM2MzNDZhNjUzMjJmMjI2NTJhMmUzMzY1MzAyMDI4NjUzYjI0MmEzNTczMzQzNTJkMzYzMzY2MzEzYjI4MzU2NTNhMmY2ODY1M2QyODI1MjYyODI5NzUyOTIzMWUyYjc2MGM3MTI0NzQwYzM2MDYyYjJlNmY2NjFjM2MzNDY2MjgyNjMyMzI2NTIwMjgyYjM1M2YzODY2MjMzYzJkMmEyYTI0NjEzMjJkMzY2MTM2MjQyNzI5NjYyMzNjMzM2NjIwM2QyZDJmMjIzYjM1MjMyYjNlMjQyODMxN2Q2MTZiMTcxMQ)

```!
There will be a day when time will bend before you, and you can help usher this in. nicc{h3lp_m3_0b1_w@n}. You must simply follow the path for enlightenment. -RB
```

:::success
Flag:`nicc{h3lp_m3_0b1_w@n}`
:::

---
## Cryptography/B1nary Bens0n

> Old Professor Benson has left this message behine, we thing it has a flag. 
Can you decrypt it and get the message he left behind for us?
Developed by ihanna2

[Message.txt](Message.txt)

---
#### Analysis

Given files `Message.txt`
> Message.txt
```!
01101110 01101001 01100011 01100011 01111011 01001001 01011111 01100011 01100001 01101110 01011111 01110010 00110011 01000000 01100100 01011111 01000010 01101001 01101110 01100001 01110010 01111001 01011111 01101001 01101110 00100000 01101001 01110100 01110011 01011111 01100010 01101001 01101110 01100001 01110010 01111001 01011111 01100110 01101111 01110010 01101101 01100001 01110100 01111101 
```

It's like a Binary code. A binary code represents text, computer processor instructions, or any other data using a two-symbol system. The two-symbol system used is often "0" and "1" from the binary number system. The binary code assigns a pattern of binary digits, also known as bits, to each character, instruction, etc.
Binary is base-2, meaning that it only uses two digits or bits. For computers, 1 is true or "on", and 0 is false or "off". The concept of binary and bits are based on of Boolean Algebra. The binary number system is positional.
The binary number system is positional. So even though it only works with 1's and 0's, the position of those two digits can represent much more.

#### Solver script

> solver_B1nary_Bens0n.py :

:::spoiler Click to show details
```python=
#!/usr/bin/env python3
mes = open("Message.txt", "r").read().split()

message = ""
for n in range(len(mes)):
    message += chr(int(mes[n], 2))
print(message)
```
:::

:::success
Flag:`nicc{I_can_r3@d_Binary_in its_binary_format}`
:::

---
## Cryptography/Tell Me a Joke

I asked ChatGPT to tell me a joke, but it's encoded. Can you figure out what it is?

> V2h5IGRpZCB0aGUgdG9tYXRvIHR1cm4gcmVkPwoKQmVjYXVzZSBpdCBzYXcgdGhlIHNhbGFkIGRyZXNzaW5nIQ==

Format: nicc{words can be spaced}

Developed by [ch0p](https://www.github.com/jozicoates)

---
#### Analysis

```!
V2h5IGRpZCB0aGUgdG9tYXRvIHR1cm4gcmVkPwoKQmVjYXVzZSBpdCBzYXcgdGhlIHNhbGFkIGRyZXNzaW5nIQ==
```
It's base64 encoded, let's try to decodeit

```
% echo 'V2h5IGRpZCB0aGUgdG9tYXRvIHR1cm4gcmVkPwoKQmVjYXVzZSBpdCBzYXcgdGhlIHNhbGFkIGRyZXNzaW5nIQ==' | base64 -d
Why did the tomato turn red?

Because it saw the salad dressing!
```
Voila ~
:::success
Flag:`nicc{Why did the tomato turn red? Because it saw the salad dressing!}`
:::

---
## Cryptography/What's camping without s'morse?

Some of the NICC members were trying to get away camping after midterms, but all of their headphones immediately started blaring this sound when they tried to leave campus.  

Someone grabbed a recording, maybe we can piece it together?

Format: nicc{words_separated_by_underscores}

Developed by [ch0p](https://www.github.com/jozicoates)

[hmmmm.wav](hmmmm.wav)

---
#### Analysis

Given wav file `hmmm.wav`, it's look like morse code sound. Analyzing the Spectrogram with [SoX](https://sox.sourceforge.net/Main/HomePage).
`sox hmmmm.wav -n spectrogram -o spec.png -X 200 -Y 1000`
![Spectrum](https://i.imgur.com/lL2z3CI.png)

Let's decode. Using custom python lib [Morse audio decoder](https://pypi.org/project/morse-audio-decoder/) refer to [Morse Code Translator](https://morsedecoder.com/).
```
% morse-audio-decoder hmmmm.wav
THERE'S A REASON THAT ROSES HAVE THORNS.
```
In other ways, can use online [Morse Decoder](https://morsecode.world/international/decoder/audio-decoder-adaptive.html).

:::success
Flag:`nicc{THERE'S_A_REASON_THAT_ROSES_HAVE_THORNS.}`
:::

---
## Cryptography/Dear Tom

Keys are hard to memorize, especially with tests coming up. 

I guess whoever has been breaking in around campus is struggling to keep things straight, too.

We found a message left up on a terminal with a post it next to it. 

We *think* it might be a key to solving the message that was left up, but haven't cracked it just yet. Think you could?

> lmq_chc_ur_mpq_jnbgvx

Developed by [Cyb3rSw0rd](https://github.com/AlfredSimpson)

[stickynote.png](stickynote.png)

---
#### Analysis

![stickynote](https://i.imgur.com/jpHRcZo.png)
Trying to understand kind of encryption associated with image using [Cipher Identifier and Analyzer](https://www.boxentriq.com/code-breaking/cipher-identifier). Analysis Results:
```
Beaufort Cipher (30 votes)
Vigenere Cipher (23 votes)
Unknown Cipher (20 votes)
Vigenere Autokey Cipher (8 votes)
Beaufort Autokey Cipher (7 votes)
Columnar Transposition Cipher (6 votes)
Monoalphabetic Substitution Cipher (3 votes)
Bifid Cipher (3 votes)

```
Found the answer using [Vigenere Tool](https://www.boxentriq.com/code-breaking/vigenere-cipher)
`Key = time`
![Answer](https://i.imgur.com/kHK4K0a.png)

:::success
Flag:`nicc{see_you_in_the_future}`
:::

---
## Cryptography/Hours Behind

One of our members found this code in a lab. It looks like it was sent from a different time, I think the date said the year 8 AD...

> **Q ammuml bw pidm nwcvl ugamtn qv bpm Zwuiv Muxqzm bquma, Q lw vwb zmumujmz nwz Q owb pmzm, jcb Q vmml bpm ntio bw nqvl wcb pwe bw omb jiks bw xzmamvb lig! Wp twws, bpqa kwctl jm bpm ntio! vqkk{0vtg_b1um_e1tt_b3tt}**

It's encrypted, but how do we get the right answer...

Developed by [jackzabbs](https://github.com/JohnZabriskie)

---
#### Analysis

Indentifying cipher text using [Cipher Identifier and Analyzer](https://www.boxentriq.com/code-breaking/cipher-identifier). Analysis Results:
```
Caesar Cipher (100 votes)
```
![Figure 1](https://i.imgur.com/NltkeH3.png)
using `key = 8` we can decode the cipher text.
![Answer](https://i.imgur.com/OEoVs8Z.png)

:::success
Flag:`nicc{0nly_t1me_w1ll_t3ll}`
:::

---
###### tags: `SpringForwardCTF` `Cryptography` `Writeup` `Documentation`