This is the solution for the coding challenge Challenge accepted from Sogeti CTF qualifications 2019.
The python code of a server is given.
- python's RNG is manually seeded with a random value between 1 and 10000
- The beginning and end of a sha256 hash corresponding to the first generated number is leaked
- This hash is used as a AES-256 key to encrypt a challenge in CBC mode
- The leak allows you to retreive the original seed, hence compute the full hash, and decrypt the ciphertext
- Sending the decrypted challenge back to the server gives you the flag