The Safest Encryption
40 points Medium

I intercepted this zip file, the contents seem to be encrypted, but it looks like the key is also in there. Could you try recovering the encrypted file?

CTFlearn.zip
Flag
Rating 4.51
5
4
3
2
1

Discussion

Protected
0

Good one, bro!!! Loved it

0

hey guys! took me a day and a half to solve this.. because the so-called "solutions" all don't work. here we go, ill give you a hint, download this file-xor-er that xors two files you selected FOR YOU! AUTOMATICALLY! no programming, no codes that don't work, only efficiency: https://www.nirsoft.net/utils/xorfiles.html by downloading this zip file and extracting all the content, open the file called "xorfiles" and click on browse, now select the pdf and txt in the zip file of this challenge and then select a blank pdf as a final file so that you can see the flag in the pdf. And voila! The answer will be seen inside of the blank pdf file, hope this helps! and for those of you who solved the challenge thinking im just giving out the answer, i do sincerely apologize because this challenge is way too hard! Beginners will never be able to solve this challenge, as I said, this took me a days and half. Good luck!

0

how i solved this: https://pastebin.com/2u3KhVJe (i dont recommend because it contains the solution)

0

Hint: Use WC command, is there anything interesting?

0

can u explain ?

0

Hi bro, think abt the WC command show the number of bytes and words in each file. Is there a coincidence in somewhere?

0

i solved it my guy, kinda hard, im about to complete all the cryptography section then head back to forensics because i was stuck at the space station, anyway thanks

0

from pwn import xor with open('CTFLearn.pdf', 'rb') as file1, open('CTFLearn.txt', 'rb') as file2: var1 = file1.read() var2 = file2.read() flag = xor(var1, var2) with open('result', 'wb') as result: result.write(flag)

3

import sys

Read two files as byte arrays

file1_b = bytearray(open(sys.argv1, 'rb').read()) file2_b = bytearray(open(sys.argv[2], 'rb').read())

Set the length to be the smaller one

size = len(file1_b) if len(file1_b) < len(file2_b) else len(file2_b)

xord_byte_array = bytearray(size)

XOR between the files

for i in range(size): xord_byte_array[i] = file1_b[i] ^ file2_b[i]

Write the XORd bytes to the output file

open(sys.argv[3], 'wb').write(xord_byte_array)

print("XOR operation completed. Result saved to", sys.argv[3])

Run:python script.py CTFlearn.pdf CTFlearn.txt output.pdf

What i m doing here incorrect i cant understand

-1

Help me pls. Im begginer

0

hey look at the comments i wrote what steps u should do to retrieve the flag from the encrypted pdf file

1