The use of Open Source Software is becoming more and more popular, but it comes with the risk of importing vulnerabilities in private codebases. Security patches, providing fixes to detected vulnerabilities, are vital in protecting against cyber attacks, therefore being able to apply all the security patches as soon as they are released is key. Even though there is a public database for vulnerability fixes the majority of them remain undisclosed to the public, therefore we propose a Machine Learning algorithm using NLP to detect security patches in Java Open Source Software. To train the model we preprocessed and extract patches from the commits present in two databases provided by Debricked and a public one released by Ponta et al. Two experiments were conducted, one performing binary classification and the other trying to have higher granularity in classifying the macro-type of vulnerability. The proposed models leverage the structure of the input to have a better patch representation and they are based on RNNs, Transformers and CodeBERT, with the best performing model being the Transformer that surprisingly outperformed CodeBERT. The results show that it is possible to classify security patches but using more relevant pre-training techniques or tree-based representation of the code might improve the performance.
L'uso di Software Open Source sta diventando sempre più popolare, ma comporta il rischio di importare vulnerabilità nei progetti privati. Le patch di sicurezza, che forniscono correzioni alle vulnerabilità rilevate, sono fondamentali per proteggersi dagli attacchi informatici, quindi è fondamentale essere in grado di applicare tutte le patch di sicurezza non appena vengono rilasciate. Anche se esiste un database pubblico per le correzioni delle vulnerabilità, la maggior parte di esse non viene divulgata al pubblico, pertanto proponiamo un algoritmo di Machine Learning che utilizza NLP per rilevare le patch di sicurezza nel software Open Source scritto in java. Per allenare il modello abbiamo preprocessato ed estratto le patch dalle commit presenti in due database forniti da Debricked e da uno pubblico rilasciato da Ponta et al. Sono stati condotti due esperimenti, uno che esegue una classificazione binaria e l'altro che cerca di avere una granularità maggiore classificando il macrotipo di vulnerabilità. I modelli proposti sfruttano la struttura dell'input per avere una migliore rappresentazione della patch e sono basati su RNN, Transformer e CodeBERT, con il modello più performante che è il Transformer che sorprendentemente supera CodeBERT. I risultati dimostrano che è possibile classificare le patch di sicurezza, ma l'utilizzo di tecniche di pre-allenamento più pertinenti o di una rappresentazione del codice basata su alberi potrebbe migliorare le prestazioni.
Detecting security patches in Java OSS projects using NLP
Stefanoni, Andrea
2021/2022
Abstract
The use of Open Source Software is becoming more and more popular, but it comes with the risk of importing vulnerabilities in private codebases. Security patches, providing fixes to detected vulnerabilities, are vital in protecting against cyber attacks, therefore being able to apply all the security patches as soon as they are released is key. Even though there is a public database for vulnerability fixes the majority of them remain undisclosed to the public, therefore we propose a Machine Learning algorithm using NLP to detect security patches in Java Open Source Software. To train the model we preprocessed and extract patches from the commits present in two databases provided by Debricked and a public one released by Ponta et al. Two experiments were conducted, one performing binary classification and the other trying to have higher granularity in classifying the macro-type of vulnerability. The proposed models leverage the structure of the input to have a better patch representation and they are based on RNNs, Transformers and CodeBERT, with the best performing model being the Transformer that surprisingly outperformed CodeBERT. The results show that it is possible to classify security patches but using more relevant pre-training techniques or tree-based representation of the code might improve the performance.File | Dimensione | Formato | |
---|---|---|---|
Detecting security patches in Java OSS projects using NLP.pdf
accessibile in internet per tutti
Descrizione: thesis document
Dimensione
5.05 MB
Formato
Adobe PDF
|
5.05 MB | Adobe PDF | Visualizza/Apri |
Executive_Summary.pdf
accessibile in internet per tutti
Descrizione: executive summary
Dimensione
352.43 kB
Formato
Adobe PDF
|
352.43 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/190755