feat: added knightctf 2023

pull/1/head
Muhammad Daffa 2023-01-24 23:02:54 +07:00
parent 9c0ef9cd51
commit e510464bfe
26 changed files with 367 additions and 14 deletions

View File

@ -4,7 +4,7 @@
> Originally depends on: Name that Song 2
## About the Challenge
The purpose of this problem is how to get the title of the song that has been given (Like the previous problem and you can get the song [**here**](/IrisCTF-2023/Name%20that%20song%202/song_2.mod))
The purpose of this problem is how to get the title of the song that has been given (Like the previous problem and you can get the song [**here**](/IrisCTF%202023/Name%20that%20song%202/song_2.mod))
## How to Solve?
First i check the metadata of the file, im using https://www.metadata2go.com/ and I got nothing.

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

@ -2,7 +2,7 @@
> Here's an IT song for you. The original title has been redacted. What was the original name of the song? Wrap the title in flag format, all lowercase. Any special characters and spaces should be replaced with an underscore. If the song's name was "Never Gonna Give You Up", type irisctf{never_gonna_give_you_up}.
## About the Challenge
The purpose of this problem is how to get the title of the song that has been given. Sounds easy right? (You can get the song [**here**](/IrisCTF-2023/Name%20that%20song/song_1.it))
The purpose of this problem is how to get the title of the song that has been given. Sounds easy right? (You can get the song [**here**](/IrisCTF%202023/Name%20that%20song/song_1.it))
## How to Solve?
First i check the metadata of the file, im using https://www.metadata2go.com/ and I got interesting metadata named `Comment`.

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

11
IrisCTF 2023/README.md Normal file
View File

@ -0,0 +1,11 @@
# IrisCTF 2023
CTF writeup for Iris CTF 2023. I took part in this CTF competition with the HCS (Heroes Cyber Security) team, and got 8th place out of 1055 teams
Thanks to the HCS team especially @0xazr and @kos0ng
| Category | Challenge
| --- | --- |
| Web | [babystretchy](/IrisCTF%202023/babystrechy)
| Web | [Feeling Tagged](/IrisCTF%202023/Feeling%20Tagged/)
| Misc | [Name that song](/IrisCTF%202023/Name%20that%20song/)
| Misc | [Name that song 2](/IrisCTF%202023/Name%20that%20song%202/)

View File

@ -1,11 +0,0 @@
# IrisCTF-2023
CTF writeup for Iris CTF 2023. I took part in this CTF competition with the HCS (Heroes Cyber Security) team, and got 8th place out of 1055 teams
Thanks to the HCS team especially @0xazr and @kos0ng
| Category | Challenge
| --- | --- |
| Web | [babystretchy](/IrisCTF-2023/babystrechy)
| Web | [Feeling Tagged](/IrisCTF-2023/Feeling%20Tagged/)
| Misc | [Name that song](/IrisCTF-2023/Name%20that%20song/)
| Misc | [Name that song 2](/IrisCTF-2023/Name%20that%20song%202/)

View File

@ -0,0 +1,73 @@
# Encode Mania
> Encoding random stuffs is so cool! I just want to encode it over and over and over again ...
## About the Challenge
We have been given a python script to encrypt the flag and the encrypted file. And if we open the script, the script will be look like this
```python
import base64
from random import randint
flag = "kctf{************}"
def encrypt(s, option):
if option == 0:
ret = base64.b64encode(s)
elif option == 1:
ret = base64.b32encode(s)
elif option == 2:
ret = base64.b16encode(s)
else:
ret = base64.b85encode(s)
return ret
encrypted_flag = flag.encode('utf-8')
for _ in range(12):
option = randint(0, 3)
encrypted_flag = encrypt(encrypted_flag, option)
with open("encode_mania.txt", 'w') as f:
f.write(encrypted_flag.decode())
```
The program will encode the flag 12 times with different random encoding (base64, base32, base16, and base85) as you can see in this line (You can get the script [**here**](/KnightCTF%202023/Encode%20Mania/encrypt.py))
```python
for _ in range(12):
option = randint(0, 3)
encrypted_flag = encrypt(encrypted_flag, option)
```
## How to Solve?
To solve this i created a python script to bruteforce each possibility 12 times with all encoding (You can get the script [**here**](/KnightCTF%202023/Encode%20Mania/decrypt.py))
```python
import base64
import re
encoded_flag = "GUZDGMRUIQ3T......"
def decrypt(s, option):
if option == 0:
ret = base64.b64decode(s)
elif option == 1:
ret = base64.b32decode(s)
elif option == 2:
ret = base64.b16decode(s)
else:
ret = base64.b85decode(s)
return ret
for _ in range(12):
for option in range(4):
try:
dec = decrypt(encoded_flag, option)
if re.findall(r"^\w+", dec.decode()):
print(dec.decode())
encoded_flag = dec.decode()
except:
pass
```
And the flag will be printed in the terminal
```
KCTF{dfs_0r_b4u7e_f04ce}
```

View File

@ -0,0 +1,24 @@
import base64
import re
encoded_flag = "GUZDGMRUIQ3T......"
def decrypt(s, option):
if option == 0:
ret = base64.b64decode(s)
elif option == 1:
ret = base64.b32decode(s)
elif option == 2:
ret = base64.b16decode(s)
else:
ret = base64.b85decode(s)
return ret
for _ in range(12):
for option in range(4):
try:
dec = decrypt(encoded_flag, option)
if re.findall(r"^\w+", dec.decode()):
print(dec.decode())
encoded_flag = dec.decode()
except:
pass

View File

@ -0,0 +1,26 @@
import base64
from random import randint
flag = "kctf{************}"
def encrypt(s, option):
if option == 0:
ret = base64.b64encode(s)
elif option == 1:
ret = base64.b32encode(s)
elif option == 2:
ret = base64.b16encode(s)
else:
ret = base64.b85encode(s)
return ret
encrypted_flag = flag.encode('utf-8')
for _ in range(12):
option = randint(0, 3)
encrypted_flag = encrypt(encrypted_flag, option)
with open("encode_mania.txt", 'w') as f:
f.write(encrypted_flag.decode())

View File

@ -0,0 +1,19 @@
# Factorie
> Have you ever heard of prime factors? The file challenge.txt contains a number that has two prime factors. Can you find them?
## About the Challenge
We have been given a text that contain a number, and we need to find the prime factors. Here is the number
```
2174096211032823084932239036566496093206280423
```
## How to Solve?
To solve this, Im using https://www.dcode.fr/prime-factors-decomposition to get the prime factors. The result is
```
39434538531451803895327
55131777675015246472249
```
So the flag will be
```
KCTF{39434538531451803895327_55131777675015246472249}
```

View File

@ -0,0 +1,34 @@
# GET Me
> Can you GET the flag from the API ?
## About the Challenge
We have been given a website, and if we open the website the response like this
```json
{
"success":false,
"message":"Sorry ! You can't GET it :P"
}
```
## How to Solve?
First i tried to change the HTTP request method from `GET` to `POST`. And then here is the response
```json
{
"success":false,
"message":"You should send me a url !"
}
```
And then i tried to add a parameter named `url` and the value of the parameter i just using random url, for example https://google.com. And here is the response.
```json
{
"success":false,
"message":"Looking for flag ? Visit https:\/\/hackenproof.com\/user\/security"}
```
And after stuck a little bit, i open hackenproof and register to that website and got the flag
```
KCTF{H4ck3nPr00f3d_bY_Kn16h75qu4d}
```

View File

@ -0,0 +1,23 @@
# Hello
> Sir vignere came to my dreams and sent me this packet capture and told me to find the flag from it which is the key to my success. I am a noob in these cases. So I need your help. Please help me find the flag. Will you?
## About the Challenge
We have been given a `pcapng` file and we need to open the file in wireshark
## How to Solve?
If we open the file in wireshark and if we check on the DNS packet, there is a single character on each packet
![wireshark](images/wireshark.png)
After we arrange the character, here is the result
```
VVBCTHtvMV9tcjNhX2VuMF9oazNfaTBofQ==
```
And we know that's base64 encode! But after we decode the encoded text the result is
```
UPBL{o1_mr3a_en0_hk3_i0h}
```
And then because there is a hint in the question "`Sir vignere came to ...`". Decode the msg with vigenere cipher and the key is `KNIGHT`
```
KCTF{h1_th3n_wh0_ar3_y0u}
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 KiB

View File

@ -0,0 +1,37 @@
# I Love Pi
> Isaac Newton left me this piece of code and a message. Can you help me decode this...
## About the Challenge
We have been given a python script and an encoded text, The python script will be look like this (You can get the script [**here**](/KnightCTF%202023/I%20Love%20Pi/encrypt.py))
```python
import base64
lengths = [--REDACTED--]
flag = "KCTF{*******************************}"
# len(lengths) = 10
# len(flag) = 39
s = 0
encoded_flag = ""
for l in lengths:
seg = flag[s:s+l]
for _ in range(len(seg)):
seg = base64.b64encode(seg.encode('ascii')).decode('ascii')
s+=l
encoded_flag += seg
print(encoded_flag)
```
And here is the encoded flag
```
VXpCT1ZRPT0=Rg==V2xod1UxcHNWa0pRVkRBOQ==MQ==VmpCb2QxVXhjSE5UYTFaV1ZrUkJPUT09Vm0wd2QyVkhVWGhUV0doaFUwVndVRlp0TVZOV01XeFZVbTVrVlUxV2NIbFdNalZyVmpKS1NHVkliRmRpVkVaSVZtMTRTMk15VGtWUmJIQk9VakF4TkZkWGRHRmtNRFZ5VFZWV2FHVnFRVGs9U0RNPQ==Vm1wQ1UxRXlTbkpOVldSVFYwZFNjVlJVU1RSUFVUMDk=VjFSS2QxWXhjSEpPVldSYVpXcEJPUT09VGtac09RPT0=
```
The python script will encode each part of the flag with base64
## How to Solve?
To solve this, Im only using cyberchef to decode the encoded text and notepad to merge the string that i have found without creating any python script haha. Anyway here is the flag
```
KCTF{4_P1_4_D4Y_K33P5_7H3_H4CK3r5_4W4Y}
```

View File

@ -0,0 +1,18 @@
import base64
lengths = [--REDACTED--]
flag = "KCTF{*******************************}"
# len(lengths) = 10
# len(flag) = 39
s = 0
encoded_flag = ""
for l in lengths:
seg = flag[s:s+l]
for _ in range(len(seg)):
seg = base64.b64encode(seg.encode('ascii')).decode('ascii')
s+=l
encoded_flag += seg
print(encoded_flag)

View File

@ -0,0 +1 @@
VXpCT1ZRPT0=Rg==V2xod1UxcHNWa0pRVkRBOQ==MQ==VmpCb2QxVXhjSE5UYTFaV1ZrUkJPUT09Vm0wd2QyVkhVWGhUV0doaFUwVndVRlp0TVZOV01XeFZVbTVrVlUxV2NIbFdNalZyVmpKS1NHVkliRmRpVkVaSVZtMTRTMk15VGtWUmJIQk9VakF4TkZkWGRHRmtNRFZ5VFZWV2FHVnFRVGs9U0RNPQ==Vm1wQ1UxRXlTbkpOVldSVFYwZFNjVlJVU1RSUFVUMDk=VjFSS2QxWXhjSEpPVldSYVpXcEJPUT09VGtac09RPT0=

13
KnightCTF 2023/README.md Normal file
View File

@ -0,0 +1,13 @@
# KnightCTF 2023
CTF writeup for KnightCTF 2023. I took part in this CTF competition with the TCP1P team, and got 54th place out of 848 teams
Thanks to the TCP1P team especially @dimasma0305
| Category | Challenge
| --- | --- |
| Web/API | [GET Me](/KnightCTF%202023/GET%20Me/)
| Networking | [Hello](/KnightCTF%202023/Hello/)
| Cryptography | [Factorie](/KnightCTF%202023/Factorie/)
| Cryptography | [Encode Mania](/KnightCTF%202023/Encode%20Mania/)
| Cryptography | [I Love Pi](/KnightCTF%202023/I%20Love%20Pi/)
| Cryptography | [Xorathrust](/KnightCTF%202023/Xorathrust/)

View File

@ -0,0 +1,51 @@
# Xorathrust
> Read the script and solve the problem.
## About the Challenge
We have been given a python script to encrypt the flag and the encrypted file. And if we open the script, the script will be look like this
```python
def main():
flag_enc = ""
with open("flag.txt", "r") as infile:
flag = infile.read()
flag = list(flag)
for each in flag:
each = chr(ord(each) ^ 0x66)
flag_enc += each
with open("flag.enc", "w") as outfile:
outfile.write(flag_enc)
if __name__ == "__main__":
main()
```
The program will applies bitwise XOR on each character using `0x66`. (You can get the script [**here**](/KnightCTF%202023/Xorathrust/encrypt.py))
## How to Solve?
Well, its very easy. You just need to re run the script to get the flag (You can get the script [**here**](/KnightCTF%202023/Xorathrust/decrypt.py))
```python
def main():
flag_enc = ""
with open("flag.enc.txt", "r") as infile:
flag = infile.read()
flag = list(flag)
for each in flag:
each = chr(ord(each) ^ 0x66)
flag_enc += each
print(flag_enc)
if __name__ == "__main__":
main()
```
And the flag will be printed in the terminal
```
KCTF{ju5t_4_b45ic_x0r}
```

View File

@ -0,0 +1,16 @@
def main():
flag_enc = ""
with open("flag.enc.txt", "r") as infile:
flag = infile.read()
flag = list(flag)
for each in flag:
each = chr(ord(each) ^ 0x66)
flag_enc += each
print(flag_enc)
if __name__ == "__main__":
main()

View File

@ -0,0 +1,17 @@
def main():
flag_enc = ""
with open("flag.txt", "r") as infile:
flag = infile.read()
flag = list(flag)
for each in flag:
each = chr(ord(each) ^ 0x66)
flag_enc += each
with open("flag.enc", "w") as outfile:
outfile.write(flag_enc)
if __name__ == "__main__":
main()

View File

@ -1,3 +1,4 @@
# ctf-writeup
List CTF Writeups
- [IrisCTF 2023](IrisCTF-2023/)
- [IrisCTF 2023](IrisCTF%202023/)
- [KnightCTF 2023](KnightCTF%202023/)