Stubbifier: Debloating Dynamic Server-Side JavaScript Applications

10/27/2021
by   Alexi Turcotte, et al.
0

JavaScript is an increasingly popular language for server-side development, thanks in part to the Node.js runtime environment and its vast ecosystem of modules. With the Node.js package manager npm, users are able to easily include external modules as dependencies in their projects. However, npm installs modules with all of their functionality, even if only a fraction is needed, which causes an undue increase in code size. Eliminating this unused functionality from distributions is desirable, but the sound analysis required to find unused code is difficult due to JavaScript's extreme dynamicity. We present a fully automatic technique that identifies unused code by constructing static or dynamic call graphs from the application's tests, and replacing code deemed unreachable with either file- or function-level stubs. If a stub is called, it will fetch and execute the original code on-demand, thus relaxing the requirement that the call graph be sound. The technique also provides an optional guarded execution mode to guard application against injection vulnerabilities in untested code that resulted from stub expansion. This technique is implemented in an open source tool called Stubbifier, which supports the ECMAScript 2019 standard. In an empirical evaluation on 15 Node.js applications and 75 clients of these applications, Stubbifier reduced application size by 56 overhead. The evaluation also shows that Stubbifier's guarded execution mode is capable of preventing several known injection vulnerabilities that are manifested in stubbed-out code. Finally, Stubbifier can work alongside bundlers, popular JavaScript tools for bundling an application with its dependencies. For the considered subject applications, we measured an average size reduction of 37

READ FULL TEXT

page 1

page 2

page 3

page 4

research
08/11/2020

Code-based Vulnerability Detection in Node.js Applications: How far are we?

With one of the largest available collection of reusable packages, the J...
research
03/31/2021

NodeSRT: A Selective Regression Testing Tool for Node.js Application

Node.js is one of the most popular frameworks for building web applicati...
research
06/24/2023

HODOR: Shrinking Attack Surface on Node.js via System Call Limitation

Node.js provides Node.js applications with system interaction capabiliti...
research
10/18/2017

ComFlux: External Composition and Adaptation of Pervasive Applications

Technology is becoming increasingly pervasive. At present, the system co...
research
11/14/2018

Mayall: A Framework for Desktop JavaScript Auditing and Post-Exploitation Analysis

Writing desktop applications in JavaScript offers developers the opportu...
research
05/12/2022

Analyzing Impact of Dependency Injection on Software Maintainability

Dependency injection (DI) is generally known to improve maintainability ...
research
09/10/2023

SYSPART: Automated Temporal System Call Filtering for Binaries

Restricting the system calls available to applications reduces the attac...

Please sign up or login with your details

Forgot password? Click here to reset