-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added writeups for Crypto (Whitehacks2022)
- Loading branch information
1 parent
3889991
commit 6090b5a
Showing
11 changed files
with
133 additions
and
41 deletions.
There are no files selected for viewing
49 changes: 37 additions & 12 deletions
49
2022-01-Whitehacks/Crypto/Really S1mpl3 Algorithm/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,46 @@ | ||
# [Challenge] | ||
# Really S1mp(l3) Algorithm | ||
|
||
- Category: Crypto | ||
- Points: ?/? (If there is Point Decay, stating the original score would help) | ||
- Captures: [] (Mainly as a means of the relative difficulty of the flag) | ||
- Challenge Helpers: [Insert anyone else here who helped] | ||
|
||
- Points: 135/1000 | ||
- Captures: 72 | ||
## Challenge Description: | ||
[Challenge Description] | ||
Rumour has it that this algorithm originated from the Republic of South Africa! | ||
|
||
## Files Attached: | ||
[If any, list them here - paste source code but link binaries] | ||
|
||
[challenge.txt](challenge.txt) | ||
## Solution: | ||
|
||
### Tools used: | ||
- [Tools] | ||
### Tools that would have been helpful: | ||
- [factordb.com](factordb.com) | ||
|
||
Taking a look at the file, we see 4 variables `p`, `q`, `e` and `ct` defined, and further taking inspiration from the initals of this challenge, we can infer that this challenge has to deal with RSA (and decrypting the ciphertext). | ||
|
||
With some quick googling, I found [this page](https://www.amazingtricks.in/how-to-solve-rsa-crypto-challenges-in-ctfs/) and its accompanying code to decrypt our ciphertext. Since in our case the components of the prime `p` and `q` have been given to us, we do not need to factorsie anything (which the site recommeneded [factordb](factordb.com) for.) | ||
|
||
A quick edit to the code later, we end up with this: | ||
|
||
```python | ||
#!/usr/bin/python3 | ||
from Crypto.Util.number import inverse | ||
p = 89677525768054651799811339393073439598902155753884683756875620558829954902529 | ||
|
||
q = 84438062750417241222463359000671279258755386034358736244893269480285225711041 | ||
|
||
e = 65537 | ||
|
||
ct = 2006481391032768131106572837821981606814991526844317992631122301790966354846642917808142106585149537517169168108747108233658443914026685951141453359021205 | ||
|
||
phi = (p-1)*(q-1) | ||
d=inverse(e, phi) | ||
m=pow(ct,d,p*q) | ||
print(hex(m)[2:-1]) | ||
``` | ||
|
||
Running the program after that gives us a hexadecimal string, which we can then throw into [CyberChef](gchq.github.io/CyberChef) to convert to our flag. | ||
|
||
[Actual Solution goes here] | ||
(Note: I did realise when runnning the python program that there was a little bit of a weird ending to the flag – I'm pretty sure that if I bothered to look at the code more I could have fixed it, but in my case I just removed the trailing period with a closing curly brace) | ||
|
||
## Flag: | ||
## Flag: | ||
``` | ||
WH2022{1t5_r34lly_s1mpl3_4m_1_r1ght} | ||
``` |
9 changes: 9 additions & 0 deletions
9
2022-01-Whitehacks/Crypto/Really S1mpl3 Algorithm/challenge.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
This is really simple. I hope you can solve it. | ||
|
||
p = 89677525768054651799811339393073439598902155753884683756875620558829954902529 | ||
|
||
q = 84438062750417241222463359000671279258755386034358736244893269480285225711041 | ||
|
||
e = 65537 | ||
|
||
ct = 2006481391032768131106572837821981606814991526844317992631122301790966354846642917808142106585149537517169168108747108233658443914026685951141453359021205 |
16 changes: 8 additions & 8 deletions
16
2022-01-Whitehacks/Crypto/Ridiculously Simpler Algorithm/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
# [Challenge] | ||
# Ridiculously Simpler Algorithm | ||
|
||
- Category: Crypto | ||
- Points: ?/? (If there is Point Decay, stating the original score would help) | ||
- Captures: [] (Mainly as a means of the relative difficulty of the flag) | ||
- Challenge Helpers: [Insert anyone else here who helped] | ||
- Points: 976/1000 | ||
- Captures: 14 | ||
|
||
## Challenge Description: | ||
[Challenge Description] | ||
You cracked me once, now I'm back for revenge with an upgraded defence mechanism! | ||
|
||
## Files Attached: | ||
[If any, list them here - paste source code but link binaries] | ||
[ecrypted.txt](encrypted.txt) | ||
|
||
## Solution: | ||
|
||
### Tools used: | ||
- [Tools] | ||
|
||
[Actual Solution goes here] | ||
Looked up the key in factordb, seemed like it was a square number, but couldn't figure out how to move on from there. may try again later | ||
|
||
## Flag: | ||
## Flag: | ||
no solve |
7 changes: 7 additions & 0 deletions
7
2022-01-Whitehacks/Crypto/Ridiculously Simpler Algorithm/encrypted.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
This is supposedly even simpler. Try me! | ||
|
||
n = 10737815683051749791647908968171036410193052055925978453198599402338822997173859289423308183048750681303695147135467822832842221572174477705930888427996441 | ||
|
||
e = 65537 | ||
|
||
c = 2025103500488147486354827835413388045219955669590787897403050967001645770151549545526845887271487454606326620556228871888382889102118986522714812376848980 |
34 changes: 25 additions & 9 deletions
34
2022-01-Whitehacks/Crypto/The Indecipherable Cipher/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,37 @@ | ||
# [Challenge] | ||
# The Indecipherable Cipher | ||
|
||
- Category: Crypto | ||
- Points: ?/? (If there is Point Decay, stating the original score would help) | ||
- Captures: [] (Mainly as a means of the relative difficulty of the flag) | ||
- Challenge Helpers: [Insert anyone else here who helped] | ||
- Points: 441/1000 | ||
- Captures: 55 | ||
|
||
## Challenge Description: | ||
[Challenge Description] | ||
Some say this cipher cannot be deciphered. Well, do you believe them? | ||
|
||
Even worse, some say this cipher is misattributed! | ||
|
||
I would say that the key to solving this challenge is to remember who the true inventor was. | ||
|
||
## Files Attached: | ||
[If any, list them here - paste source code but link binaries] | ||
[cipher.txt](cipher.txt) | ||
|
||
## Solution: | ||
|
||
### Tools used: | ||
- [Tools] | ||
- [CyberChef](gchq.github.io/CyberChef) | ||
|
||
Having a look at the cipher text, we can see that the general structure of the flag was still there, but it has obviously been jumbled. Since the challenge description mentioned that `the key to solving this challenge is to remember was the true inventor was`, I guessed that the cipher used was a [vigenere cipher](https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher). | ||
|
||
A quick look at the Wikipedia page (which is the source of Truth™) tells us that this cipher was invented by one "Giovan Battista Bellaso" | ||
|
||
So I tried their full name! But it didn't work... not completely | ||
|
||
 | ||
|
||
So, I tried just using their first name, "Giovan", which resulted in success! | ||
|
||
[Actual Solution goes here] | ||
 | ||
|
||
## Flag: | ||
## Flag: | ||
``` | ||
WH2022{v1g3n3r3_15_Juz_Ca3s@r_C1pH3R_0N_sT3R01Ds} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CP2022{j1b3n3e3_15_Pcn_Xa3f@x_K1dC3R_0A_yB3F01Ys} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions
26
2022-01-Whitehacks/Crypto/The Poem of Knowledge/Poem Of Knowledge.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
The Road Not Taken | ||
By Robert Frost | ||
|
||
Two roads diverged in a yellow wood, | ||
And sorry I could not travel both | ||
And be one traveler, long I stood | ||
And looked down one as far as I could | ||
To where it bent in the undergrowth; | ||
|
||
Then took the other, as just as fair, | ||
And having perhaps the better claim, | ||
Because it was grassy and wanted wear; | ||
Though as for that the passing there | ||
Had worn them really about the same, | ||
|
||
And both that morning equally lay | ||
In leaves no step had trodden black. | ||
Oh, I kept the first for another day! | ||
Yet knowing how way leads on to way, | ||
I doubted if I should ever come back. | ||
|
||
I shall be telling this with a sigh | ||
Somewhere ages and ages hence: | ||
Two roads diverged in a wood, and I— | ||
I took the one less traveled by, | ||
And that has made all the difference. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,30 @@ | ||
# [Challenge] | ||
# The Poem of Knowledge | ||
|
||
- Category: Crypto | ||
- Points: ?/? (If there is Point Decay, stating the original score would help) | ||
- Captures: [] (Mainly as a means of the relative difficulty of the flag) | ||
- Challenge Helpers: [Insert anyone else here who helped] | ||
- Points: 767/1000 | ||
- Captures: 40 | ||
- Challenge Helpers: @oneytlam | ||
|
||
## Challenge Description: | ||
[Challenge Description] | ||
Our knowledgeable alien friend named Beale left us with a purported "Poem of Knowledge" before he went back to his universe. | ||
|
||
He also dropped a message behind. Can you decipher what he was trying to say? | ||
|
||
17-73-24-55-84-101-141-44-54-49-10-123-62-131-114-67-47-46-60-83-84 | ||
|
||
Note: Please wrap the flag with WH2022{...}\u003cbr\u003e\nThe flag is case-sensitive! | ||
|
||
## Files Attached: | ||
[If any, list them here - paste source code but link binaries] | ||
[Poem of Knowledge](Poem%20of%20Knowledge.txt) | ||
|
||
## Solution: | ||
Will get to it soon™ | ||
|
||
My teammate was the one who kinda figured this out, but by the time we did so the time was already out :( | ||
### Tools used: | ||
- [Tools] | ||
|
||
[Actual Solution goes here] | ||
|
||
## Flag: | ||
## Flag: | ||
no solve |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters