BlockCTF 2024 Reverse
Nothin But Stringz
Someone sent me this as a test of friendship, but I can’t make heads or tails out of it. Can you help?
Download the nothin_but_stringz.c.o
(刚学到,感恩yuro!)
1 | nothin_but_stringz.c.o: LLVM bitcode, wrapper |
Judging by the file name, we strings
the file:
1 | 0$JY |
Was not it. Doing some research online you can find to decompile the LLVM bitcode you need the llvm-dis. And then it would output a ll file:
学个新东西:
llvm-dis
是 LLVM 工具链中的一个工具,用于将二进制格式的 LLVM IR(Intermediate Representation,中间表示)文件(即.bc
文件,bitcode 文件)反汇编成人类可读的 LLVM IR 文本格式(即.ll
文件)。
将结果输出到标准输出:
1 | llvm-dis nothin_but_stringz.c.o -o - |
1 | ┌──(kali㉿kali)-[~/Desktop] |
flag: flag{al1_th3_h0miez_l0v3_llvm_643e5f4a}
Red Flags
I made a video game, its really hard!
又是新东西:godot游戏,
Godot 的主要编程语言是 GDScript,同时也支持 C#、C++ 和其他语言。对于初学者,推荐从 GDScript 开始;对于需要复杂功能或生态支持的项目,可以选择 C# 或其他绑定语言。
工具:recover project
https://github.com/bruvzg/gdsdecomp
保存到本地,发现flag.tscn:
1 | func _process(delta): |
flag.tscn全文:
1 | [ ] |
和arena.tscn:
1 | var flags |
看**.;,;.** 团队关于这个题目的解法:
There are 1024 unique possible states since there are 10 “Flag_*” objects, so we can brute force all possible states and pick the one where the characters lie close together on the Y axis.
由于有 10 个 “Flag_*”对象,因此有 1024 种可能的状态,我们可以对所有可能的状态进行暴力破解,选出字符在 Y 轴上靠拢的状态。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 from hashlib import sha1, md5
def hex_byte_to_int(c):
if c >= 0x30 and c <= 0x39:
return c - 0x30
else:
return c - 0x37
chars = []
arena = open('arena.tscn', 'r').read().split('\n')[151:]
for i in range(30):
chunk = arena[i*9:i*9+9]
x = float(chunk[1].split()[-1])
y = float(chunk[2].split()[-1])
text = eval(chunk[5].split()[-1])
# print(x, y, text)
chars.append((x, y, text))
S = 50
for i in range(2**10):
b = bin(i)[2:].zfill(10)
sha = sha1(b.encode()).hexdigest().upper().encode()
sha += md5(b.encode()).hexdigest().upper().encode()
X, Y = [], []
for i in range(30):
X.append(hex_byte_to_int(sha[i * 2]) - 8)
Y.append(hex_byte_to_int(sha[i * 2 + 1]) - 8)
chars_moved = []
for i, (x, y, text) in enumerate(chars):
chars_moved.append((x + X[i] * S, y + Y[i] * S, text))
chars_moved_y = [y for x, y, text in chars_moved]
if max(chars_moved_y) - min(chars_moved_y) < 100:
# print(b)
chars_moved.sort(key=lambda x: x[0]) # left to right
print(''.join([text for x, y, text in chars_moved]))
还有yuro和BMK的思路:
没太懂。。问问
An Elf on a Shelf
What’s going on here?
“这是什么misc题放到rev中了吗”