Logo

crypto

GuidePoint Security CTF 2021 - Half (crypto)

3 minute read Published:

Writeup for the Guidepoint 2021 CTF Half crypto challenge
Guidepoint Security CTF 2021 - Half (crypto) For this challenge we get some encoded/encrypted string and the python script that was used to produce it. 3539333437353461373137333532333833333333333933303335333036383639dcb33a3cca39412b58f4095cbc30faf95f72c9c1e71c01aa0a1b0f89c11f03b751dccaa5bb3ec011cc0a40a08ba87827071e1fb52716c891a1263a53af721a18 from Crypto.PublicKey import RSA from Crypto.Cipher import PKCS1_OAEP, AES from Crypto import Random # May be able to get rid of from random import choice, shuffle from OpenSSL import crypto import binascii import base64 pub = crypto.load_publickey(crypto.FILETYPE_PEM, base64.b64decode('LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUF0YmEwY2x2RWllS3A0MUtYaGlpUwpqWnluc2E5RlQzTmpVUE1ZaVBVLzN5L2IySU8zcnFaZmh5RTRCNlAzYXpueDRZMkRoYVVVZFNnN0V5OHJzZ29jCis0dzlIdDYwSTdEWWUxblVKeUt1ekZyTDZESmdxSFR6Sml3SHBCWFNTVnVhaU5KY2NRVXJKMWNaRzdTVG44YmcKbzBCdHNGT0tyVzVzTzNyOGxNWitxWDVldXNZWW9UMDd6U0p5T1V4WVNJcWlwUVpPcEc3Y2JNYVhQZlZaaERDbwpyOW9UVFZaUFA1ZzlqOHNoSmdDVnJLeXE4V2dQTk1sWDRBMVhKQnpIcXFZN2RTK2NZRFhuMmc2dmxOa2RESXpmCjd6U1ZxL0NWZzA1MG1CdXZYdTVWaWVheHhZQnREb0xUQ0JWMmcyYXlOY2pac2tJVmhFbXpvTjNveEd5dFFVNFIKUXdJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg==')) pubkey = crypto.dump_publickey(crypto.FILETYPE_PEM, pub) def random_string(size, chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"): return ''.

GuidePoint Security CTF 2021 - Ssxor (crypto)

2 minute read Published:

Writeup for the Guidepoint 2021 CTF Ssxor crypto challenge
Guidepoint Security CTF 2021 - Ssxor (crypto) For this challenge we get an encrypted string and the python script that was used to generate it: 2e1209315c05627148004b3b46160a565858560a16463b4b00487162055c3109122e import binascii flag = 'StormCTF{Crypto4:blahblahblah}' flag_rev = list(flag[::-1]) stuff = zip(flag, flag_rev) x = lambda x,y: chr(ord(x) ^ ord(y)) out = list() out += [x(s[0],s[1]) for s in stuff] final = [str(b, 'ascii') for b in [binascii.hexlify(bytes(x, 'utf-8')) for x in out]] print(''.join(final)) stuff = zip(flag_rev, out) out = list() out += [x(s[0],s[1]) for s in stuff] print(''.

GuidePoint Security CTF 2021 - Sub (crypto)

2 minute read Published:

Writeup for the Guidepoint 2021 CTF Sub crypto challenge
Guidepoint Security CTF 2021 - Sub (crypto) This challenge is a substitution cipher. We are given the output text as well as the substitution key so it’s just a matter of reversing the operations. Our given data: key = {'1': 'j', '0': 'X', '3': 'F', '2': 'o', '5': 'T', '4': 'x', '7': '0', '6': 'P', '9': '}', '8': 'J', ':': 'b', 'A': 'c', 'C': 'p', 'B': 'q', 'E': '7', 'D': 'a', 'G': 'v', 'F': '3', 'I': '5', 'H': '1', 'K': 'O', 'J': 'K', 'M': 'g', 'L': '2', 'O': 'n', 'N': '8', 'Q': 'y', 'P': 'E', 'S': 'e', 'R': 'R', 'U': 'h', 'T': 'W', 'W': 'N', 'V': 'm', 'Y': '9', 'X': 'G', 'Z': 'S', 'a': 'k', 'c': 't', 'b': 'd', 'e': '{', 'd': '4', 'g': 'C', 'f': 'L', 'i': '6', 'h': 'l', 'k': 'Z', 'j': 'z', 'm': 'U', 'l': 's', 'o': 'B', 'n': 'M', 'q': 'I', 'p': 'i', 's': ':', 'r': 'Q', 'u': 'Y', 't': 'r', 'w': 'V', 'v': 'H', 'y': 'D', 'x': 'A', '{': 'f', 'z': 'w', '}': 'u'} encrypted = 'erBQUpW3fpQDirBFb7c}}FdPT0}x0jdLcokk}xq7jaT3Lpqkju' To reverse it we swap the keys and values and do the substitution again;