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
/*
This Yara ruleset is under the GNU-GPLv2 license (http://www.gnu.org/licenses/gpl-2.0.html) and open to any user or organization, as long as you use it under this license.
*/
rule apt_RU_MoonlightMaze_customlokitools {
meta:
author = "Kaspersky Lab"
date = "2017-03-15"
version = "1.1"
last_modified = "2017-03-22"
reference = "https://en.wikipedia.org/wiki/Moonlight_Maze"
description = "Rule to detect Moonlight Maze Loki samples by custom attacker-authored strings"
hash = "14cce7e641d308c3a177a8abb5457019"
hash = "a3164d2bbc45fb1eef5fde7eb8b245ea"
hash = "dabee9a7ea0ddaf900ef1e3e166ffe8a"
hash = "1980958afffb6a9d5a6c73fc1e2795c2"
hash = "e59f92aadb6505f29a9f368ab803082e"
strings:
$a1="Write file Ok..." ascii wide
$a2="ERROR: Can not open socket...." ascii wide
$a3="Error in parametrs:" ascii wide
$a4="Usage: @<get/put> <IP> <PORT> <file>" ascii wide
$a5="ERROR: Not connect..." ascii wide
$a6="Connect successful...." ascii wide
$a7="clnt <%d> rqstd n ll kll" ascii wide
$a8="clnt <%d> rqstd swap" ascii wide
$a9="cld nt sgnl prcs grp" ascii wide
$a10="cld nt sgnl prnt" ascii wide
//keeping only ascii version of string ->
$a11="ork error" ascii fullword
condition:
((any of ($a*)))
}
rule apt_RU_MoonlightMaze_customsniffer {
meta:
author = "Kaspersky Lab"
date = "2017-03-15"
version = "1.1"
reference = "https://en.wikipedia.org/wiki/Moonlight_Maze"
description = "Rule to detect Moonlight Maze sniffer tools"
hash = "7b86f40e861705d59f5206c482e1f2a5"
hash = "927426b558888ad680829bd34b0ad0e7"
original_filename = "ora;tdn"
strings:
//strings from ora ->
$a1="/var/tmp/gogo" fullword
$a2="myfilename= |%s|" fullword
$a3="mypid,mygid=" fullword
$a4="mypid=|%d| mygid=|%d|" fullword
//strings from tdn ->
$a5="/var/tmp/task" fullword
$a6="mydevname= |%s|" fullword
condition:
((any of ($a*)))
}
rule loki2crypto {
meta:
author = "Costin Raiu, Kaspersky Lab"
date = "2017-03-21"
version = "1.0"
description = "Rule to detect hardcoded DH modulus used in 1996/1997 Loki2 sourcecode; #ifdef STRONG_CRYPTO /* 384-bit strong prime */"
reference = "https://en.wikipedia.org/wiki/Moonlight_Maze"
hash = "19fbd8cbfb12482e8020a887d6427315"
hash = "ea06b213d5924de65407e8931b1e4326"
hash = "14ecd5e6fc8e501037b54ca263896a11"
hash = "e079ec947d3d4dacb21e993b760a65dc"
hash = "edf900cebb70c6d1fcab0234062bfc28"
strings:
$modulus={DA E1 01 CD D8 C9 70 AF C2 E4 F2 7A 41 8B 43 39 52 9B 4B 4D E5 85 F8 49}
condition:
(any of them)
}
rule apt_RU_MoonlightMaze_de_tool {
meta:
author = "Kaspersky Lab"
date = "2017-03-27"
version = "1.0"
last_modified = "2017-03-27"
reference = "https://en.wikipedia.org/wiki/Moonlight_Maze"
description = "Rule to detect Moonlight Maze 'de' and 'deg' tunnel tool"
hash = "4bc7ed168fb78f0dc688ee2be20c9703"
hash = "8b56e8552a74133da4bc5939b5f74243"
strings:
$a1="Vnuk: %d" ascii fullword
$a2="Syn: %d" ascii fullword
//%s\r%s\r%s\r%s\r ->
$a3={25 73 0A 25 73 0A 25 73 0A 25 73 0A}
condition:
((2 of ($a*)))
}
rule apt_RU_MoonlightMaze_cle_tool {
meta:
author = "Kaspersky Lab"
date = "2017-03-27"
version = "1.0"
last_modified = "2017-03-27"
reference = "https://en.wikipedia.org/wiki/Moonlight_Maze"
description = "Rule to detect Moonlight Maze 'cle' log cleaning tool"
hash = "647d7b711f7b4434145ea30d0ef207b0"
strings:
$a1="./a filename template_file" ascii wide
$a2="May be %s is empty?" ascii wide
$a3="template string = |%s|" ascii wide
$a4="No blocks !!!"
$a5="No data in this block !!!!!!" ascii wide
$a6="No good line"
condition:
((3 of ($a*)))
}
rule apt_RU_MoonlightMaze_xk_keylogger {
meta:
author = "Kaspersky Lab"
date = "2017-03-27"
version = "1.0"
last_modified = "2017-03-27"
reference = "https://en.wikipedia.org/wiki/Moonlight_Maze"
description = "Rule to detect Moonlight Maze 'xk' keylogger"
strings:
$a1="Log ended at => %s"
$a2="Log started at => %s [pid %d]"
$a3="/var/tmp/task" fullword
$a4="/var/tmp/taskhost" fullword
$a5="my hostname: %s"
$a6="/var/tmp/tasklog"
$a7="/var/tmp/.Xtmp01" fullword
$a8="myfilename=-%s-"
$a9="/var/tmp/taskpid"
$a10="mypid=-%d-" fullword
$a11="/var/tmp/taskgid" fullword
$a12="mygid=-%d-" fullword
condition:
((3 of ($a*)))
}
rule apt_RU_MoonlightMaze_encrypted_keylog {
meta:
author = "Kaspersky Lab"
date = "2017-03-27"
version = "1.0"
last_modified = "2017-03-27"
reference = "https://en.wikipedia.org/wiki/Moonlight_Maze"
description = "Rule to detect Moonlight Maze encrypted keylogger logs"
strings:
$a1={47 01 22 2A 6D 3E 39 2C}
condition:
($a1 at 0)
}
rule apt_RU_MoonlightMaze_IRIX_exploit_GEN {
meta:
author = "Kaspersky Lab"
date = "2017-03-27"
version = "1.0"
last_modified = "2017-03-27"
reference = "https://en.wikipedia.org/wiki/Moonlight_Maze"
description = "Rule to detect Irix exploits from David Hedley used by Moonlight Maze hackers"
reference2 = "https://www.exploit-db.com/exploits/19274/"
hash = "008ea82f31f585622353bd47fa1d84be" //df3
hash = "a26bad2b79075f454c83203fa00ed50c" //log
hash = "f67fc6e90f05ba13f207c7fdaa8c2cab" //xconsole
hash = "5937db3896cdd8b0beb3df44e509e136" //xlock
hash = "f4ed5170dcea7e5ba62537d84392b280" //xterm
strings:
$a1="stack = 0x%x, targ_addr = 0x%x"
$a2="execl failed"
condition:
(uint32(0)==0x464c457f) and (all of them)
}
rule apt_RU_MoonlightMaze_u_logcleaner {
meta:
author = "Kaspersky Lab"
date = "2017-03-27"
version = "1.0"
last_modified = "2017-03-27"
reference = "https://en.wikipedia.org/wiki/Moonlight_Maze"
description = "Rule to detect log cleaners based on utclean.c"
reference2 = "http://cd.textfiles.com/cuteskunk/Unix-Hacking-Exploits/utclean.c"
hash = "d98796dcda1443a37b124dbdc041fe3b"
hash = "73a518f0a73ab77033121d4191172820"
strings:
$a1="Hiding complit...n"
$a2="usage: %s <username> <fixthings> [hostname]"
$a3="ls -la %s* ; /bin/cp ./wtmp.tmp %s; rm ./wtmp.tmp"
condition:
(uint32(0)==0x464c457f) and (any of them)
}
rule apt_RU_MoonlightMaze_wipe {
meta:
author = "Kaspersky Lab"
date = "2017-03-27"
version = "1.0"
last_modified = "2017-03-27"
reference = "https://en.wikipedia.org/wiki/Moonlight_Maze"
description = "Rule to detect log cleaner based on wipe.c"
reference2 = "http://www.afn.org/~afn28925/wipe.c"
hash = "e69efc504934551c6a77b525d5343241"
strings:
$a1="ERROR: Unlinking tmp WTMP file."
$a2="USAGE: wipe [ u|w|l|a ] ...options..."
$a3="Erase acct entries on tty : wipe a [username] [tty]"
$a4="Alter lastlog entry : wipe l [username] [tty] [time] [host]"
condition:
(uint32(0)==0x464c457f) and (2 of them)
}