-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathacropalypse_detection.yar
43 lines (38 loc) · 1.17 KB
/
acropalypse_detection.yar
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
rule acropalypse_png
{
meta:
description = "Detects the PNG files probably affected by acropalypse"
author = "Octavio Gianatiempo ([email protected])"
strings:
$a = "IEND"
condition:
// PNG magic
uint32be(0) == 0x89504E47 and
uint32be(4) == 0x0D0A1A0A and
// valid IEND chunk at the end of the file
uint32be(filesize-12) == 0x0 and
uint32be(filesize-8) == 0x49454E44 and
uint32be(filesize-4) == 0xAE426082 and
// At least two valid IEND chunks
for 2 i in (1..#a) : (
uint32be(@a[i]-4) == 0x0 and
uint32be(@a[i]+4) == 0xAE426082
)
}
rule acropalypse_jpeg
{
meta:
description = "Detects the jpeg files probably affected by acropalypse"
author = "Octavio Gianatiempo ([email protected])"
strings:
$a = {FF D9}
condition:
// JPEG SOI and APP0
uint16be(0) == 0xFFD8 and
uint16be(2) == 0xFFE0 and
uint32be(6) == 0x4A464946 and
// EOI marker at the end of the file
uint16be(filesize-2) == 0xFFD9 and
// At least two valid EOI markers
#a >= 2
}