28 Mar 2021
- Competition: UMass CTF 2021
- Challenge Name: malware
- Type: Crypto
- Points: 448 pts
- Description:
We’ve identified some ransomeware on one of our employee’s systems, but it seems like it was made by a script kiddie. Think you can decrypt the files for us?
The challenge
malware.py
is a Python “ransomware”.
Code is super-short:
from Crypto.Cipher import AES
from Crypto.Util import Counter
import binascii
import os
key = os.urandom(16)
iv = int(binascii.hexlify(os.urandom(16)), 16)
for file_name in os.listdir():
data = open(file_name, 'rb').read()
cipher = AES.new(key, AES.MODE_CTR, counter = Counter.new(128, initial_value=iv))
enc = open(file_name + '.enc', 'wb')
enc.write(cipher.encrypt(data))
iv += 1
Read more...
21 Mar 2021
- Competition: Securinets CTF Quals 2021
- Challenge Name: MiTM
- Type: Crypto
- Points: 559 pts
- Description:
You managed to get in the middle and control the entire discussion between Alice, Bob and Carol. What are they saying ?
The file app.py
contains an implementation of Diffie-Hellman (DHx
class), with fingerprinting too.
Assuming Alice
, Bob
and Carol
have private keys a
, b
and c
respectively, the following describes the key-exchange scheme:
Alice
sends g^a (mod p)
to Bob
.
Bob
raises by b
, generating g^ab (mod p)
and sends that to Carol
.
Carol
receives, raises by c
and keeps that as the secret: g^abc (mod p)
.
If we denote this chain as A --> B --> C
then similar chains happen to get everyone synced to the same secret:
A --> B --> C
(which we just described)
B --> C --> A
C --> A --> B
Read more...
15 Mar 2021
- Competition: NahamCon CTF 2021
- Challenge Name: AgentTesterV2
- Type: Web
- Points: 500 pts
- Description:
The new developer we hired did a bad job and we got pwned. We hired someone else to fix the issue.
Author: @jorgectf#3896
Source: https://ctf.nahamcon.com/files/354c72ad810a5c9e05c55bc3c6cb6e35/agenttesterV2.zip or mirror
Union SQLi via websocket to SSRF bot to my own site hosting a CSRF to make bot update its profile with a PXSS in the about
field. The XSS exploits a Jinja2 SSTI on /debug
and exfils the Flask config back to my own server. Forge admin cookie using SECRET_KEY
and exploit SSTI directly to gain RCE.
Surprisingly my solution was unintended, see the author’s write-up for the intended solution (or this one by @bergi).
Read more...