前言

本次比赛, 打的挺舒服的

作为一个逆向手, 数据分析感觉做的很顺, 很爽

确实学到了很多东西, 也意识到了很多的不足

然后的话, 因为和队友没有提前沟通好的原因, 丢了100分就特别难受

我靠 数据安全题(CTF题型)累死累活才做出来 分数时动态的

而数据分析 思维活跃 随便解 分数却是死的 好烦

(就是说 比赛时 内部一定要交流好哇~~)

**一起共勉 加油 ^_^ **

数据分析题解

区块链威胁分析.1

请提交App的Team Identifier。(答案严格区分大小写)

题目010打开 发现是PK

改.zip打开是个 DAFOM.app

(就是这个app的名字)

Google搜索相关team ID信息

这是一篇很好的博客,讲的很到位(https://blog.csdn.net/liuxiaoxiaobo/article/details/122047015)

image-20230403111340896

然后随便翻翻文件有个叫DAFOM的

在010 打开

image-20230403111358079

W58CYKFH67

这个 就是 flag

区块链威胁分析.2

这个app 就是一个黑客组织Lazarus 向区块链行业 弄得恶意应用程序

所以答案就是Lazarus

C2流量分析.1

追踪TCP流 在流16

发现了答案

image-20230403111445659

这个就是flag

http://imgcache.cloudservicesdevc.tk/picturess/2023/RDSv38.dll

C2流量分析.2

请提交Payload的SHA256哈希值。(字母大写,请根据流量内容作答)

找个在线网站

image-20230403111548795

当然也可以用Linux命令(推荐)

flag AA2CBD3103CECAF189F93D787C602679E156CC6FD90E22646D637F01C64222CF

C2流量分析.3

Wireshark把文件导出来

根据题目描述 说有个有毒的程序

定位 最下面的DLL程序

确实也报毒了

用ida64打开

image-20230403111805956

flag cmd.exe /c C:/Users/Public/Documents/2022060128.vbe

C2流量分析.4

请提交Payload中需要Base64解码的cmd命令的个数。(答案示例:1)

image-20230403111834346

咱就是说, 我们这的师傅直接猜3拿了一血,牛

还有就是, 这数据分析题对逆向师傅来说也太友好了吧

fernet.3

针对 前两个我没写全(别的师傅解的), 我就只贴这个了

wireshark追踪流

7,8 ,9

image-20230403112050637

Base64转图片

image-20230403112100379

太抽象了 Stegsolve 转一下色道

image-20230403112115819

flag{a20cb3c9-141c-41c4-8255-0cd3eb95b681}

贴一下我的脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 这是思路
import base64
import os
from cryptography.fernet import Fernet
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC

key = "开头的key"

f = Fernet(key)

token = b'密文'
print("Decrypted data: ", f.decrypt(token).decode())

就是这样, 明白了吧

1
2
3
4
5
6
7
8
9
10
11
12
13
import base64
import os
from cryptography.fernet import Fernet
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC

key = "eBp92fUD7Lk_6qXR2pIjFt3sBH-lW0ul830S-sO6QCQ="

f = Fernet(key)

token = b'gAAAAABkGeDiBcfniXRJpihFhn0EPQUDIiNwd2FbIOpEMo4MNCVL9irQ6SwekLpgQ5zD5_nFti4Mij-VhdpKEifNi2hL1AqwZ7twArf96rxLpBVJEa2LmvM9plBSpg6f_qEWAQveQmI4VM_yWsTwPxPrNcB-syF8oV1T_xTMAFzL0vgj2ScD-SWnHP5ZbJ4AI_Jsdxnr7gFDrUvf5sbuCICGPW39sWs6bPyy73IWZvANBD3M4vb2n9M6LIuLhvs48oNvdc0YONqUj9qs_ezffqFeCtWvjEZP4LBKEWnIW-2XL1GE5wluChpwYvlFYMN0xoZmDOnuVYTFL0_438xQw7cSBSEgmdMnCNOWfDVZvh-kFahbbDMLUP3wrKviWeMHNLxS6p4ebrQECc-s_cDNzvZBr-zHPPtn-3O5zE0w-OJec0h31Q52paMmEPKWHybAWQHPELAFTaNxvU0h33qHsoObNgn4t5Rs066HAnM9RGpmj3ynalvhg0-uws1JxAgysNQIy4xtokfu9RFoBgtjymHFmlfRQ5Smck7Szw2Kqawz8psIHNbt2Av9gzKo5aPXJFN9vYKK59iu-qIv7IExD2Aap-RBVyKbn0pXlH7TztwTZ6V1VhkqI5QFrFEwjcC9uVZYTsot317WIHAoCA3bKGkZNb8emKYXUL7UhePDjr7ljAOQSZPrrZMYGIUJ8FLprkCOLJSJkJS4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WonTM3jbCMrKPtc59D0opu4Te5Il1_YatjbLbktQ7Xh0hr0nje8m9_n2Ek8wz-2zh8HMftCY_CNmqUtm6OiQxzzgfmA1C9nCohNprp6IpuO4zqGf9XekTavDc15UgOWbLJn5BzFVRIAnydYIzKRwDa62t4gntXKGH882KVDbLASueC7ms1vUJ_SzCSlzwC7WYerwi9p7tCmN7lzf7kuR4fTMDPNCaK52xNTMnZ9ZFqDqhfRlmqBj5LCps3xpHWFUPoWZLGWNVqRKKLvSLDNLHezYR-Q7np1Fp-10iCyjSslRzqBMeLHfZpFus_teKIfEupgUlbOJ1VpMWhgt4O1aD_PRvHMLLdN6U5QrtYn4N6d209VTEERYx4LE3SH7IjgV7_nHzzPhW_Z_G05S-AFSb_fd7aH4fJ7uHoT_W-24exJ46lKJ1xDJAq-1w7Mbwjlm_8lptuuDezyNYlI4woAPTFRZWXEUdVJ859zKSGL0fg-PR5ypUTnFkNkTjQ=='
print("Decrypted data: ", f.decrypt(token).decode())

数据安全-逆向部分

有两个是逆向题

一个看着吓人, 其实就是个RC4算法,而且还没魔改(不对, RC4确实不好魔改, 但是呢,也没有结合别的算法)挺好解的, 就是有点唬人了

而另一个不出意外的话就出意外了(BUSHI) 爆零了

letsGO

用go语言写的

总体思路就是

  1. 发现是RC4加密
  2. 找到密文
  3. 找流密钥(没有就暴破)
  4. 解密

ida64分析

image-20230403133430785

image-20230403133535399

image-20230403134818076

image-20230403142146129

贴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
#include<stdio.h>
#include <Windows.h>
#include <iostream>
using namespace std;
/*
RC4初始化函数
*/
void rc4_init(unsigned char* s, unsigned char* key, unsigned long Len_k)
{
int i = 0, j = 0;
char k[256] = { 0 };
unsigned char tmp = 0;
for (i = 0; i < 256; i++) {
s[i] = i;
k[i] = key[i % Len_k];
}
for (i = 0; i < 256; i++) {
j = (j + s[i] + k[i]) % 256;
tmp = s[i];
s[i] = s[j];
s[j] = tmp;

}

}

/*
RC4加解密函数
unsigned char* Data 加解密的数据
unsigned long Len_D 加解密数据的长度
unsigned char* key 密钥
unsigned long Len_k 密钥长度
*/
void rc4_crypt(unsigned char* Data, unsigned long Len_D, unsigned char* key, unsigned long Len_k) //加解密
{
unsigned char s[256];
rc4_init(s, key, Len_k);
int i = 0, j = 0, t = 0;
unsigned long k = 0;
unsigned char tmp;
for (k = 0; k < Len_D; k++) {
i = (i + 1) % 256;
j = (j + s[i]) % 256;
tmp = s[i];
s[i] = s[j];
s[j] = tmp;
t = (s[i] + s[j]) % 256;
Data[k] = Data[k] ^ s[t];
}
if (Data[0] == 'f' && Data[1] == 'l' && Data[2] == 'a' && Data[3] == 'g')
{
printf("ok");
cout << Data << endl;
}

}
void main()
{
//字符串密钥
unsigned char key[3] = { 0 };
unsigned long key_len = sizeof(key);

//密文
unsigned char data[] = { 0x6,0x74,0xb4,0xe2,0x49,0xd,0x91,0x36,0x95,0x9d,0x7a,0xfe,0xc7,0xa9,0xa4,0xa1,0xf0,0xf6,0x3,0x56,0x90,0xfa,0x1a,0x32,0xa7,0x6d,0x39,0xee };
unsigned char datas[] = { 0x6,0x74,0xb4,0xe2,0x49,0xd,0x91,0x36,0x95,0x9d,0x7a,0xfe,0xc7,0xa9,0xa4,0xa1,0xf0,0xf6,0x3,0x56,0x90,0xfa,0x1a,0x32,0xa7,0x6d,0x39,0xee };

//加解密
//rc4_crypt(data, sizeof(data), key, key_len);
for (int i1 = 0; i1 < 256; i1++)
{
for (int i2 = 0; i2 < 256; i2++)
{
for (int i3 = 0; i3 < 256; i3++)
{
key[0] = i1;
key[1] = i2;
key[2] = i3;
rc4_crypt(datas, sizeof(data), key, key_len);
memcpy(datas, data, sizeof(data));

}
}
}

return;
}

# flag{Go_1an9_1s_n07_s0_Hard}
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
# # def RC4(keys):
# # cipher = [0x6, 0x74, 0xb4, 0xe2, 0x49, 0xd, 0x91, 0x36, 0x95, 0x9d, 0x7a, 0xfe, 0xc7, 0xa9, 0xa4, 0xa1, 0xf0, 0xf6,
# # 0x3, 0x56, 0x90, 0xfa, 0x1a, 0x32, 0xa7, 0x6d, 0x39, 0xee]
# #
# # key = list(keys)
# # # KSA
# # S = [i for i in range(256)]
# # j = 0
# # for i in range(256):
# # j = (j + S[i] + ord(key[i % len(key)])) % 256
# # S[i], S[j] = S[j], S[i]
# # # PRGA
# # i = 0
# # j = 0
# # keystream = []
# # for k in range(26):
# # i = (i + 1) % 256
# # j = (j + S[i]) % 256
# # S[i], S[j] = S[j], S[i]
# # keystream.append(S[(S[i] + S[j]) % 256])
# #
# # enc = "".join(map(chr, [(cipher[i] ^ keystream[i]) for i in range(len(keystream))]))
# # if "flag" in enc:
# # print(key)
# #
# #
# # for i in range(256): # 48-57 ---- 0-9
# # for j in range(256):
# # for k in range(256):
# # RC4(chr(i) + chr(j) + chr(k))
#
# def Rc4_Encrypt(m, key):
# s = []
# t = []
# out = [] # putput
# for i in range(256):
# s.append(i)
# t.append(ord(key[i % len(key)]))
#
# j = 0
# for i in range(256):
# j = (j + s[i] + t[i]) % 256
# s[i], s[j] = s[j], s[i]
#
# i, j = 0, 0
# for p in range(len(m)):
# i = (i + 1) % 256
# j = (j + s[i]) % 256
#
# s[i], s[j] = s[j], s[i]
#
# index = (s[i] + s[j]) % 256
# out.append(s[index] ^ m[p])
# return (bytes(out))
#
#
# import itertools
#
# c = [0x6, 0x74, 0xb4, 0xe2, 0x49, 0xd, 0x91, 0x36, 0x95, 0x9d, 0x7a, 0xfe, 0xc7, 0xa9, 0xa4, 0xa1, 0xf0, 0xf6, 0x3,
# 0x56, 0x90, 0xfa, 0x1a, 0x32, 0xa7, 0x6d, 0x39, 0xee]
#
# k = []
# for i in itertools.product([str(i) for i in range(256)], repeat=3):
# k.append(i)
# for j in itertools.product([str(j) for j in range(256)], repeat=3):
# k.append(j)
# for m in itertools.product([str(m) for m in range(256)], repeat=3):
# k.append(m)
# # k = []
# # for i in range(256):
# # for j in range(256):
# # for m in range(256):
# # k = '2023'
#
# out = Rc4_Encrypt(bytes(c), k)
#
# try:
# print(out.decode())
# except:
# print("err")
def RC4(keys):
cipher = [0x6, 0x74, 0xb4, 0xe2, 0x49, 0xd, 0x91, 0x36, 0x95, 0x9d, 0x7a, 0xfe, 0xc7, 0xa9, 0xa4, 0xa1, 0xf0, 0xf6, 0x3, 0x56, 0x90, 0xfa, 0x1a, 0x32, 0xa7, 0x6d, 0x39, 0xee]
key = list(keys)
# KSA
S = [i for i in range(256)]
j = 0
for i in range(256):
j = (j + S[i] + ord(key[i % len(key)])) % 256
S[i], S[j] = S[j], S[i]
# PRGA
i = 0
j = 0
keystream = []
for k in range(len(cipher)):
i = (i + 1) % 256
j = (j + S[i]) % 256
S[i], S[j] = S[j], S[i]
keystream.append(S[(S[i] + S[j]) % 256])

enc = "".join(map(chr, [(cipher[i] ^ keystream[i]) for i in range(len(keystream))]))
if "flag" in enc:
print(key)
print(enc)


for i in range(126): # 48-57 ---- 0-9
for j in range(126):
for m in range(126):
RC4(chr(i) + chr(j) + chr(m))

# ['r', 'd', '}']
# flag{Go_1an9_1s_n07_s0_Hard}

python 比较慢

image-20230403160016011