forked from elastic/detection-rules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
credman_discovery.py
40 lines (31 loc) · 1.17 KB
/
credman_discovery.py
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
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License
# 2.0; you may not use this file except in compliance with the Elastic License
# 2.0.
from . import common
from . import RtaMetadata
import os
metadata = RtaMetadata(
uuid="d12e0abb-017f-4321-adf2-20843f62b55d",
platforms=["windows"],
endpoint=[
{
"rule_name": "Potential Discovery of Windows Credential Manager Store",
"rule_id": "cc60be0e-2c6c-4dc9-9902-e97103ff8df9",
}
],
siem=[],
techniques=["T1555"],
)
@common.requires_os(metadata.platforms)
def main():
appdata = os.getenv("LOCALAPPDATA")
credmanfile = f"{appdata}\\Microsoft\\Credentials\\a.txt"
powershell = "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
# Execute command
common.execute([powershell, "/c", "echo AAAAAAAAAA >", credmanfile], timeout=10)
common.log("Cat the contents of a sample file in credman folder")
common.execute([powershell, "/c", "cat", credmanfile], timeout=10)
common.remove_file(credmanfile)
if __name__ == "__main__":
exit(main())