Skip to content

Commit 5c12ac5

Browse files
authored
Update writeups by Byron @ Black Bauhinia (#7)
1 parent 8bfe5e1 commit 5c12ac5

File tree

16 files changed

+373
-11
lines changed

16 files changed

+373
-11
lines changed

crackme/writeups/author/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Crackme
2+
3+
## Prologue
4+
5+
Trying to design a chal with medium level for secondary school.
6+
7+
## Walk-through
8+
9+
Use `dex-tool` to convert APK to jar.
10+
![](./img/01.PNG)
11+
12+
Use `jd-gui` for decompiling jar, you may see the logic handling flag checking
13+
![](./img/02.PNG)
14+
15+
Use `z3` to solve the SMT, or it's simple enough to do it by hand. Check out `sol.py` for z3 usage.
16+
![](./img/03.PNG)
17+
18+
## Flag
19+
`hkcert20{ar3_y0u_us1ng_z3}`
20+
21+
## Epilogue
22+
Solve: 13/84 (Secondary)
23+
Solve: 34/81 (Tertiary)
24+
25+
Unlike Doom, you can really run the apk on device with Andriod 7.0+. Why are you expecting that the chals can be run on machines?
26+
27+
## Reference
28+
<https://github.com/Z3Prover/z3>
29+

crackme/writeups/author/img/001.PNG

19.6 KB
Loading

crackme/writeups/author/img/002.PNG

83 KB
Loading

crackme/writeups/author/img/003.PNG

222 KB
Loading

crackme/writeups/author/sol.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from z3 import *
2+
s=[Int('serial%d' % i) for i in range(26)]
3+
solver = Solver()
4+
5+
solver.add(s[0] + s[1] - s[2] == 112)
6+
solver.add(s[1] + s[2] - s[3] == 105)
7+
solver.add(s[2] + s[3] - s[4] == 86)
8+
solver.add(s[3] + s[4] - s[5] == 99)
9+
solver.add(s[4] + s[5] - s[6] == 180)
10+
solver.add(s[5] + s[6] - s[7] == 118)
11+
solver.add(s[6] + s[7] - s[8] == -25)
12+
solver.add(s[7] + s[8] - s[9] == 74)
13+
solver.add(s[8] + s[9] - s[10] == 106)
14+
solver.add(s[9] + s[10] - s[11] == 160)
15+
solver.add(s[10] + s[11] - s[12] == 70)
16+
solver.add(s[11] + s[12] - s[13] == 25)
17+
solver.add(s[12] + s[13] - s[14] == 168)
18+
solver.add(s[13] + s[14] - s[15] == 52)
19+
solver.add(s[14] + s[15] - s[16] == 70)
20+
solver.add(s[15] + s[16] - s[17] == 95)
21+
solver.add(s[16] + s[17] - s[18] == 97)
22+
solver.add(s[17] + s[18] - s[19] == 183)
23+
solver.add(s[18] + s[19] - s[20] == 54)
24+
solver.add(s[19] + s[20] - s[21] == 56)
25+
solver.add(s[20] + s[21] - s[22] == 118)
26+
solver.add(s[21] + s[22] - s[23] == 76)
27+
solver.add(s[22] + s[23] - s[24] == 166)
28+
solver.add(s[23] + s[24] - s[25] == 48)
29+
solver.add(s[24] + s[25] - s[0] == 72)
30+
solver.add(s[25] + s[0] - s[1] == 122)
31+
32+
33+
print(solver.check())
34+
answer=solver.model()
35+
print(answer)
36+
37+
tidy_answer = ""
38+
for each in s :
39+
tidy_answer += str(chr(int(str(answer[each]))))
40+
41+
print(tidy_answer)

dns/writeups/author/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# DNS
2+
3+
## Prologue
4+
5+
I sorry that the trash has cost you 10 points.
6+
7+
## Walk-through
8+
(Over 15 solve, omitted)
9+
10+
## Flag
11+
12+
`hkcert20{DNS_r3c0rd_c4n_hid3_inf0rm4ti0ns}`
13+
14+
## Epilogue
15+
Solve: 20/84 (Secondary)
16+
Solve: 39/81 (Tertiary)
17+
18+
Some competitors said that the tools cannot decode Chinese character, or their teammates cannot read Chinese.
19+
I am creating this challenge all in Chinese to arouse the attention of secondary school students, which is requested by some co-ogranisers.
20+
21+
## Reference
22+
<https://en.wikipedia.org/wiki/TXT_record>

jpg-as-key/writeups/author/README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# JPG as Key
2+
3+
## Prologue
4+
Just a normal secondary school trick to hide zip with known plaintext attack.
5+
6+
## Walk-through
7+
8+
### File Extraction
9+
Extract the zip using the command below
10+
```console
11+
$ binwalk ./left_exit.jpg --dd='.*'
12+
13+
DECIMAL HEXADECIMAL DESCRIPTION
14+
--------------------------------------------------------------------------------
15+
0 0x0 JPEG image data, JFIF standard 1.01
16+
51405 0xC8CD Zip archive data, encrypted at least v2.0 to extract, compressed size: 3007, uncompressed size: 3048, name: flag.png
17+
54450 0xD4B2 Zip archive data, encrypted at least v2.0 to extract, compressed size: 51376, uncompressed size: 51405, name: left_exit.jpg
18+
106054 0x19E46 End of Zip archive, footer length: 22
19+
```
20+
21+
Use the command below will extract the original pic. Otherwise, use 7zip split function.
22+
I'm also seeing team using foremost to extract the pic but it's not necessary. Use binwalk wisely.
23+
```console
24+
$ binwalk ./left_exit.jpg -o 0 -l 51405 --dd='.*'
25+
26+
DECIMAL HEXADECIMAL DESCRIPTION
27+
--------------------------------------------------------------------------------
28+
0 0x0 JPEG image data, JFIF standard 1.01
29+
```
30+
31+
Rename `0` as `left_exit.jpg`, and zip it under 7zip. This move is to generate a zip matches the CRC value.
32+
33+
### Plain-text attack
34+
After getting the plain text (`left_exit.jpg`), we can move on to attack stage. `pkzip` or `AZPK` should work.
35+
Here I've use `bkzip`:
36+
37+
```console
38+
$ ./bkcrack -C ~/Desktop/C8CD -c left_exit.jpg -P ~/Desktop/plain-text/left_exit.zip -p left_exit.jpg
39+
Generated 4194304 Z values.
40+
[13:04:10] Z reduction using 51356 bytes of known plaintext
41+
100.0 % (51356 / 51356)
42+
271 values remaining.
43+
[13:04:19] Attack on 271 Z values at index 45903
44+
13.3 % (36 / 271)
45+
[13:04:19] Keys
46+
3e96cca9 6c2a40c9 7c4d40e4
47+
48+
$ ./bkcrack -C '/home/byronwai/Desktop/C8CD' -c flag.png -k 3e96cca9 6c2a40c9 7c4d40e4 -d ~/Desktop/deflate_flag
49+
Wrote deciphered text.
50+
51+
$ ../tools/inflate.py < ~/Desktop/deflate_flag > ~/Desktop/flag.png
52+
```
53+
54+
The flag is in QR code, scan and get the flag directly.
55+
56+
## Flag
57+
`hkcert20{n0w_y0u_can_crack_z1p}`
58+
59+
## Epilogue
60+
Solve: 11/81 (Tertiary)
61+
62+
There exist competitor(s) saying that ["its stupid to put native file format tricks into challenges"] (https://www.youtube.com/watch?v=VVdmmN0su6E&feature=youtu.be&t=690&ab_channel=LiveOverflow).
63+
Yes, I admit that this chal is stupid but I expect having at least 20 solves.
64+
65+
## Refernce
66+
<https://zhuanlan.zhihu.com/p/129855130>

keystroke/writeups/author/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# DNS
2+
3+
## Prologue
4+
5+
This chal is a trash. I will not make this type of chal again.
6+
7+
## Walk-through
8+
9+
(Over 15 solve, omitted)
10+
11+
## Flag
12+
13+
`hkcert20{The_answer_is_8_6}`
14+
15+
## Epilogue
16+
17+
Solve: 16/84 (Secondary)
18+
Solve: 28/81 (Tertiary)
19+
20+
Some competetors said that they forgot all the chemistry and hate this chal a lot. But it's based on a DSE physics past paper. LMGTFY.
21+
22+
## Reference
23+
24+
<https://usb.org/sites/default/files/hut1_2.pdf>
25+
<https://dsepp.com/wp-content/uploads/2018/10/2016-DSE-PHY-1B.pdf>
26+
<https://dsepp.com/wp-content/uploads/2018/10/2016-DSE-PHY-1-MS-1.pdf>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Missing Disk
2+
3+
## Prologue
4+
5+
(Omitted)
6+
7+
## Walk-through
8+
9+
(Over 15 solve, omitted)
10+
11+
## Flag
12+
13+
`hkcert20{w0rk_1n_t3nc3nt_f0r_t3nc3nts}`
14+
15+
## Epilogue
16+
Solve: 19/81 (Tertiary)
17+
18+
I was trying to build a complicated challenge, but there are unintended solutions making this chal much more easy than expected.
19+
20+
## Reference
21+
22+
(Omitted)

ram/writeups/author/001.png

-180 KB
Binary file not shown.

0 commit comments

Comments
 (0)