Skip to content

Commit c349eab

Browse files
committed
Risolti alcuni problemi con le euristiche sul campo Characteristics,
aggiunta descrizione in inglese, risolto typo in Italiano, aggiunti i certificati di Root Microsoft
1 parent dcd8c4e commit c349eab

26 files changed

Lines changed: 277 additions & 74 deletions

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
# Output of the go coverage tool, specifically when used with LiteIDE
1212
*.out
13-
13+
.DS_store
1414
# Dependency directories (remove the comment below to include it)
1515
# vendor/
1616
data/

CHANGELOG

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Versione 0.0.3-alpha:
2+
- Migliorata euristica sulle flag delle sezioni
3+
- Risolto problema con offset delle risorse, se presenti in sezioni diverse
4+
- Aggiunta stampa sulle flag delle sezioni
5+
- Risolto problema sulla verifica della trust chain per la sezione Security
6+
- Aggiunti certificati di root Microsoft (2010 e 2017)
7+
18
Versione 0.0.2-alpha:
29
- Risolti fix
310
- Aggiunte euristiche sul nome della sezione

README.en.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
![MicroSCOPE logo](https://github.com/seekbytes/MicroSCOPE/blob/main/utils/MicroSCOPE.jpg?raw=true)
2+
3+
## Project Goal
4+
5+
MicroSCOPE is a software program developed through the [Go](https://go.dev) programming language that allows for the detection of a precise category of malicious software. The program is designed specifically for a class of malicious programs called _ransomware_ whose operation consists of data encryption and ransom demand in order to gain access to the content again.
6+
7+
In particular, MicroSCOPE was developed to be able to support two of the mainly used formats: the PE (_Portable Executable_) format for Windows platforms and ELF (_Executable and Linking Format_) for Unix-based platforms. Through the application of certain heuristics, MicroSCOPE is able to assign a score that corresponds to the level of dangerousness of the file being analyzed. The higher the score, the more similar characteristics the software will exhibit to ransomware that has already been studied. The heuristics have been extrapolated from numerous case studies and will be improved over time.
8+
9+
## Repository Structure
10+
* `analysis`: folder related to the static analysis of the binaries (including the various phases of MicroSCOPE)
11+
* `docs`: folder containing documentation of the MicroSCOPE project.
12+
* `formats`: folder related to the binary file formats (ELF and PE) including constants, checks and parsing of the binary;
13+
* `heuristics`: the actual heuristics.
14+
* `utils`: general utilities
15+
16+
## How it works
17+
18+
The analysis performed by MicroSCOPE has three main steps:
19+
* **data mining**: in-depth analysis of the binary file based on its extension type (for example: whether PE or ELF file), extrapolating strings, functions it uses and any other information potentially useful for predicting program execution;
20+
* **application of heuristics**: based on the information extrapolated from the first stage, heuristics are applied to figure out how the program will behave when executed. At this stage, a score (summation of the various scores of the heuristics) is calculated;
21+
* **outcome determination**: based on the score and above a certain value (called threshold value - user-defined), MicroSCOPE will associate a certain score with malicious behavior;
22+
23+
## How to use it
24+
25+
Download the [latest release](https://github.com/seekbytes/MicroSCOPE/releases) and then run it with the flag `-f` to specify the input file (must be a valid PE or ELF executable).
26+
27+
```
28+
./microscope -f my_executable_ransomware
29+
```

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Scopo del progetto
44

5-
MicroSCOPE è un software sviluppato tramite il linguaggio di programmazione [Go](https://go.dev) che permette di inidividuare una precisa categoria di software dannoso. Il programma è stato studiato specificamente per una classe di programmi dannosi chiamata _ransomware_ il cui funzionamento consiste nella crittazione dei dati e richiesta di riscatto per poter riaccedere al contenuto.
5+
MicroSCOPE è un software sviluppato tramite il linguaggio di programmazione [Go](https://go.dev) che permette di individuare una precisa categoria di software dannoso. Il programma è stato studiato specificamente per una classe di programmi dannosi chiamata _ransomware_ il cui funzionamento consiste nella crittazione dei dati e richiesta di riscatto per poter riaccedere al contenuto.
66

77
In particolare, MicroSCOPE è stato sviluppato per poter supportare due tra i formati principalmente utilizzati: il formato PE (_Portable Executable_) per piattaforme Windows ed ELF (_Executable and Linking Format_) per piattaforme Unix-based. Tramite l'applicazione di alcune euristiche, MicroSCOPE è in grado di attribuire un punteggio che corrisponde al livello di pericolosità del file che si vuole analizzare. Tanto più alto è il punteggio, tanto più il software presenterà caratteristiche simili a ransomware già studiati. Le euristiche sono state estrapolate da numerosi casi di studio e verranno migliorate nel corso del tempo.
88

@@ -20,3 +20,13 @@ L'analisi effettuata da MicroSCOPE ha tre fasi principali:
2020
* **data mining**: analisi approfondita del file binario in base al tipo di estensione (ad esempio: se file PE o ELF), estrapolando stringhe, funzioni che utilizza e qualsiasi altra informazione potenzialmente utile per prevedere l'esecuzione del programma;
2121
* **applicazione delle euristiche**: in base alle informazioni estrapolate dalla prima fase, si applicano le euristiche che consentono di capire che comportamento avrà il programma una volta eseguito. In questa fase viene calcolato un punteggio (sommatoria dei vari punteggi delle euristiche);
2222
* **determinazione del risultato**: in base al punteggio e sopra un certo valore (chiamato valore di threshold - definito dall'utente), MicroSCOPE assocerà un certo punteggio a un comportamento malevolo;
23+
24+
## Come utilizzarlo
25+
26+
Scarica l'[ultima release](https://github.com/seekbytes/MicroSCOPE/releases) e avvialo con la flag `-f` per specificare il file di input (nota: deve essere un file PE o un file ELF).
27+
28+
```
29+
./microscope -f my_executable_ransomware
30+
```
31+
32+
Verrà così generato un nuovo report HTML all'interno di una cartella chiamata `results` (creata all'interno della working directory).

analysis/analysis.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func PrintResult(Analyzed *formats.FileAnalyzed) {
3636
"PEprintResource": pe.PrintResource,
3737
"PEprintSubsystem": pe.PrintSubsystem,
3838
"PEprintMajorOperatingVersion": pe.PrintMajorOperatingSystemVersion,
39+
"PEprintSectionFlags": pe.PrintSectionFlags,
3940
"PEprintCharacteristics": pe.PrintCharacteristic,
4041
"ELFprintMachine": elf.PrintMachine,
4142
"ELFprintSectionType": elf.PrintSectionType,

formats/analysis.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ type FileAnalyzed struct {
1414
ExtractedStrings []string // Stringhe estratte
1515
Anomalies []Anomaly // Anomalie
1616
Hash string // Hash 256
17-
OutputFormat string // Formato del file di output dell'analisi
17+
OutputFormat string // Formato del file prodotto dall'analisi
1818
PEInterface pe.PEBINARY // Puntatore al PEbinary se il formato è PE
1919
ELFInterface elf.ELFBINARY // Puntatore all'elfbinary se il formato è ELF
20+
Instructions []string // Istruzioni
2021
Threshold int // Threshold
2122
Raw []byte
2223
}

formats/elf/sections.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ func parseSections32(endianness binary.ByteOrder, shnum uint16, table uint16) []
101101
fmt.Println(err.Error())
102102
}
103103
buffer := make([]byte, headers[i].Size)
104-
binary.Read(reader, endianness, &buffer)
104+
err = binary.Read(reader, endianness, &buffer)
105+
if err != nil {
106+
fmt.Println("errore durante la lettura della sezione ")
107+
}
105108
tmp.Raw = buffer
106109
tmp.Entropy = utils.CalculateEntropy(tmp.Raw)
107110
} else {

formats/pe/apiset.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func readApiSet() {
5353
// Sposta l'offset
5454
_, err = readerApiSet.Seek(int64(int(header.NamesOffset)+binary.Size(ApiSetNameEntry{})*i), io.SeekStart)
5555
if err != nil {
56-
fmt.Println("Impossibile spostare il seek.")
56+
fmt.Println("Impossibile spostare il seek " + err.Error())
5757
return
5858
}
5959

@@ -70,7 +70,7 @@ func readApiSet() {
7070
for i := 0; i < int(tmp.NumberOfHosts); i++ {
7171
_, err = readerApiSet.Seek(int64(tmp.HostOffset)+int64(i*(binary.Size(ApiSetValueEntry{}))), io.SeekStart)
7272
if err != nil {
73-
fmt.Println("Impossibile effettuare il seek")
73+
fmt.Println("Impossibile effettuare il seek" + err.Error())
7474
return
7575
}
7676
var tmpEntry ApiSetValueEntry

formats/pe/exports.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func readExports(virtualAddress uint32) {
4545

4646
fileAnalyzed.ExportNameMap = make(map[string]*Export)
4747
fileAnalyzed.ExportOrdinalMap = make(map[int]*Export)
48-
fmt.Printf("%d \n", exportDirectory.NumberOfName)
48+
4949
// Per ogni entry della tabella degli exports
5050
for i := 0; i < int(exportDirectory.NumberOfName); i++ {
5151

formats/pe/imports.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ func readImports(is64bit bool, virtualAddress uint32) {
119119

120120
}
121121

122-
importElement := &ImportInfo{DllName: dllName, APICalled: funcName, Offset: tableOffset}
123-
122+
importElement := &ImportInfo{DllName: dllName, APICalled: funcName, Offset: tableOffset, Thunk: thunk1}
124123
fileAnalyzed.Imports = append(fileAnalyzed.Imports, importElement)
125124

126125
// Continua il ciclo aggiungendo il padding

0 commit comments

Comments
 (0)