Detekce vzorů v binárních spustitelných souborech
-
Upload
milan-zavoral -
Category
Software
-
view
73 -
download
4
Transcript of Detekce vzorů v binárních spustitelných souborech
![Page 1: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/1.jpg)
Detekce vzoru v binarnıch spustitelnych souborech
Milan Zavoral
vedoucı: Ing. Peter Matula
![Page 2: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/2.jpg)
Struktura zpetneho prekladace
Detekce vzoru v binarnıch spustitelnych souborech 2 / 10
![Page 3: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/3.jpg)
Detekce vzoru ve zpetnem prekladaci
zadanı
sjednotit a vylepsit existujıcımetody detekce vzoru
doplnit metody pro detekcinovych typu vzoru
pouzity prekladac ci packer
staticky linkovany kod (pomaladetekce)
odlisne formaty signatur
chybejıcı detekcekryptografickych konstrukcı
chybejıcı detekce zranitelnostı askodliveho kodu
Detekce vzoru v binarnıch spustitelnych souborech 3 / 10
![Page 4: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/4.jpg)
Detekce vzoru ve zpetnem prekladaci
zadanı
sjednotit a vylepsit existujıcımetody detekce vzoru
doplnit metody pro detekcinovych typu vzoru
pouzity prekladac ci packer
staticky linkovany kod (pomaladetekce)
odlisne formaty signatur
chybejıcı detekcekryptografickych konstrukcı
chybejıcı detekce zranitelnostı askodliveho kodu
Detekce vzoru v binarnıch spustitelnych souborech 3 / 10
![Page 5: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/5.jpg)
Detekce vzoru ve zpetnem prekladaci
zadanı
sjednotit a vylepsit existujıcımetody detekce vzoru
doplnit metody pro detekcinovych typu vzoru
pouzity prekladac ci packer
staticky linkovany kod (pomaladetekce)
odlisne formaty signatur
chybejıcı detekcekryptografickych konstrukcı
chybejıcı detekce zranitelnostı askodliveho kodu
Detekce vzoru v binarnıch spustitelnych souborech 3 / 10
![Page 6: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/6.jpg)
Detekce vzoru ve zpetnem prekladaci
zadanı
sjednotit a vylepsit existujıcımetody detekce vzoru
doplnit metody pro detekcinovych typu vzoru
pouzity prekladac ci packer
staticky linkovany kod (pomaladetekce)
odlisne formaty signatur
chybejıcı detekcekryptografickych konstrukcı
chybejıcı detekce zranitelnostı askodliveho kodu
Detekce vzoru v binarnıch spustitelnych souborech 3 / 10
![Page 7: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/7.jpg)
Detekce vzoru ve zpetnem prekladaci
zadanı
sjednotit a vylepsit existujıcımetody detekce vzoru
doplnit metody pro detekcinovych typu vzoru
pouzity prekladac ci packer
staticky linkovany kod (pomaladetekce)
odlisne formaty signatur
chybejıcı detekcekryptografickych konstrukcı
chybejıcı detekce zranitelnostı askodliveho kodu
Detekce vzoru v binarnıch spustitelnych souborech 3 / 10
![Page 8: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/8.jpg)
Puvodnı detekce vzoru
pouzity prekladac ci packer
signatury
{
"ExePack",
"1.4",
"by Jon Snow",
0,
0,
"33C08BC0 --68---C;",
}
Detekce vzoru v binarnıch spustitelnych souborech 4 / 10
![Page 9: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/9.jpg)
Puvodnı detekce vzoru
pouzity prekladac ci packer
signatury
{
"ExePack",
"1.4",
"by Jon Snow",
0,
0,
"33C08BC0 --68---C;",
}
heuristiky
Detekce vzoru v binarnıch spustitelnych souborech 4 / 10
![Page 10: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/10.jpg)
Puvodnı detekce vzoru
pouzity prekladac ci packer
signatury
{
"ExePack",
"1.4",
"by Jon Snow",
0,
0,
"33C08BC0 --68---C;",
}
heuristiky
staticky linkovany kod
.0001111000011111010110111110000111100101101110000011110
| 1 N 20 D4ED 005C 1 0000 __do_global_dtors
Detekce vzoru v binarnıch spustitelnych souborech 4 / 10
![Page 11: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/11.jpg)
Sjednocenı signatur — YARA pravidla
{
"ExePack ",
"1.4 ",
"by Jon Snow",
0,
0,
"33C08BC0 --68--- C;",
}
rule exe_pack {
meta:
name = "ExePack "
version = "1.4"
comment = "by Jon Snow"
strings :
$1 = { 33 C0 8B C0 ?? 68 ?? ?C }
condition :
$1 at entrypoint
}
.0001111000011111010110111110000111100101101110000011110
| 1 N 20 D4ED 005C 1 0000 __do_global_dtors
rule do_global_dtors_aux {
meta:
patternSet = "1 N 20 D4ED 005C 1 0000 __do_global_dtors"
strings :
$1 = { ( 0F | 8F ) 0F AD F0 F2 DC 1E }
condition :
$1
}
Detekce vzoru v binarnıch spustitelnych souborech 5 / 10
![Page 12: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/12.jpg)
Sjednocenı signatur — YARA pravidla
{
"ExePack ",
"1.4 ",
"by Jon Snow",
0,
0,
"33C08BC0 --68--- C;",
}
rule exe_pack {
meta:
name = "ExePack "
version = "1.4 "
comment = "by Jon Snow"
strings :
$1 = { 33 C0 8B C0 ?? 68 ?? ?C }
condition :
$1 at entrypoint
}
.0001111000011111010110111110000111100101101110000011110
| 1 N 20 D4ED 005C 1 0000 __do_global_dtors
rule do_global_dtors_aux {
meta:
patternSet = "1 N 20 D4ED 005C 1 0000 __do_global_dtors"
strings :
$1 = { ( 0F | 8F ) 0F AD F0 F2 DC 1E }
condition :
$1
}
Detekce vzoru v binarnıch spustitelnych souborech 5 / 10
![Page 13: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/13.jpg)
Sjednocenı signatur — YARA pravidla
{
"ExePack ",
"1.4 ",
"by Jon Snow",
0,
0,
"33C08BC0 --68--- C;",
}
rule exe_pack {
meta:
name = "ExePack "
version = "1.4 "
comment = "by Jon Snow"
strings :
$1 = { 33 C0 8B C0 ?? 68 ?? ?C }
condition :
$1 at entrypoint
}
.0001111000011111010110111110000111100101101110000011110
| 1 N 20 D4ED 005C 1 0000 __do_global_dtors
rule do_global_dtors_aux {
meta:
patternSet = "1 N 20 D4ED 005C 1 0000 __do_global_dtors"
strings :
$1 = { ( 0F | 8F ) 0F AD F0 F2 DC 1E }
condition :
$1
}
Detekce vzoru v binarnıch spustitelnych souborech 5 / 10
![Page 14: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/14.jpg)
Sjednocenı signatur — YARA pravidla
{
"ExePack ",
"1.4 ",
"by Jon Snow",
0,
0,
"33C08BC0 --68--- C;",
}
rule exe_pack {
meta:
name = "ExePack "
version = "1.4 "
comment = "by Jon Snow"
strings :
$1 = { 33 C0 8B C0 ?? 68 ?? ?C }
condition :
$1 at entrypoint
}
.0001111000011111010110111110000111100101101110000011110
| 1 N 20 D4ED 005C 1 0000 __do_global_dtors
rule do_global_dtors_aux {
meta:
patternSet = "1 N 20 D4ED 005 C 1 0000 __do_global_dtors"
strings :
$1 = { ( 0F | 8F ) 0F AD F0 F2 DC 1E }
condition :
$1
}
Detekce vzoru v binarnıch spustitelnych souborech 5 / 10
![Page 15: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/15.jpg)
Sjednocenı signatur — vysledky
detekce prekladace ci packeru
vyssı vyjadrovacı sıla, rozsırenı o 28 novych heuristik
detekce staticky linkovaneho kodu
urychlenı detekce
Detekce vzoru v binarnıch spustitelnych souborech 6 / 10
![Page 16: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/16.jpg)
Sjednocenı signatur — vysledky
detekce prekladace ci packeru
vyssı vyjadrovacı sıla, rozsırenı o 28 novych heuristik
detekce staticky linkovaneho kodu
urychlenı detekce
0
50
100
150
200
250
300
350
400
stacofinl 1.0 stacofinl 2.0
Min
uty
Doba vykonávání
∼ 10 000 testovacıch souboruDetekce vzoru v binarnıch spustitelnych souborech 6 / 10
![Page 17: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/17.jpg)
Detekce dalsıch vzoru
kryptograficke a kompresnı funkce
2368 pravidel
skodlivy kod a zranitelnosti
2181 pravidel
Detekce vzoru v binarnıch spustitelnych souborech 7 / 10
![Page 18: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/18.jpg)
Detekce dalsıch vzoru
kryptograficke a kompresnı funkce
2368 pravidel
skodlivy kod a zranitelnosti
2181 pravidel
rule laudanum {
strings :
$s1 = "public function __activate ()" fullword ascii
$s2 = " register_activation_hook (__FILE__ , array(’
WP_Laudanum ’, ’activate ’))" fullword ascii
condition :
filesize < 5KB and all of them
}
Detekce vzoru v binarnıch spustitelnych souborech 7 / 10
![Page 19: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/19.jpg)
Detekce dalsıch vzoru
kryptograficke a kompresnı funkce
2368 pravidel
skodlivy kod a zranitelnosti
2181 pravidel
rule laudanum {
strings :
$s1 = "public function __activate ()" fullword ascii
$s2 = " register_activation_hook (__FILE__ , array(’
WP_Laudanum ’, ’activate ’))" fullword ascii
condition :
filesize < 5KB and all of them
}
vystup pro uzivatele (text)
informace pro zpetny prekladac (JSON)
Detekce vzoru v binarnıch spustitelnych souborech 7 / 10
![Page 20: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/20.jpg)
Vyuzitı pri zpetnem prekladu
originalnı kodstatic unsigned int crc_32_tab [] = {...};
Detekce vzoru v binarnıch spustitelnych souborech 8 / 10
![Page 21: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/21.jpg)
Vyuzitı pri zpetnem prekladu
originalnı kodstatic unsigned int crc_32_tab [] = {...};
puvodnı resenıint32_t g1 = 0;
Detekce vzoru v binarnıch spustitelnych souborech 8 / 10
![Page 22: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/22.jpg)
Vyuzitı pri zpetnem prekladu
originalnı kodstatic unsigned int crc_32_tab [] = {...};
puvodnı resenıint32_t g1 = 0;
nove resenı{
"endian" : "little",
"matches" : [
{
"address " : 4231264 ,
"entrySize " : 4,
"offset" : 28768,
"size " : 1024,
"type " : "integral "
}
],
"name " : "CRC_32_IEEE_802_3_poly_0x04C11DB7 ",
"type " : "crypto"
}
Detekce vzoru v binarnıch spustitelnych souborech 8 / 10
![Page 23: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/23.jpg)
Vyuzitı pri zpetnem prekladu
originalnı kodstatic unsigned int crc_32_tab [] = {...};
puvodnı resenıint32_t g1 = 0;
nove resenı{
"endian" : "little",
"matches" : [
{
"address " : 4231264 ,
"entrySize " : 4,
"offset" : 28768,
"size " : 1024,
"type " : "integral "
}
],
"name " : "CRC_32_IEEE_802_3_poly_0x04C11DB7 ",
"type " : "crypto"
}
// Detected cryptographic pattern: CRC_32_IEEE_802_3_poly_0x04C11DB7
int32_t CRC_32_IEEE_802_3_poly_0x04C11DB7_at_409060 [256] = {...};
Detekce vzoru v binarnıch spustitelnych souborech 8 / 10
![Page 24: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/24.jpg)
Vyuzitı pri zpetnem prekladu
int32_t __do_global_ctors (void );
int32_t __do_global_dtors (void );
int32_t __main(void );
int32_t __mingw_get_msvcrt_han (int32_t a1)
;
int32_t __mingw_TLScallback (int32_t a1);
...
int32_t function_401560 (char * a1, int32_t
a2) {
int32_t v1 = 4 * a2, v2 = 0x186a0;
int32_t v3 = -1, v4 = (int32_t )a1;
while (true ) {
int32_t v5 = v3, v6 = v4;
if (a2 != 0) {
uint32_t v7 = v3, v8 = v4;
unsigned char v9 = *(char *)v8;
int32_t v10 = *( int32_t *)(4 * ((
int32_t)v9 ^ v7 % 256) + (
int32_t)&g2);
int32_t v11 = v10 ^ v7 / 256;
while (a2 != 1) {
a2 --; v7 = v11 , v8 += 4;
v9 = *(char *)v8;
v10 = *( int32_t *)(4 * ((
int32_t)v9 ^ v7 % 256) +
(int32_t )&g2);
v11 = v10 ^ v7 / 256;
}
...
}
Detekce vzoru v binarnıch spustitelnych souborech 9 / 10
![Page 25: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/25.jpg)
Vyuzitı pri zpetnem prekladu
int32_t __do_global_ctors (void );
int32_t __do_global_dtors (void );
int32_t __main(void );
int32_t __mingw_get_msvcrt_han (int32_t a1)
;
int32_t __mingw_TLScallback (int32_t a1);
...
int32_t function_401560 (char * a1, int32_t
a2) {
int32_t v1 = 4 * a2, v2 = 0x186a0;
int32_t v3 = -1, v4 = (int32_t )a1;
while (true ) {
int32_t v5 = v3, v6 = v4;
if (a2 != 0) {
uint32_t v7 = v3, v8 = v4;
unsigned char v9 = *(char *)v8;
int32_t v10 = *( int32_t *)(4 * ((
int32_t)v9 ^ v7 % 256) + (
int32_t)&g2);
int32_t v11 = v10 ^ v7 / 256;
while (a2 != 1) {
a2 --; v7 = v11 , v8 += 4;
v9 = *(char *)v8;
v10 = *( int32_t *)(4 * ((
int32_t)v9 ^ v7 % 256) +
(int32_t )&g2);
v11 = v10 ^ v7 / 256;
}
...
}
int32_t CRC 32(char * a1 , int32_t a2) {
int32_t v1 = 4 * a2, v2 = 0x186a0;
int32_t v3 = -1, v4 = (int32_t)a1;
while (true ) {
int32_t v5 = v3 , v6 = v4;
if (a2 != 0) {
uint32_t v7 = v3 , v8 = v4;
unsigned char v9 = *(char *)
v8;
int32_t v10 = *( int32_t *)(4
* (( int32_t)v9 ^ v7 %
256) + (int32_t)&
CRC 32 at 409060) ;
int32_t v11 = v10 ^ v7 / 256;
while (a2 != 1) {
a2 --; v7 = v11 , v8 += 4;
v9 = *(char *)v8;
v10 = *( int32_t *)(4 * ((
int32_t )v9 ^ v7 %
256) + (int32_t )&
CRC 32 at 409060);
v11 = v10 ^ v7 / 256;
}
...
}
Detekce vzoru v binarnıch spustitelnych souborech 9 / 10
![Page 26: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/26.jpg)
Zaver
sjednocenı ruznych formatu signatur
jednotna detekce vzoru (YARA)
rozdılna interpretace detekovanych vzoru (metadata)
urychlenı detekce staticky linkovaneho kodu
detekce kryptografickych konstrukcı
detekce skodliveho kodu a zranitelnostı
zvysenı citelnosti vystupnıho kodu
Detekce vzoru v binarnıch spustitelnych souborech 10 / 10
![Page 27: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/27.jpg)
Zaver
sjednocenı ruznych formatu signatur
jednotna detekce vzoru (YARA)
rozdılna interpretace detekovanych vzoru (metadata)
urychlenı detekce staticky linkovaneho kodu
detekce kryptografickych konstrukcı
detekce skodliveho kodu a zranitelnostı
zvysenı citelnosti vystupnıho kodu
https://retdec.com
Detekce vzoru v binarnıch spustitelnych souborech 10 / 10
![Page 28: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/28.jpg)
Otazky oponenta
”V praci popisujete, ze pro detekci skodliveho kodu je nutne nejprve zjistitinformace o pouzitem prekladaci a packeru (coz lze provest naprıklad nazaklade signatur). Co se stane v prıpade, ze se utocnık pokusı tytoinformace podvrhnout za ucelem zmatenı detektoru?“
![Page 29: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/29.jpg)
Otazky oponenta
”V praci popisujete, ze pro detekci skodliveho kodu je nutne nejprve zjistitinformace o pouzitem prekladaci a packeru (coz lze provest naprıklad nazaklade signatur). Co se stane v prıpade, ze se utocnık pokusı tytoinformace podvrhnout za ucelem zmatenı detektoru?“
detekce prekladace ci packeru nenı obecne nutna
nekolik zdroju detekce prekladace ci packeru
signatury
importovane funkce a knihovny
resources
kontrolnı soucty
retezcove literaly, regularnı vyrazy...
vlastnosti sekcı a datovych struktur (ruzne hlavicky a oddıly v souboru)
behavioralnı popis (Cuckoo Sandbox + YARA)
![Page 30: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/30.jpg)
Otazky oponenta
”V zaveru prace se zminujete, ze dosazene vysledky bude mozne vyuzıt imimo rekonfigurovatelny zpetny prekladac (napr. v systemu proautomatickou shlukovou analyzu skodliveho kodu). Pokuste se myslenkupodrobneji priblızit.“
![Page 31: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/31.jpg)
Otazky oponenta
”V zaveru prace se zminujete, ze dosazene vysledky bude mozne vyuzıt imimo rekonfigurovatelny zpetny prekladac (napr. v systemu proautomatickou shlukovou analyzu skodliveho kodu). Pokuste se myslenkupodrobneji priblızit.“
AVG: 150 000 vzorku / den
informace o vstupnım souboru + detekovana YARA pravidla
hashovanı, vytvorenı popisu vzorku
analyza shluku a trıdenı do skupin dle virovych rodin
usnadnuje praci analytiku
![Page 32: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/32.jpg)
Zıskavane informace
souborovy format
architektura, bitova sırka
vstupnı bod
prekladac nebo packer
informace z hlavicek
prıznaky (flags)
typ souboru
endianita
OS, kontrolnı soucet...
sekce, segmenty
symboly
importy, exporty
relokace
dynamicke sekce (ELF)
adresare dat (PE)
resources (PE)
rich header (PE)
informace o PDB (PE)
specificke analyzy (ARM, MIPS)
originalnı jazyk
obsah souboru
CRC32, MD5, SHA-256
![Page 33: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/33.jpg)
Heuristicka detekce prekladace ci packeru
polymorfnı packery
1C 1C 26 08 3E B0 0F 6D FF 6D F5 35 BF C7 C0
74 08 52 55 66 C1 C4 10 5D 5A 51 51 0A C9 59
51 0F B6 C9 77 05 25 FF FF FF FF F8 E2 F3 59
-- -- -- -- -- -- -- -- -- -- -- -- -- -- --
![Page 34: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/34.jpg)
Heuristicka detekce prekladace ci packeru
polymorfnı packery
1C 1C 26 08 3E B0 0F 6D FF 6D F5 35 BF C7 C0
74 08 52 55 66 C1 C4 10 5D 5A 51 51 0A C9 59
51 0F B6 C9 77 05 25 FF FF FF FF F8 E2 F3 59
-- -- -- -- -- -- -- -- -- -- -- -- -- -- --
if( file_format == PE &&
target_architecture == INTEL X86 &&
EP_file_offset >= 0x400 &&
EP_file_offset <= 0x1400 &&
data_directories[1].size == 0x1000 &&
sections[0].name == ".text" &&
sections[1].name == ".data" &&
sections[2].name == ".idata" &&
sections[2].size == 0x200)
{
return "Morphine 1.2";
}
![Page 35: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/35.jpg)
Detekce prekladace ci packeru
![Page 36: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/36.jpg)
Detekce staticky linkovaneho kodu
![Page 37: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/37.jpg)
Detekce dalsıch vzoru
![Page 38: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/38.jpg)
Pouzite nastroje a metodiky
C++
yara
OllyDbg (reverznı inzenyrstvı)
diagram trıd UML
testovanı
jednotkove testy
regresnı testy
srovnavacı testy
vykonnostnı testy
knihovny
ELFIO
PeLib
LLVM
libyara
libdwarf
Portable C++ Hashing Library
TinyXml-2
JsonCpp
Google Test
![Page 39: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/39.jpg)
Ukazka vystupu nastroje fileinfo
Input file : fileName
CRC32 : e7cb47b5
MD5 : 81513 f15b771280ffd0e...
SHA256 : fd3c77fc24415923a9b5...
File format : ELF
File class : 64-bit
File type : Executable file
Architecture : x86 -64
Endianness : Little endian
Entry point address : 0x405d10
Entry point offset : 0x5d10
Entry point section index: 12
Entry point section name : .text
Bytes on entry point : 554889 e541554c...
Detected compiler/packer : GHC (7.6.3)
Original language : Haskell
![Page 40: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/40.jpg)
Ukazka vystupu nastroje fileinfo
i type flags offset vaddr memsize align
-------------------------------------------------------------------------------
i - index
type - type of segment
flags - segment flags
offset - offset in file
vaddr - virtual address in memory
memsize - size in memory
align - alignment in memory and in file
-------------------------------------------------------------------------------
i type flags offset vaddr memsize align
-------------------------------------------------------------------------------
0 PHDR rx 0x00040 0x400040 0x001c0 0x000008
1 INTERP r 0x00200 0x400200 0x00015 0x000001
2 LOADABLE rx 0 0x400000 0xabfcc 0x200000
3 LOADABLE rw 0xac000 0x6ac000 0x15488 0x200000
4 DYNAMIC rw 0xac030 0x6ac030 0x001d0 0x000008
5 NOTE r 0x00218 0x400218 0x00018 0x000004
6 OS -specific r 0xa5898 0x4a5898 0x0138c 0x000004
7 OS -specific rwx 0 0 0 0x000010
-------------------------------------------------------------------------------
Flags:
r - readable
x - executable
w - writable
![Page 41: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/41.jpg)
Ukazka vystupu nastroje fileinfo
i type flags offset vaddr memsize align
-------------------------------------------------------------------------------
i - index
type - type of segment
flags - segment flags
offset - offset in file
vaddr - virtual address in memory
memsize - size in memory
align - alignment in memory and in file
-------------------------------------------------------------------------------
i type flags offset vaddr memsize align
-------------------------------------------------------------------------------
0 PHDR rx 0x00040 0x400040 0x001c0 0x000008
1 INTERP r 0x00200 0x400200 0x00015 0x000001
2 LOADABLE rx 0 0x400000 0xabfcc 0x200000
3 LOADABLE rw 0xac000 0x6ac000 0x15488 0x200000
4 DYNAMIC rw 0xac030 0x6ac030 0x001d0 0x000008
5 NOTE r 0x00218 0x400218 0x00018 0x000004
6 OS -specific r 0xa5898 0x4a5898 0x0138c 0x000004
7 OS -specific rwx 0 0 0 0x000010
-------------------------------------------------------------------------------
Flags :
r - readable
x - executable
w - writable
![Page 42: Detekce vzorů v binárních spustitelných souborech](https://reader033.fdocument.pub/reader033/viewer/2022042509/58a478b01a28aba34c8b66d3/html5/thumbnails/42.jpg)
Ukazka vystupu nastroje stacofin
4016b0 10 0 ___udiv_w_sdiv
4019f0 10 0 ___udiv_w_sdiv
402740 2c 0 ???
405dcd 10 0 ___bid_truncdddf - alternatives:
___bid_fixdddi ___bid_truncddsf ___bid_fixddsi
___bid_extendddxf ___bid_gtdd2 _isinfd64
___bid_nedd2 ___bid_extendsddf
___bid_truncsdsf ___bid_extendsdxf
___bid_unorddd2
40723f 10 0 ___clear_cache
407570 140 0 ___umoddi3
4076b0 110 0 ___udivdi3