Fwame's writeup collection

Mocactf24

RPS

In this challenge we’re given a rock-paper-scissors playing server with a custom cookie system and our objective is to win 100 consecutive games. The state is stored completely inside of a session cookie encrypted with a custom symmetric cipher. import json import os from random import SystemRandom from base64 import b64decode, b64encode from dataclasses import asdict, dataclass, field from hashlib import sha256 from zlib import crc32 from Crypto.Cipher import AES from flask import Flask, make_response, render_template, request app = Flask(__name__) FLAG = os.

RSA W Leak

Like the name implies, this is a normal RSA with leak challenge: we are given a standard RSA public key, ciphertext and a leak $$ \text{leak} = \lfloor2^{8192}(\frac{r_0}{\phi(N)} + \frac{r_1}{N}) \rfloor$$ with $r_0$ and $r_1$ random integers. from Crypto.Util.number import getStrongPrime import secrets from mpmath import mp, mpf p = getStrongPrime(1024) q = getStrongPrime(1024) n = p*q e = 65537 phi = (p-1)*(q-1) d = pow(e, -1, phi) mp.dps = 8192 leak = mpf(secrets.