• This repository has been archived on 30/Jun/2023
  • Stars
    star
    136
  • Rank 260,037 (Top 6 %)
  • Language
    Python
  • Created over 6 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Detecting Lateral Movement with Machine Learning

DetectLM

Detecting Lateral Movement with Machine Learning.
DetectLM is a proof of concept code to analyze and detect malicious commands executed via cmd.exe with machine learning.

DetectLM Architecture

  • DetectLM.py: Runs on server. Detect malicious Windows command execution using machine learning and blacklist.
  • Invoke-DetectLM.ps1: Runs on client. Sends the logs to the Elasticsearch. Confirm analysis result and display alert message.
  • cmdlogs.bat: Collect commands executed via cmd.exe.

Requirements

Each tools require the following modules:

for Server

for Client

  • PowerShell v3 or later

Supported Client OS

  • Windows 8.1
  • Windows 10

Usage

for Server

  1. Download and install Elasticsearch.
  2. Download and install Kibana.
  3. Start Elasticsearch and Kibana.
  4. Download and save the DetectLM from Github.
git clone https://github.com/JPCERTCC/DetectLM.git
  1. And your Elasticsearch IP Address to DetectLM/server/config/config.ini.
els_server      = localhost
  1. And mapping in Elasticsearch.
$ python DetectLM.py -m
  1. Create cron jobs for DetectLM.py.
    For example
*/15 * * * * python3.6 [Folder Name]/DetectLM.py

for Client

  1. Download client/cmdlogs.bat and client/Invoke-DetectLM.ps1.
  2. Register cmdlogs.bat in the registry entry that starts automatically when the cmd.exe is executed.
> reg add "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v AutoRun /d [Downloaded Folder Name]\cmdlogs.bat

or

> reg add "HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor" /v AutoRun /d [Downloaded Folder Name]\cmdlogs.bat
  1. Create a scheduled task for Invoke-DetectLM.ps1.
> powershell -exec bypass .\Invoke-DetectLM.ps1 -ehost [Elasticsearch Server]

How to Check Log

Executed command logs can be checked from Kibana.
AlertLevel 2 is the malicious commands.

Kibana GUI

AlertLevel

The log has three levels of detection level

  • 2 : Error log reported by user
  • 1 : Logs detected as malicious by machine learning
  • 0 : No Alert (Default)

Ignore Flag

Ignore flag is automatically added to any command executed by the user.
When malicious Windows command execution is detected by machine learning, a notification will be sent to the client.
A user also can set a ignore flag to specific command execution when asked by client tool.

Alert example

Dashboard

Using Kibana dashboard, logs are visualized.
Example of dashboard is in kibana_objects. Import is [Management -> Saved Objects -> Import]

Kibana dashbord

Known Issues

  • This tool supports Windows commands executed via cmd.exe. Any command via PowerShell are not logged nor monitored.
  • Client tool has an issue when handling command line includes "/c" or "/k".

More Repositories

1

LogonTracer

Investigate malicious Windows logon by visualizing and analyzing Windows event log
Python
2,604
star
2

EmoCheck

Emotet detection tool for Windows OS
C++
673
star
3

MalConfScan

Volatility plugin for extracts configuration data of known malware
Python
466
star
4

aa-tools

Artifact analysis tools by JPCERT/CC Analysis Center
Python
448
star
5

SysmonSearch

Investigate suspicious activity by visualizing Sysmon's event log
JavaScript
409
star
6

ToolAnalysisResultSheet

Tool Analysis Result Sheet
HTML
337
star
7

YAMA

Yet Another Memory Analyzer for malware detection
C++
161
star
8

phishurl-list

Phishing URL dataset from JPCERT/CC
HTML
133
star
9

MalConfScan-with-Cuckoo

Cuckoo Sandbox plugin for extracts configuration data of known malware
Python
129
star
10

jpcert-yara

JPCERT/CC public YARA rules repository
YARA
93
star
11

log-analysis-training

γƒ­γ‚°εˆ†ζžγƒˆγƒ¬γƒΌγƒ‹γƒ³γ‚°η”¨γ‚³γƒ³γƒ†γƒ³γƒ„
HTML
86
star
12

impfuzzy

Fuzzy Hash calculated from import API of PE files
Python
82
star
13

MemoryForensic-on-Cloud

Memory Forensic System on Cloud
HTML
82
star
14

Windows-Symbol-Tables

Windows symbol tables for Volatility 3
Python
61
star
15

cordova

Vulnerability Analysis of Hybrid Applications using Apache Cordova
HTML
55
star
16

OWASPdocuments

Japanese translation of OWASP documents
HTML
53
star
17

Lazarus-research

Lazarus analysis tools and research report
Python
52
star
18

STrelok

Application for STIX v2.0 objects management and analysis
Python
27
star
19

CobaltStrike-Config

Repository for archiving Cobalt Strike configuration
26
star
20

QuasarRAT-Analysis

QuasarRAT analysis tools and research report
Python
23
star
21

Lucky-Visitor-Scam-IoC

Automatically update IoC for lucky visitor scam
23
star
22

SurfaceAnalysis-on-Cloud

Surface Analysis System on Cloud
HCL
18
star
23

ToolAnalysisResultSheet_jp

εˆ†ζžγƒ„γƒΌγƒ«η΅ζžœγ‚·γƒΌγƒˆ
HTML
17
star
24

AutoYara4FLIRT

Python
14
star
25

cwe-1003-ja

CWE-1003 ζ—₯本θͺžθ¨³
10
star
26

vdo-json-schema

JSON Schema for Vulnerability Description Ontology (VDO)
JavaScript
8
star
27

JPCERT-IR-Statistics

JPCERT/CC Incident handling statistics
HTML
6
star
28

HUILoader-research

HUI Loader analysis research
4
star
29

xml2evtx

Convert Event Log XML to EVTX file
Python
2
star