最近遇到一个wibu加密的程序,使用wibu证书进行授权,类似于sentianl的软锁SL,没有加密狗。
先分析一下CodeMeterLin有哪些算法,在IDA上最好是使用findcrypt插件,另外还可使用binwalk或者die。 我这里使用的是die,可以看到有base64和AES、sha256等常用算法。
打开WibuCmLIF文件看看,看到这串字符串大概就能推断出是base64加密。解密后放进die看看其熵值,蛮高的,感觉还是加密的状态。
一开始认为需要aes或des解密,在两个算法的相关函数下断点,并没有发现明显解密的过程,最后直接追踪tcp接收流的去向,找到了相关的解密(解扰)算法,其中0x5917和0x4A6B是算法参数,而a2初值为WibuCmLIF文件的时间戳(TimeStamp)。解完之后可以再看看数据的熵值,看看是不是还需要解密。如图,熵值降低了很多,并且能看到明显的字符串,可以认为解密成功了。
解完后的数据是一段asn1码流,可以使用一些在线网站初步解析,但里面有很多wibu自己定义的字段,需要写代码将这些asn1定义涵盖进来。
这里先放LIF的解析过程,有兴趣的朋友可以自行查看,后续的文件也会涉及到这里面的函数。这里先看看虚拟机检测函数,大致是检测CPU信息、硬盘信息、中断表、驱动等,待会需要先强制修改返回值来跳过虚拟机检查。
【预告】
接下来会讲解一下如何asn1的一些相关知识,以及如何使用CodeMeterLin内的asn1定义解析码流。
$cmu
-
v
cmu
-
CodeMeter Universal Support Tool.
Version
6.60
of
2017
-
Dec
-
18
(Build
2869
)
for
Linux
Copyright (C)
2007
-
2017
by WIBU
-
SYSTEMS AG.
All
rights reserved.
Operating System:
Name: Ubuntu
18.04
.
6
LTS (Kernel
5.4
.
0
-
124
-
generic)
Architecture: x86_64
$cmu
-
v
cmu
-
CodeMeter Universal Support Tool.
Version
6.60
of
2017
-
Dec
-
18
(Build
2869
)
for
Linux
Copyright (C)
2007
-
2017
by WIBU
-
SYSTEMS AG.
All
rights reserved.
Operating System:
Name: Ubuntu
18.04
.
6
LTS (Kernel
5.4
.
0
-
124
-
generic)
Architecture: x86_64
cmboxpgm.exe
-
f6000010
-
lif:
"MyFirstUfcLif.WibuCmLIF"
-
lfs:smart:
3
-
lpn:
"Universal Firm Code - 2000"
-
lpid:
2000
-
lopt:vm,reimport
-
v
cmboxpgm.exe
-
f6000010
-
lif:
"MyFirstUfcLif.WibuCmLIF"
-
lfs:smart:
3
-
lpn:
"Universal Firm Code - 2000"
-
lpid:
2000
-
lopt:vm,reimport
-
v
$cmu
-
i
-
f xxx.WibuCmLIF
cmu
-
CodeMeter Universal Support Tool.
Version
6.60
of
2017
-
Dec
-
18
(Build
2869
)
for
Linux
Copyright (C)
2007
-
2017
by WIBU
-
SYSTEMS AG.
All
rights reserved.
List
remote updates failed: It
is
not
permitted to use this license on a virtual machine, Error
273.
$cmu
-
i
-
f xxx.WibuCmLIF
cmu
-
CodeMeter Universal Support Tool.
Version
6.60
of
2017
-
Dec
-
18
(Build
2869
)
for
Linux
Copyright (C)
2007
-
2017
by WIBU
-
SYSTEMS AG.
All
rights reserved.
List
remote updates failed: It
is
not
permitted to use this license on a virtual machine, Error
273.
sudo netstat
-
tlp | grep
22350
tcp
0
0
0.0
.
0.0
:
22350
0.0
.
0.0
:
*
LISTEN
12483
/
CodeMeterLin
tcp6
0
0
[::]:
22350
[::]:
*
LISTEN
12483
/
CodeMeterLin
sudo netstat
-
tlp | grep
22350
tcp
0
0
0.0
.
0.0
:
22350
0.0
.
0.0
:
*
LISTEN
12483
/
CodeMeterLin
tcp6
0
0
[::]:
22350
[::]:
*
LISTEN
12483
/
CodeMeterLin
cmu
-
i
-
f xxx.WibuCmLIF
cmu
-
CodeMeter Universal Support Tool.
Version
6.60
of
2017
-
Dec
-
18
(Build
2869
)
for
Linux
Copyright (C)
2007
-
2017
by WIBU
-
SYSTEMS AG.
All
rights reserved.
List
remote updates failed: A network error occurred, Error
100.
cmu
-
i
-
f xxx.WibuCmLIF
cmu
-
CodeMeter Universal Support Tool.
Version
6.60
of
2017
-
Dec
-
18
(Build
2869
)
for
Linux
Copyright (C)
2007
-
2017
by WIBU
-
SYSTEMS AG.
All
rights reserved.
List
remote updates failed: A network error occurred, Error
100.
char __fastcall license_dec(__int64 a1, __int64 a2)
{
int
v2;
/
/
edx
char result;
/
/
al
_DWORD
*
v4;
/
/
rcx
unsigned __int64 v5;
/
/
r8
unsigned __int64 v6;
/
/
r8
unsigned
int
v7;
/
/
edx
__int64 v8;
/
/
rax
v2
=
*
(_DWORD
*
)(a1
+
260
);
result
=
0
;
if
( (v2 &
1
)
=
=
0
)
{
result
=
1
;
if
( (v2 &
2
) !
=
0
)
{
v4
=
*
(_DWORD
*
*
)(a1
+
264
);
if
( v4 )
{
v5
=
*
(_QWORD
*
)(a1
+
280
);
if
( v5 )
{
result
=
0
;
if
( !a2 )
return
result;
v6
=
v5 >>
2
;
if
( v6 )
{
v7
=
0
;
v8
=
0LL
;
do
{
v4[v8] ^
=
a2;
v8
=
+
+
v7;
a2
=
0x5917
*
a2
+
0x4A6B
;
}
while
( v7 < v6 );
v2
=
*
(_DWORD
*
)(a1
+
260
);
}
}
}
result
=
1
;
*
(_DWORD
*
)(a1
+
260
)
=
v2 &
0xFFFFFFFD
;
}
}
return
result;
}
char __fastcall license_dec(__int64 a1, __int64 a2)
{
int
v2;
/
/
edx
char result;
/
/
al
_DWORD
*
v4;
/
/
rcx
unsigned __int64 v5;
/
/
r8
unsigned __int64 v6;
/
/
r8
unsigned
int
v7;
/
/
edx
__int64 v8;
/
/
rax
v2
=
*
(_DWORD
*
)(a1
+
260
);
result
=
0
;
if
( (v2 &
1
)
=
=
0
)
{
result
=
1
;
if
( (v2 &
2
) !
=
0
)
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)
最后于 2022-9-6 22:41
被bluefish蓝鱼编辑
,原因: 标题修改