Minimalist: Semi-automated Debloating of PHP Web Applications through Static Analysis

Published in USENIX Security Symposium, 2023

Recommended citation: R Jahanshahi, Babak Amin Azad, Nick Nikiforakis, and M Egele. Minimalist: Semi-automated Debloating of PHP Web Applications through Static Analysis. USENIX Security Symposium. 2023 https://www.usenix.org/

As web applications grow more complicated and rely on third-party libraries to deliver new features to their users, they become bloated with unnecessary code. This unnecessary code increases a web application’s attack surface, which can be exploited to steal user data and compromise the underlying web server. One approach to deal with bloated code is the process of selectively removing features that users do not require – debloating.

In this paper, we identify the current challenges with debloating web applications and propose a semi-automated static debloating scheme. We implement a prototype of our proposed method, called Minimalist that generates a call-graph for a given PHP web application. Minimalist performs a reachability analysis for the features users require and removes unreachable functions in the analyzed web application. Compared to prior work, Minimalist debloats web applications without relying on heavy runtime instrumentation. Further- more, the call-graph generated by Minimalist can be reused (in combination with web server logs) to debloat different installations of the same web application. Due to the inherent complexity and highly dynamic nature of the PHP language, Minimalist cannot guarantee the soundness of its call-graph analysis. However, Minimalist follows a best-effort approach to model the majority of PHP features used by popular web applications, such as WordPress, phpMyAdmin, and others.

We evaluated Minimalist on 12 versions of four popular PHP web applications with 45 recent security vulnerabilities. We show that Minimalist reduces the size of web applications in our dataset on average by 18% and removes 38% of known vulnerabilities. Our results demonstrate that the principled debloating of web applications can lead to significant security gains without relying on instrumentation mechanisms that degrade the performance of the server.

Recommended citation: R Jahanshahi, Babak Amin Azad, Nick Nikiforakis, and M Egele. Minimalist: Semi-automated Debloating of PHP Web Applications through Static Analysis. USENIX Security Symposium. 2023.