Javascript is the most used programming language for the development of dynamic client-side web pages. With the increase in popularity of Node.js, a run-time environment which executes JavaScript code outside a web browser, it's now a valid choice also as a back-end language for web servers and non-browser applications. This study focuses on prototype pollution vulnerability, a new type of security vulnerability, first discovered in 2018, that has not been studied in depth. The vulnerability exploits the prototype oriented design of JavaScript. By modifying the prototype of native objects such as Object, from which most other objects inherit properties and methods, it's possible, depending on the logic of the specific application, to escalate to almost any other web vulnerability. The purpose of this thesis is to evaluate static analysis techniques that identify the vulnerability, analyzing existing static analysis tools and testing them on known vulnerable functions extracted from real-world projects. In particular, we explain why a certain tool cannot identify a vulnerability case, if it's due a specific pattern implementation, engine limit, known limitations of static analysis or exclusive to prototype pollution. We conduct some case studies on relevant examples that provide interesting results. Starting from the analysis of false negatives, we present some detection avoidance techniques. We also describe the root causes for false positives. As the goal is to improve the detection techniques, our findings are reported to the maintainers of each project.
JavaScript è il linguaggio di programmazione più usato per lo sviluppo di pagine web dinamiche lato client. Negli ultimi anni viene spesso scelto anche per il lato server e programmi desktop utilizzando Node.js che consente l'esecuzione di codice JavaScript al di fuori del browser. Prototype Pollution è una vulnerabilità, su cui c'è ancora poca ricerca, che affligge esclusivamente JavaScript per del via del paradigma prototipale che sta alla base del suo design. Questa nuova vulnerabilità, scoperta solo nel 2018, si basa sulla manipolazione del prototipo degli oggetti nativi come Object, da cui ereditano quasi tutti gli altri oggetti, che avranno quindi accesso alle proprietà modificate. Di conseguenza, a seconda alla logica della specifica applicazione, è possibile sfruttarla per effettuare attacchi riguardanti la maggior parte delle vulnerabilità web. Questa tesi mira ad analizzare e valutare le tecniche di analisi statica per individuare questa vulnerabilità. Si presentano alcuni software esistenti che offrono questa funzionalità e si testano su esempi di funzioni vulnerabili estratte da varie librerie JavaScript. Per verificare che gli esempi collezionati siano effettivamente affetti da prototype pollution scriviamo semplici script che simulano l'attacco. Analizziamo per quale motivo un determinato tool non riesca a individuare una vulnerabilità. Spiegando se dovuto a un limite del pattern, dell'engine specifico, per limitazioni classiche dell'analisi statica o esclusive alla prototype pollution. Analizziamo più nel dettaglio alcuni casi di studio che permettono di ottenere risultati interessanti. Partendo dall'analisi dei falsi negativi riscontrati, si mostra come mettere in difficoltà i tool, creando alcuni esempi di vulnerabilità che non vengono individuati. Successivamente vengono discusse anche le principali cause che portano a falsi positivi. Poiché l'obiettivo di questo lavoro è migliorare gli attuali approcci di analisi statica, comunichiamo i risultati degni di nota agli sviluppatori di ogni tool considerato.
Detecting prototype pollution vulnerabilities in JavaScript using static analysis
Dotti, Francesco
2021/2022
Abstract
Javascript is the most used programming language for the development of dynamic client-side web pages. With the increase in popularity of Node.js, a run-time environment which executes JavaScript code outside a web browser, it's now a valid choice also as a back-end language for web servers and non-browser applications. This study focuses on prototype pollution vulnerability, a new type of security vulnerability, first discovered in 2018, that has not been studied in depth. The vulnerability exploits the prototype oriented design of JavaScript. By modifying the prototype of native objects such as Object, from which most other objects inherit properties and methods, it's possible, depending on the logic of the specific application, to escalate to almost any other web vulnerability. The purpose of this thesis is to evaluate static analysis techniques that identify the vulnerability, analyzing existing static analysis tools and testing them on known vulnerable functions extracted from real-world projects. In particular, we explain why a certain tool cannot identify a vulnerability case, if it's due a specific pattern implementation, engine limit, known limitations of static analysis or exclusive to prototype pollution. We conduct some case studies on relevant examples that provide interesting results. Starting from the analysis of false negatives, we present some detection avoidance techniques. We also describe the root causes for false positives. As the goal is to improve the detection techniques, our findings are reported to the maintainers of each project.File | Dimensione | Formato | |
---|---|---|---|
2022_04_Dotti.pdf
accessibile in internet per tutti
Descrizione: Testo tesi
Dimensione
561.72 kB
Formato
Adobe PDF
|
561.72 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/186425