[Hack The Boo] Day 4 Challenges
by - Thursday, January 1, 1970 at 12:00 AM
(October 25, 2022, 07:07 PM)karhu Wrote:
(October 25, 2022, 06:11 PM)MillicentBystander Wrote:
(October 25, 2022, 06:06 PM)killerbee Wrote: ?

(October 25, 2022, 06:04 PM)karhu Wrote:
(October 25, 2022, 05:38 PM)killerbee Wrote: crypto challenge is easy but I don't know who to automate  communication :(


Use pwntools.


unfortunately I m not familiar with :( I wasted 4 hours trying :(


If you DM me your solution or post it here, I can try to automate it for us?


Day 4 Crypto:

from pwn import *
import json

io = remote("206.189.117.93", 31327)

test_text = "This is a test string to cover enough bytes to xor the flag, I think this will do."

io.recvuntil("> ", timeout=1)
io.sendline('{"option":"3"}')
io.recvuntil("modes:", timeout=1)
io.sendline('{"modes":["CTR"]}')
io.recvuntil("> ", timeout=1)
io.sendline('{"option":"1"}')
cipher_flag = json.loads(io.recv().decode().strip())['ciphertext']
io.recvuntil("> ", timeout=1)
io.sendline('{"option":"2"}')
io.recvuntil("plaintext:", timeout=1)
io.sendline('{"plaintext":"This is a test string to cover enough bytes to xor the flag, I think this will do."}')
io.recvuntil("
")
cipher_test = json.loads(io.recv().decode().strip())['ciphertext']
print(cipher_test)

blob = xor(binascii.unhexlify(cipher_test), binascii.unhexlify(cipher_flag))
flag = xor(blob, test_text)
print(f'{flag=}')


For people who are interested in how the crypto attack works, the problem is that the same IV is reused when encrypting with CTR mode.

c1 = flag_pt XOR aes(key,iv)
c2 = known_pt XOR aes(key,iv)

c1 XOR c2 = p1 XOR aes(key,iv) XOR p2 XOR aes(key,iv)
c1 XOR c2 = p1 XOR p2

flag_pt = known_pt XOR c1 XOR c2
Reply
(October 25, 2022, 07:46 PM)11231123 Wrote:
(October 25, 2022, 07:37 PM)HTBContestant Wrote: Noob question for Forensics: How do I decrypt? I have the Key and IV, but I can't get the decrypt working in either python code or as native openssl command.

It would look something like this, right?

import base64
import hashlib
from Crypto import Random
from Crypto.Cipher import AES

data = open("forensics_poof/candy_dungeon.pdf.boo.boo", 'rb').read()
key = 'keyvalueascopiedfromdecompiledconfigure'
iv = b'ivvalueascopiedfromdecompiledconfigure'
cipher = AES.new(key.encode("utf8"), AES.MODE_CFB, iv)
ct = cipher.decrypt(data)

open("decrypted.pdf", 'wb').write(ct)


Isn't the encrypted file name "candy_dungeon.pdf.boo"?

If it is not the file name that is wrong, probably your key or iv is wrong, because this works for me:

from Crypto.Cipher import AES

data = open("candy_dungeon.pdf.boo", 'rb').read()
key = 'vN0nb7ZshjAWiCzv'
iv = b'ffTC776Wt59Qawe1'
cipher = AES.new(key.encode('utf-8'), AES.MODE_CFB, iv)
ct = cipher.decrypt(data)

open("candy_dungeon.pdf", 'wb').write(ct)


Now that you mention that... all the files have an additional .boo to their name. Welp, guess I'm lucky I did that in a VM. Gonna download the files again  :blush:
Edit: Yep, that was it. Guess I accidentally encrypted all the files in that folder while messing with the configure file.
Reply
for pwn
by cyberchef the secret is of length 11
what are all the scary word of length11 ?
Reply
(October 25, 2022, 01:05 PM)Hacker2222 Wrote: plz discuss day 4 challenges here

reversing challenge:


.
Reply
thanks
Reply
Thanks!
Reply
Thanks
Reply
thank you!!
Reply
Thanks!
Reply
I'm almost certain PWN is a GOT overwrite

using gdb-peda

[*] '/spooky_time'
    Arch:    amd64-64-little
    RELRO:    No RELRO <<<<<-----
    Stack:    Canary found
    NX:      NX enabled
    PIE:      PIE enabled
    RUNPATH:  b'./glibc/'
[*] '/challenge/glibc/libc.so.6'
    Arch:    amd64-64-little
    RELRO:    Partial RELRO <<<<<-----
    Stack:    Canary found
    NX:      NX enabled
    PIE:      PIE enabled


the program is using puts and isoc99_scanf

still not sure!
Reply


 Users viewing this thread: [Hack The Boo] Day 4 Challenges: No users currently viewing.