首页
论坛
课程
招聘
[原创]第五空间 crackme深度分析
2022-9-22 12:44 3534

[原创]第五空间 crackme深度分析

2022-9-22 12:44
3534

题目分析

题目给了一堆启动鸿蒙liteos的套件,用jefferson解压rootfs.img得到文件系统,在bin目录里即可找到crakeme文件。直接拖进ida分析
图片描述
首先清理了一个全局变量bss_struct,然后进入了judge函数
图片描述
judge函数首先读取了/etc/config文件并将其读取到了内存里,所以我们首先来写脚本解析一下/etc/config文件:四个字节为一组,将每一组的值打印出来

1
2
3
4
5
6
7
from pwn import *
file1=open("./rootfs/etc/config","rb+").read()
length=len(file1)
nums=[]
for i in range(length//4):
    num=u32(file1[0+(i*4):4+(i*4)])
    success(hex(num))

图片描述
先不用管每个数值的具体用处,继续用ida进行静态分析
图片描述
这个地方取出config中的第一个数值用作偏移从栈中取值,变量newS到bp的距离是0x74,而这里取得值为&newS+4*0x1e即&newS+0x78,正好是返回地址的位置,所以这里取得值为返回地址。
图片描述
Constructor函数会初始化一个结构体S,并将其指针放入全局变量bss_struct中,S结构体结构如下
图片描述
为了方便,给全局变量bss_struct也定义了一个结构体,结构如下
图片描述
其中offset是从config中取值时用的下标,s_ptr是储存S结构体用的数组。初始化S结构体时会经历以下步骤:

  1. malloc出来一个chunk用作储存S结构体
  2. 以Constructor函数的第一个参数为下标将指针储存在bss_struct.s_ptr数组中
  3. 将Constructor函数的第二个参数指向的字符串拷贝进入S.content中
  4. 以第三个参数作为size,malloc出来一个新的chunk并将指针存入S.target_ptr中(如果size为0就将S.target_ptr指向0),将size赋值给S.target_length
  5. 如果S.target_length不等于0,将第四个参数执行的字符串拷贝到S.target_ptr中
  6. 根据第五个参数设置S的函数指针,如果为0则设置为读取函数,为1设置为输出函数

初始化完成结构体之后进入Parser函数,该函数首先会打印S.content的内容,再就会调用call_vfunc函数
图片描述
call_vfunc函数会先根据传入的参数从bss_struct.s_ptr取出相应的S结构体,如果S.target_ptr!=0就将target_ptr作为第一个参数(r0)来调用S的函数指针
图片描述

将target_ptr作为第一个参数是从汇编中看出来的
图片描述

 

下面又取出了config[1]并储存了起来,取出了config[2]作为了循环次数,之后进入了大循环,在循环里构造了一个新的S结构体,并且它的函数指针是通过"返回地址+config中的偏移"得到的(config的下标从3开始),经过两个永真的if之后,将新的S结构体的内容整体复制给了位于bss_struct.s_ptr[0]的结构体
图片描述

 

第一次逆到这里的时候完全看不懂在干什么。。只能动态调试看看发生甚么事了,在调试中就可以发现,bss_struct.s_ptr[0]->target_ptr的值和bss_struct.s_ptr[2]的值是一样的,并且bss_struct.s_ptr[0]和bss_struct.s_ptr[1]储存的指针也是一样的。要搞清楚发生了什么,得回到上面构造结构体的时候看一下
图片描述
首先构造了1、2号结构体,然后有销毁了1、2号结构体,我们查看Destructor函数就可以发现它free结构体指针之后没有清空。。。造成了一个uaf
图片描述
所以情况是这样的

1
2
3
4
5
free(S1)
free(S2)
malloc S0
malloc S0.taret_ptr
#伪代码,仅作为示范用

所以S0.target_ptr和S2指向的是同一个chunk,循环里实际上是在对S2结构体也就是bss_struct.s_ptr[2]中的结构体进行操作。
循环后半段就是取出bss_struct.s_ptr[2]结构体,将bss_struct.s_ptr[2]->target_ptr赋值为 bss_struct.s_ptr[6]->target_ptr(输入的位置),然后调用bss_struct.s_ptr[2]的函数指针,并判断返回值是不是1。
所以整体的逻辑就非常清晰了:每个循环依次调用ret_addr+confg[3+i]处的函数,以输入为参数,并判断返回值,循环九次
config中的后九个值解析成int是显然是负数,返回地址可以直接在ida里面找,为0x58DC(main函数中call judge的下一条指令的地址),由此可以还原出九个函数地址:

1
2
3
4
5
6
7
8
9
10
11
12
13
from pwn import *
file1=open("./rootfs/etc/config","rb+").read()
length=len(file1)
nums=[]
for i in range(length//4):
    num=u32(file1[0+(i*4):4+(i*4)])
    # success(hex(num))
    if(i>2):
        nums.append(num)
# print(nums)
for i in nums:
    tmp=(i^0xffffffff)+1
    success(hex(0x58DC-tmp))

图片描述
前八个函数是简单的换表,最后一个函数是对换表后的输入进行了一串运算并判断,所以用z3解方程之后再反向代换回去就能得到flag。
exp:

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
from z3 import *
s=Solver()
flag=[Int('%d'%i) for i in range(22)]
for i in range(22):
    s.add(flag[i]<256)
    s.add(flag[i]>0)
v25 =  (159947  * flag[0] - 17274276)
v24 =  (-76194 * flag[1] - 288728  * flag[0] + 36973368)
v23 =  (-247146 * flag[1] - 291401  * flag[0] - 166371 * flag[2] + 75709167)
v22 =  (-1741 * flag[1] + 218084 * flag[3] + 280814  * flag[0] - 149372 * flag[2] - 33947928)
v21 =  (174323 * flag[3] + 136024 * flag[2] - 141923 * flag[1] - 301049 * flag[4] + 323059  * flag[0] - 53238195)
v20 =  (
        -12269 * flag[3]
      + 286713 * flag[1]
      - 78320  * flag[0]
      + 301362 * flag[2]
      + 269836 * flag[5]
      - 255324 * flag[4]
      - 99312448)
v19 =  (
        -103798 * flag[2]
      + 201146 * flag[5]
      - 285406 * flag[3]
      - 188094 * flag[4]
      - 104025  * flag[0]
      - 50098 * flag[1]
      - 109789 * flag[6]
      + 50727897)
v18 =  (
        117443 * flag[7]
      + 275692 * flag[3]
      + 349275 * flag[1]
      - 381943 * flag[2]
      + 332376 * flag[4]
      - 269146 * flag[5]
      + 222994 * flag[6]
      - 267344  * flag[0]
      + 9817748)
v17 =  (
        19156 * flag[6]
      + -281586 * flag[7]
      - 168850  * flag[0]
      + 363716 * flag[3]
      - 32886 * flag[1]
      + 44299 * flag[4]
      + 170590 * flag[8]
      + 81061 * flag[5]
      + 201865 * flag[2]
      - 32987442)
v16 =  (
        22459 * flag[6]
      + -80349 * flag[1]
      + 239015 * flag[5]
      - 42367 * flag[9]
      - 113712 * flag[7]
      - 146568 * flag[2]
      + 241696 * flag[3]
      + 232212  * flag[0]
      - 162511 * flag[8]
      + 61621 * flag[4]
      - 41031017)
v15 =  (
        -1754  * flag[0]
      + 128062 * flag[7]
      - 329492 * flag[3]
      - 167316 * flag[2]
      - 178991 * flag[4]
      + 186377 * flag[10]
      + 307270 * flag[6]
      - 328477 * flag[8]
      + 248665 * flag[1]
      + 374863 * flag[9]
      + 373711 * flag[5]
      - 86829517)
v14 =  (
        11843 * flag[5]
      + 17087 * flag[3]
      - 35818  * flag[0]
      - 182330 * flag[7]
      - 354816 * flag[4]
      - 126036 * flag[2]
      + 114656 * flag[8]
      - 90442 * flag[9]
      + 330888 * flag[11]
      + 78226 * flag[10]
      - 260641 * flag[1]
      + 105414 * flag[6]
      + 63250156)
v13 =  (
        7469 * flag[9]
      + 6283 * flag[11]
      + -87345 * flag[2]
      + 248111 * flag[5]
      + 213581 * flag[4]
      + 89194 * flag[8]
      + 36305 * flag[6]
      + 98667 * flag[1]
      + 300755 * flag[12]
      + 191415 * flag[7]
      + 350540  * flag[0]
      + 359565 * flag[10]
      - 185365 * flag[3]
      - 165783260)
v12 =  (
        8209 * flag[8]
      + 131781 * flag[1]
      + 152898  * flag[0]
      + 40158 * flag[11]
      - 86271 * flag[12]
      - 105755 * flag[6]
      + 264037 * flag[3]
      - 130948 * flag[10]
      - 243572 * flag[7]
      - 48159 * flag[2]
      - 269443 * flag[9]
      - 376534 * flag[5]
      - 67954 * flag[4]
      - 119669 * flag[13]
      + 117580744)
v11 =  (
        -3429 * flag[6]
      + 102230 * flag[5]
      + 126967 * flag[10]
      - 344174 * flag[8]
      - 225911 * flag[11]
      + 118364 * flag[14]
      - 72044 * flag[1]
      + 280519  * flag[0]
      - 241789 * flag[2]
      - 274918 * flag[9]
      - 91055 * flag[12]
      - 122403 * flag[3]
      + 118907 * flag[7]
      - 34240 * flag[13]
      + 240524 * flag[4]
      + 35507568)
v10 =  (
        -24137 * flag[9]
      + 28203 * flag[13]
      + 150213 * flag[1]
      + 311204  * flag[0]
      - 94750 * flag[7]
      + 130029 * flag[2]
      - 305057 * flag[14]
      + 176246 * flag[5]
      - 256662 * flag[8]
      - 331010 * flag[12]
      - 301118 * flag[4]
      - 309379 * flag[10]
      + 187867 * flag[3]
      - 102250 * flag[11]
      - 340412 * flag[15]
      + 144084 * flag[6]
      + 39635710)
v9 =  (
       -27445 * flag[12]
     + -289483 * flag[10]
     - 164045 * flag[16]
     - 218276 * flag[1]
     + 183266 * flag[3]
     - 311967 * flag[8]
     - 55127 * flag[14]
     - 211824 * flag[13]
     - 375628 * flag[9]
     - 201931  * flag[0]
     - 324618 * flag[4]
     + 52026 * flag[6]
     + 93926 * flag[5]
     - 105199 * flag[7]
     - 254102 * flag[15]
     - 159881 * flag[11]
     + 378091 * flag[2]
     + 106013500)
v2 = flag[3]
# v8 =  (
#        27619 * flag[4]
#      + 9873 * flag[1]
#      + -23276 * flag[8]
#      + -196254 * flag[9]
#      + 181235  * flag[0]
#      + 150865 * flag[16]
#      - 148807 * flag[14]
#      - 272020 * flag[17]
#      - 346803 * flag[2]
#      - (flag[3] | (flag[3] << 16))
#      + 132879 * flag[10]
#      + 239833 * flag[6]
#      - 151023 * flag[11]
#      + 224631 * flag[12]
#      + 294607 * flag[5]
#      - 362447 * flag[7]
#      - 110250 * flag[15]
#      + 153229 * flag[13]
#      + 56953741)
v7 =  (
       -1159 * flag[1]
     + 6659 * flag[6]
     + -25875 * flag[7]
     + 80743 * flag[10]
     + 38124 * flag[9]
     + 40844 * flag[13]
     - 259165 * flag[12]
     + 340584 * flag[16]
     + 107346 * flag[2]
     - 124400 * flag[8]
     - 34846 * flag[11]
     - 338119 * flag[17]
     - 220860 * flag[5]
     + 167374 * flag[3]
     + 71134 * flag[15]
     - 143594 * flag[14]
     - 115172 * flag[4]
     - 104789  * flag[0]
     + 108066 * flag[18]
     + 50659353)
v3 =  (
       -26438 * flag[19]
     + 14055 * flag[10]
     + 31477 * flag[12]
     + -179950 * flag[4]
     + 79775 * flag[17]
     + 70516 * flag[5]
     + 330549 * flag[2]
     + 169852 * flag[11]
     + 51486 * flag[7]
     + 123944 * flag[13]
     - 370154 * flag[14]
     - 132851 * flag[18]
     + 237187 * flag[3]
     - 89341 * flag[9]
     - 256083 * flag[1]
     + 317327 * flag[0]
     + 42009 * flag[15]
     + 336122 * flag[6]
     + 128554 * flag[8]
     - 205903 * flag[16]
     - 112255597)
v4 =  (
       30250 * flag[5]
     + 127076 * flag[16]
     - 218938  * flag[0]
     + 162996 * flag[14]
     + 141792 * flag[12]
     - 197967 * flag[9]
     - 247332 * flag[4]
     - 286218 * flag[7]
     - 168508 * flag[18]
     + 300020 * flag[2]
     - 46255 * flag[10]
     - 78960 * flag[19]
     + 213181 * flag[6]
     - 329333 * flag[13]
     + 126938 * flag[8]
     - 266759 * flag[11]
     + 182266 * flag[17]
     - 41677 * flag[1]
     + 158645 * flag[15]
     - 61925 * flag[3]
     + 67755 * flag[20]
     - 52014431)
v5 =  (
       -281  * flag[0]
     + 10712 * flag[19]
     + 14584 * flag[4]
     + -167168 * flag[13]
     + 308120 * flag[7]
     - 233003 * flag[8]
     + 114047 * flag[14]
     + 330767 * flag[10]
     - 71246 * flag[6]
     - 259485 * flag[2]
     + 374645 * flag[21]
     - 116397 * flag[3]
     + 64115 * flag[20]
     + 281339 * flag[9]
     + 321916 * flag[15]
     - 272240 * flag[12]
     - 135149 * flag[16]
     - 288340 * flag[18]
     + 71833 * flag[11]
     - 233821 * flag[1]
     - 223297 * flag[17]
     + 141256 * flag[5]
     + 17267952)
s.add(v5 == 0)
s.add(v4 == 0)
s.add(v3 == 0)
s.add(v7 == 0)
s.add(v9 == 0)
s.add(v10 == 0)
s.add(v11 == 0)
s.add(v12 == 0)
s.add(v13 == 0)
s.add(v14 == 0)
s.add(v15 == 0)
s.add(v16 == 0)
s.add(v17 == 0)
s.add(v18 == 0)
s.add(v19 == 0)
s.add(v20 == 0)
s.add(v21 == 0)
s.add(v22 == 0)
s.add(v23 == 0)
s.add(v24 == 0)
s.add(v25 == 0)
 
if s.check()==sat:
    res=s.model()
data=[]
for i in flag:
    data.append(res[i])
print(data)
a=[0]*8
a[0]=[
  0xB6, 0xC7, 0xC5, 0x51, 0xE3, 0x1C, 0x97, 0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  0xBA, 0xE5, 0x4D, 0x14, 0x4B, 0x04, 0x3A, 0x89, 0x0B, 0xEE,
  0x4E, 0xD4, 0xC4, 0x15, 0x6A, 0x58, 0xB5, 0xCD, 0x55, 0x5A,
  0x94, 0x52, 0xFC, 0x7A, 0x73, 0x96, 0x5F, 0x1C, 0x88, 0x6C,
  0x37, 0xA9, 0x25, 0xA2, 0xDF, 0xE2, 0xDD, 0xFA, 0xD7, 0xCC,
  0x0F, 0xAF, 0x69, 0x27, 0xC9, 0x7F, 0x08, 0x32, 0x45, 0x6F,
  0xA3, 0x0E, 0x47, 0x2F, 0xC2, 0xE3, 0xBE, 0xF9, 0x29, 0xBC,
  0x3C, 0xE1, 0x42, 0xD6, 0x03, 0x8C, 0xE9, 0x62, 0xF3, 0xE8,
  0x33, 0x0D, 0x2C, 0x78, 0x13, 0x1A
]
for i in range(8):
  for k in range(22):
    for j in range(256):
      if(data[k]==a[i][j]):
        data[k]=j
        break
print(bytes(bytearray(data)))

得到flag:
图片描述

附件

完整附件:https://pan.baidu.com/s/1g5mlSO_o-pOG4uLNB9zEYw?pwd=eqty
上传的附件为crackme和crackme.idb


看雪2022 KCTF 秋季赛 防守篇规则,征题截止日期11月12日!(iPhone 14等你拿!)

上传的附件:
收藏
点赞2
打赏
分享
最新回复 (2)
雪    币: 671
活跃值: 活跃值 (528)
能力值: ( LV4,RANK:42 )
在线值:
发帖
回帖
粉丝
trackL 活跃值 2022-9-25 11:59
2
0
雪    币: 782
活跃值: 活跃值 (135)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
mb_wjynirwq 活跃值 3天前
3
0
师傅可以详细说下这个结构体是怎么一步一步分析的吗
游客
登录 | 注册 方可回帖
返回