Skip to content

Commit a2e53a3

Browse files
committed
few minor updates
1 parent 32bb747 commit a2e53a3

File tree

9 files changed

+23
-29
lines changed

9 files changed

+23
-29
lines changed

2 - stream key reuse/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ head -c 21 /dev/zero | ./encrypt.py "Super secret key" > cipher2
99
```
1010
./encryptimage.py alexei.png smile.png
1111
```
12-
Then open in GIMP and layer difference
12+
Then open the resulting images in Krita and XOR layers (In GIMP, you can use layer difference but it's not quite the same)
1313

14+
You can also use a coomand line tool:
1415
`sudo apt install gmic`
1516

1617
https://stackoverflow.com/a/40049271
1718
```
18-
gmic alexei-encrypted.png smile-encrypted.png -blend xor -o xor1.png
19-
gmic alexei-encrypted.png smile-encrypted.png smile.png -blend xor -o xor2.png
19+
gmic alexei-enc.png smile-enc.png -blend xor -o xor1.png
20+
gmic alexei-enc.png smile-enc.png smile.png -blend xor -o xor2.png
2021
```
2122

22-
2323
Images:
2424

2525
- https://www.publicdomainpictures.net/en/view-image.php?image=128827&picture=clip-art-smiley-face

4 - key as IV/README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ pip install pycryptodome
2121

2222
Run the application
2323
```
24-
export FLASK_APP=server.py
25-
flask run
24+
FLASK_RUN_PORT=5004 FLASK_APP=server.py flask run
2625
```
2726

2827
## Use the application
2928

30-
Navigate to http://localhost:5000, start browser developer tools, and examine the session cookie
29+
Navigate to http://localhost:5004, start browser developer tools, and examine the session cookie
3130

3231

3332
## Break the session cookie encryption key

5 - padding oracle/README.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,21 @@ pip install pycryptodome
2121

2222
Run the application
2323
```
24-
export FLASK_APP=server.py
25-
flask run
24+
FLASK_RUN_PORT=5005 FLASK_APP=server.py flask run
2625
```
2726

2827
## Use the application
2928

30-
Navigate to http://localhost:5000 and see what's going on
29+
Navigate to http://localhost:5005 and see what's going on
3130

3231

3332
## Padding oracle attack
3433

3534
See what the app tells you. Then try to go the URL with a valid message and with an invalid one, e.g.
3635

37-
http://localhost:5000/send?msg=deadbeef
36+
http://localhost:5005/send?msg=deadbeef
3837

39-
http://localhost:5000/send?msg=296729c7564ad3198f686f24850a16647d2a269a96d21148c1be75f45768a809396db14ddb0dc6ae1f6ee9ebe49eb49e
38+
http://localhost:5005/send?msg=296729c7564ad3198f686f24850a16647d2a269a96d21148c1be75f45768a809396db14ddb0dc6ae1f6ee9ebe49eb49e
4039

4140
(your ciphertext will be different!)
4241

@@ -45,5 +44,5 @@ Notice the app returns different code depending on the validity.
4544
Now run the exploit (your ciphertext will be different)
4645

4746
```
48-
$ ./exploit.py http://localhost:5000/send?msg=36289eda81e4895db64c84bae1468eb21b122cebcaf1b0d81232a496d77a3238df444a038398693869ac3c598b434c59
47+
$ ./exploit.py http://localhost:5005/send?msg=36289eda81e4895db64c84bae1468eb21b122cebcaf1b0d81232a496d77a3238df444a038398693869ac3c598b434c59
4948
```
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<html>
22
<head><title>Padding oracle</title></head>
33
<body>
4+
<p>Hello human!</p>
45
<p>Send me an encrypted message using <a href="send?msg=">http://{{host}}/send?msg=</a></p>
5-
<p>for example:<br/>
6-
<a href="send?msg={{msg}}">http://{{host}}/send?msg={{msg}}</a><br/>
7-
(you can't decrypt since you don't have the key, loser)</p>
6+
<p>for example: <a href="send?msg={{msg}}">http://{{host}}/send?msg={{msg}}</a></p>
7+
<p><em>Note: only I can decrypt the message (you don't have the key!)</em></p>
88
</body>
99
</html>
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<html>
22
<head><title>Thank you</title></head>
33
<body>
4-
<p>Thank you for your message! We'll get back to you soon.</p>
4+
<p>Thank you for your message! I'll get back to you soon.</p>
55
</body>
66
</html>

6 - stream integrity/README.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ pip install pycryptodome
2121

2222
Run the application
2323
```
24-
export FLASK_APP=server.py
25-
flask run
24+
FLASK_RUN_PORT=5006 FLASK_APP=server.py flask run
2625
```
2726

2827
## Use the application
2928

30-
Navigate to http://localhost:5000, start browser developer tools, and examine the session cookie
29+
Navigate to http://localhost:5006, start browser developer tools, and examine the session cookie
3130

3231

3332
## Bit flipping attack
@@ -56,9 +55,9 @@ Putting everything together:
5655

5756

5857
```
59-
$ ./flip.py 'j/3zPw9KCchD8ofdX/EaH8BNQuPhWG0x/IG3mZa67rA17FAMygLR' '{"user": "guest", "date": "2020-01-29"}' '{"user": "admin"}'
58+
$ ./flip.py '9G/ySV3Ry9E=.j/3zPw9KCchD8ofdX/EaH8BNQuPhWG0x/IG3mZa67rA17FAMygLR' '{"user": "guest", "date": "2020-01-29"}' '{"user": "admin"}'
6059
61-
j/3zPw9KCchD8oHMV+sAH5E=
60+
9G/ySV3Ry9E=.j/3zPw9KCchD8oHMV+sAH5E=
6261
```
6362

6463
Now, replace the encrypted part with the new value in the session cookie, refresh the page and behold the admin session!

7 - block integrity/README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ pip install pycryptodome
2121

2222
Run the application
2323
```
24-
export FLASK_APP=server.py
25-
flask run
24+
FLASK_RUN_PORT=5007 FLASK_APP=server.py flask run
2625
```
2726

2827
## Use the application
2928

30-
Navigate to http://localhost:5000, start browser developer tools, and examine the session cookie
29+
Navigate to http://localhost:5007, start browser developer tools, and examine the session cookie
3130

3231

3332
## Bit flipping attack

README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Offensive Help: Crypto Mistakes ON demand! (OH C'MON!)
22

3-
These examples are written in Python 3 and require a couple of modules to be installed:
4-
5-
`pip3 install pycryptodome numpy`
3+
These examples are written in Python 3 and may require additional modules to be installed.
64

75
See the readmes in each directory for guidance.
86

runflask

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ python3 -m venv venv
44
source venv/bin/activate
55
pip install Flask
66
pip install pycryptodome
7-
FLASK_APP=server.py flask run --port $1
7+
FLASK_RUN_PORT=$1 FLASK_APP=server.py flask run

0 commit comments

Comments
 (0)