Modern C++ decompilers effectively detect program flow structures (function calls, loops, statements) but struggle with variable type recognition, especially complex types like structs and classes. The prevalence of objects in modern C++ hinders decompiled code readability. Existing library object identification solutions rely on information possibly lost during optimization. BOBI, the only tool identifying stack allocated objects via memory access tracking and method "fingerprints" comparison, is more resilient to optimization but suffers from high false positives, limiting its reliability and adoption potential. This thesis addresses BOBI limitations by developing a new and enhanced static analysis tool, built on top of the VEX intermediate representation. This tool can search for objects also in the heap and BSS sections, supports more optimization levels, and finds objects nested within complex classes. To mitigate the low precision problem, we also track the data type of memory accesses and propose a new methods fingerprinting strategy. We focus on binary operations between different members of the same object. If two memory words are used in the same operation, this semantic information highlights a logical connection and is not based solely on value positions in memory. Concurrently, we developed a new pipeline for building a reference dataset. We used GitHub APIs to find 34,097 relevant projects and a combination of gdb, objdump and DWARF info to extract the ground truth. Our tool outperforms BOBI, producing the 208% of the true positives and decreasing the number of false positives by 43%. Additionally, we increased the number of classes tested, demonstrating the adaptability of our solution.
I moderni decompilatori di C++ interpretano adeguatamente il flusso del programma (chiamate a funzione, cicli e istruzioni) ma faticano a riconoscere i tipi delle variabili, specialmente tipi complessi come strutture e classi. L'ampio uso di oggetti nel C++ moderno, penalizza il codice decompilato. Le soluzioni già esistenti per identificare oggetti di libreria conosciuti si affidano ad informazioni che l'ottimizzazione potrebbe rimuovere. Il framework BOBI, l'unico strumento che tenta di identificare oggetti allocati sullo stack tramite il tracciamento degli accessi in memoria e comparando le "impronte" dei metodi, è più resiliente alle ottimizzazioni ma produce troppi falsi positivi, limitando la sua affidabilità e potenzialità di addozione. Questa tesi tratta di come si potrebbero superare le limitazioni di BOBI, sviluppando uno strumento di analisi statica nuovo e migliorato, basato sulla rappresentazione intermedia VEX. Questo strumento può cercare oggetti anche nelle sezioni heap e BSS, supporta più livelli di ottimizzazione, e trova oggetti annidati dentro a classi più complesse. Per mitigare il problema della bassa precisione, tracciamo anche il tipo di dato degli accessi in memoria e proponiamo una nuova strategia per le impronte dei metodi. Ci concentriamo sulle operazioni binarie tra membri dello stesso oggetto. Se due parole di memoria sono usate nella stessa operazione, questa informazione semantica evidenzia una connessione logica, la quale non è basata solamente sulla posizione dei valori in memoria. Allo stesso tempo, abbiamo sviluppato un nuovo procedimento per costruire il dataset di riferimento. Abbiamo utilizzato le API di GitHub per trovare 34,097 progetti rilevanti e una combinazione di gdb, objdump e informazioni DWARF per estrarre la verità di riferimento. Il nostro strumento sorpassa BOBI, producendo il 208% dei veri positivi e riducendo il numero di falsi positivi del 43%. In aggiunta, abbiamo aumentato il numero di classi testate, dimostrando l'adattabilità della nostra soluzione.
Automatic type recognition of C++ library objects in optimized binaries
MONTANARI, TOMMASO
2023/2024
Abstract
Modern C++ decompilers effectively detect program flow structures (function calls, loops, statements) but struggle with variable type recognition, especially complex types like structs and classes. The prevalence of objects in modern C++ hinders decompiled code readability. Existing library object identification solutions rely on information possibly lost during optimization. BOBI, the only tool identifying stack allocated objects via memory access tracking and method "fingerprints" comparison, is more resilient to optimization but suffers from high false positives, limiting its reliability and adoption potential. This thesis addresses BOBI limitations by developing a new and enhanced static analysis tool, built on top of the VEX intermediate representation. This tool can search for objects also in the heap and BSS sections, supports more optimization levels, and finds objects nested within complex classes. To mitigate the low precision problem, we also track the data type of memory accesses and propose a new methods fingerprinting strategy. We focus on binary operations between different members of the same object. If two memory words are used in the same operation, this semantic information highlights a logical connection and is not based solely on value positions in memory. Concurrently, we developed a new pipeline for building a reference dataset. We used GitHub APIs to find 34,097 relevant projects and a combination of gdb, objdump and DWARF info to extract the ground truth. Our tool outperforms BOBI, producing the 208% of the true positives and decreasing the number of false positives by 43%. Additionally, we increased the number of classes tested, demonstrating the adaptability of our solution.File | Dimensione | Formato | |
---|---|---|---|
Thesis_Automatic_Type_Recognition.pdf
accessibile in internet per tutti
Dimensione
1.85 MB
Formato
Adobe PDF
|
1.85 MB | Adobe PDF | Visualizza/Apri |
Executive_Summary_Automatic_Type_Recognition.pdf
accessibile in internet per tutti
Dimensione
423.84 kB
Formato
Adobe PDF
|
423.84 kB | Adobe PDF | Visualizza/Apri |
I documenti in POLITesi sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.
https://hdl.handle.net/10589/235877