Skip to content

Commit

Permalink
Test all the syncs
Browse files Browse the repository at this point in the history
  • Loading branch information
CBCicada committed Mar 11, 2024
1 parent 28afc83 commit 3b09a50
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 0 deletions.
14 changes: 14 additions & 0 deletions chals/crypto/test_chal/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ubuntu:20.04

RUN apt-get update && apt-get install -y socat python3

RUN adduser chal

RUN mkdir -p /chal
WORKDIR /chal

COPY chal.py flag.txt ./
RUN chmod 555 chal.py
USER chal

CMD socat -T60 TCP-LISTEN:1337,fork,reuseaddr EXEC:"python3 -u chal.py",stderr
18 changes: 18 additions & 0 deletions chals/crypto/test_chal/chal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import hashlib
import os.path

if __name__ == '__main__':
print("Welcome to my neutron collider. Using state of the art technology, I will smash two strings into each other. I call this ability 'string theory'.")
print("Weird stuff happens when they collide... the energy of the collision is so high it creates another third string that my research team is calling a 'flag'. ")
print("BUT!!!! To save resources, your strings must be sigpwny (TM) branded!!!")

x = input("string 1 > ").encode('utf8','surrogateescape')
y = input("string 2 > ").encode('utf8','surrogateescape')

if not x.startswith(b'sigpwny{') or not y.startswith(b'sigpwny{'):
print("Hey! I'm on a tight budget here. I need to reinvest as much as possible into my collider. Make sure both strings are sigpwny (TM) branded.")

if hashlib.md5(x).hexdigest() == hashlib.md5(y).hexdigest():
print(open('flag.txt').read() if os.path.isfile('flag.txt') else 'Error: no flag file found')
else:
print("Yeah those strings didn't collide. Maybe collide two different strings...")
27 changes: 27 additions & 0 deletions chals/crypto/test_chal/challenge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "TESTCHALLLLLLLLLLLLLLL"
author: Pete
category: Crypto
description: |-
My research team has toiled away to create a state-of-the-art neutron collider (Mark Demolisher V - MD5, for short).
Can you get two neutrons to collide?
`nc chal.fallctf.sigpwny.com 6001`
**author**: Pete
value: 500
type: dynamic
tags:
- medium
extra:
initial: 500
decay: 150
minimum: 100
flags:
- sigpwny{md5_is_broken_and_now_im_broke}
files:
- chal.py
hints:
- We need to execute a certain type of a md5 hash collision attack.
- Look for a tool to pull off a "md5 same prefix hash collision" attack.
- Use [HashClash](https://github.com/cr-marcstevens/hashclash)
state: hidden
Binary file added chals/crypto/test_chal/collision1.bin
Binary file not shown.
Binary file added chals/crypto/test_chal/collision2.bin
Binary file not shown.
1 change: 1 addition & 0 deletions chals/crypto/test_chal/flag.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sigpwny{md5_is_broken_and_now_im_broke}
2 changes: 2 additions & 0 deletions chals/crypto/test_chal/solution.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
(cat collision1.bin; echo ""; cat collision2.bin; echo "";) | python3 chal.py

0 comments on commit 3b09a50

Please sign in to comment.