JavaSith: A Client-Side Framework for Analyzing Potentially Malicious Extensions in Browsers, VS Code, and NPM Packages
Avihay Cohen
TL;DR
JavaSith tackles the rising risk of malicious code hidden in trusted extension ecosystems by delivering a client-side framework that performs end-to-end analysis of browser extensions, VSCode extensions, and NPM packages. It combines a fully in-browser runtime sandbox with time-accelerated execution, static analysis (including Retire.js-based vulnerability checks and heuristic pattern detection), and an on-device WebLLM that interprets findings and metadata. The system also includes a GUI for interactive review and provides case studies showing detection of cookie theft, cryptomining payloads, and information exfiltration, all while preserving user privacy by avoiding cloud-based analysis. Collectively, JavaSith demonstrates that a multi-technique, client-side approach can effectively reveal stealthy malicious behaviors that often bypass traditional defenses, offering a practical tool for developers and enterprises to vet extensions before trust is granted.
Abstract
Modern software supply chains face an increasing threat from malicious code hidden in trusted components such as browser extensions, IDE extensions, and open-source packages. This paper introduces JavaSith, a novel client-side framework for analyzing potentially malicious extensions in web browsers, Visual Studio Code (VSCode), and Node's NPM packages. JavaSith combines a runtime sandbox that emulates browser/Node.js extension APIs (with a ``time machine'' to accelerate time-based triggers) with static analysis and a local large language model (LLM) to assess risk from code and metadata. We present the design and architecture of JavaSith, including techniques for intercepting extension behavior over simulated time and extracting suspicious patterns. Through case studies on real-world attacks (such as a supply-chain compromise of a Chrome extension and malicious VSCode extensions installing cryptominers), we demonstrate how JavaSith can catch stealthy malicious behaviors that evade traditional detection. We evaluate the framework's effectiveness and discuss its limitations and future enhancements. JavaSith's client-side approach empowers end-users/organizations to vet extensions and packages before trustingly integrating them into their environments.
