The increasing number of malicious software released every day and the necessity to protect a considerable number of critical systems from these threats lead to the creation of newer malware detection and analysis tools. This thesis presents a memory monitoring technique that can monitor operating system operations or detect malicious software. This work uses hardware-handled data structures and functionalities paired with kernel-level basic functions. We want to implement a memory monitoring system that prevents us from checking the entire memory continuously and prevents checking twice already checked memory areas. To provide this functionality, we work with page table entries and with page fault handling. To be concise, we avoid an uncontrolled allocation of memory pages with executable and writable permissions. All accesses to a page with executable permission, writable permission, or both are intercepted and managed by our monitoring system. To implement the monitoring part, we exploit the page fault handler. Basically, we do not provide the correct permission to a memory page: a page fault begins when the CPU accesses this page. We use the page fault handler as a notification that provides us with the faulty address and its content. We can monitor kernel and user-level applications using this system without running the target system on a virtualised environment or using an external hardware component. We performed kernel and user-level tests to understand the overhead we get using our monitoring system. From the tests, we obtained that the impact of our monitoring system is negligible compared with the performance when this monitoring system is disabled. We observed that the CPU clock cycle needed for accessing a page in execution mode for the first time is twelve times slower than in the original system. Accessing in write mode, we are two times slower. Overall this overhead is all due to the first access. All subsequent accesses cost almost the same in case our monitoring system is enabled and if it is disabled. In this way, we spread the cost of the first access over subsequent accesses, resulting in an overhead of only four times if we run a whole page and only once if we write an entire page.
Il numero crescente di software dannoso rilasciato ogni giorno e la necessità di proteggere un numero considerevole di sistemi critici da queste minacce, hanno portato alla creazione di nuovi strumenti di rilevamento e analisi dei malware. Questa tesi presenta una tecnica di monitoraggio della memoria che può essere utilizzata anche per monitorare le azioni del sistema operativo o per rilevare un potenziale software dannoso. Utilizziamo una combinazione di strutture dati e funzionalità gestite dall’hardware abbinate a funzioni del kernel. Vogliamo implementare un sistema di monitoraggio della memoria che eviti di controllare continuamente l’intera memoria e ci eviti di controllare due volte aree di memoria già controllate. Per fare questo, usiamo le tabelle di paginazione e la gestione delle eccezioni. Evitiamo l’allocazione di pagine di memoria con permessi di esecuzione e scrittura, senza che queste siano prima controllate. Tutti gli accessi a una pagina con permessi eseguibili, scrivibili o entrambi, vengono intercettati e gestiti dal nostro sistema di monitoraggio. Per implementare la parte di monitoraggio, sfruttiamo il gestore delle eccezioni. In pratica, non forniamo il permesso corretto a una pagina di memoria quando viene creata. Quando la CPU accede a questa pagina, si verifica un page fault. Utilizziamo il page fault come una notifica che ci fornisce l’indirizzo dell’errore e di conseguenza il suo contenuto. Con questo sistema possiamo monitorare le applicazioni a livello di kernel e di utente senza eseguire il sistema monitorato in un ambiente virtualizzato o utilizzare un componente hardware esterno. Abbiamo eseguito test a livello di kernel e di utente per verificare il corretto funzionamento del sistema quando è monitorato e per calcolare l’impatto sulle prestazioni. Accedendo per la prima volta in esecuzione ad una pagina, siamo dodici volte piu lenti rispetto al sistema non monitorato. Accedendo la prima volta in scrittura, siamo solo due volte piu lenti. Questo costo viene spalmato sui successivi accessi. Dunque, siamo solo quattro volte più lenti se eseguiamo un’intera pagina. Scrivendo un’intera pagina, siamo una sola volta piu lenti.
MPT-Mon : a memory monitoring technique based on page tables supervision
Ciaccia, Giuseppe
2021/2022
Abstract
The increasing number of malicious software released every day and the necessity to protect a considerable number of critical systems from these threats lead to the creation of newer malware detection and analysis tools. This thesis presents a memory monitoring technique that can monitor operating system operations or detect malicious software. This work uses hardware-handled data structures and functionalities paired with kernel-level basic functions. We want to implement a memory monitoring system that prevents us from checking the entire memory continuously and prevents checking twice already checked memory areas. To provide this functionality, we work with page table entries and with page fault handling. To be concise, we avoid an uncontrolled allocation of memory pages with executable and writable permissions. All accesses to a page with executable permission, writable permission, or both are intercepted and managed by our monitoring system. To implement the monitoring part, we exploit the page fault handler. Basically, we do not provide the correct permission to a memory page: a page fault begins when the CPU accesses this page. We use the page fault handler as a notification that provides us with the faulty address and its content. We can monitor kernel and user-level applications using this system without running the target system on a virtualised environment or using an external hardware component. We performed kernel and user-level tests to understand the overhead we get using our monitoring system. From the tests, we obtained that the impact of our monitoring system is negligible compared with the performance when this monitoring system is disabled. We observed that the CPU clock cycle needed for accessing a page in execution mode for the first time is twelve times slower than in the original system. Accessing in write mode, we are two times slower. Overall this overhead is all due to the first access. All subsequent accesses cost almost the same in case our monitoring system is enabled and if it is disabled. In this way, we spread the cost of the first access over subsequent accesses, resulting in an overhead of only four times if we run a whole page and only once if we write an entire page.File | Dimensione | Formato | |
---|---|---|---|
2022_07_Ciaccia.pdf
accessibile in internet solo dagli utenti autorizzati
Descrizione: Tesi
Dimensione
1.15 MB
Formato
Adobe PDF
|
1.15 MB | Adobe PDF | Visualizza/Apri |
2022_07_Ciaccia_Executive_Summary.pdf
accessibile in internet solo dagli utenti autorizzati
Descrizione: Executive Summary
Dimensione
382.75 kB
Formato
Adobe PDF
|
382.75 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/190367