lundi 17 juillet 2017

CTFZone 2017 e-Voting (crypto 409pts)

It's a crypto task where they gived us a ciphertext which is represented in two values (C1 & C2) ; this help us to realize that's the cryptosystem probably used is el gamal cryptosystem which is also based on diffie-hellman like it was said in the description of the task. The aim is clear, we have to decipher this ciphertext and the plaintext will be the flag. The script below will decrypt the ciphertext quickly due to flaw of the implementation of the cryptosystem by this service. from pwn import *
import re
import sys
import string

r = remote("82.202.204.134",1331 )
m = r.recvuntil('-> ', drop=True)
m = m.split("(")
m = m[1]
m = m.split(")")
m = m[0]
m = m.split(" ")
C1 = m[0]
C2 = m[1]
r.writeline("D \n")
m = r.recv()
C1 = int(C1) * 2
r.writeline(str(C1) +" " + str(C2))
o = r.recv()
o = o.split("\n")
o = o[1]
o = int(o,16)
o = o / 2
o = format(o, 'x')
print "flag is : ctfzone{"+o+"}"

Output :
ctfzone{fc575129f3935d5b456ed55ef8173574}

Aucun commentaire:

Enregistrer un commentaire