JavaSith: A Client-Side Framework for Analyzing Potentially Malicious Extensions in Browsers, VS Code, and NPM Packages

Avihay Cohen · 2025

Read JavaSith: A Client-Side Framework for Analyzing Potentially Malicious Extensions in Browsers, VS Code, and NPM Packages by Avihay Cohen (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2505-21263.txt.

Introduction

Malware hides inside tools people trust: browser add-ons, editor extensions, and open packages. Avihay Cohen presents JavaSith, a framework for vetting them before installation. It runs the suspect code in a sandbox that fakes the browser and Node environments. A time machine fast-forwards the clock to spring time-delayed traps. Static analysis and a local language model weigh the risk from code and metadata.

Case studies include a hijacked Chrome extension and editor add-ons that installed coin miners. JavaSith caught stealthy behavior that older tools missed. Cohen discusses limits and next steps. The client-side design lets users and firms check components themselves, before trust is granted.

Catalog record

CREATORAvihay Cohen
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE70 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2505-21263

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

JavaSith: A Client-Side Framework for Analyzing Potentially Malicious Extensions in Browsers, VS Code, and NPM Packages Avihay Cohen 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. 1 Introduction Malicious code injection in trusted software components has emerged as a major cybersecurity threat. In particular, browser extensions, IDE extensions, and open-source packages have been weaponized as vectors to infiltrate systems via supply chain attacks. Recent incidents underscore the scale of the problem: in late 2024, a compromised Chrome extension update injected data-stealing code and affected over 400,000 users [ 5 ] , as part of a broader campaign compromising 35 extensions and impacting 2.6 million users [ 4 ] . Likewise, in 2025, researchers discovered ten malicious VS Code extensions (masquerading as popular tools with hundreds of thousands of installs) that surreptitiously deployed cryptocurrency miners on developers’ machines [ 8 ] . These examples highlight how threat actors leverage the trust and reach of extensions and packages to compromise large user bases. Alarmingly, such malicious extensions often evade official store security checks – for example, the malicious Chrome extension update in the Cyberhaven incident passed Google’s Web Store review process. Traditional defenses struggle against these emerging threats. Signature-based antivirus rarely flags novel extension malware, and permission-based vetting is insufficient when attackers find creative ways to abuse allowed capabilities. Supply chain attacks via extensions and packages have surged by 431% in recent years [ 7 ] , indicating that adversaries are actively adapting to exploit blind spots. The need for better tooling to analyze and detect malicious behavior in extensions before damage occurs is evident. In this paper, we introduce JavaSith [ 1 ] , a client-side framework that empowers researches/organizations to scrutinize browser extensions [ 1 ] , VSCode extensions [ 2 ] , and NPM packages [ 3 ] for malicious intent. Unlike server-side scanning services, JavaSith runs locally in the user’s browser (for privacy and immediacy), integrating multiple analysis techniques: (1) a dynamic sandbox entirely in the browser execution context that safely executes extension code in an instrumented environment, emulating browser extensions api or Node.js APIs so that all invoked calls and behaviors can be observed; (2) a time machine module that can fast-forward or simulate time to trigger time-dependent logic (e.g., delayed or periodic malicious payloads); (3) a code parser module that parsed javascript code and converts it to AST for further insights (e.g function names , variables, invoked APIs …) (4) a static analysis pipeline incorporating tools like Retire.js [ 14 ] (to detect known vulnerable libraries) and custom detectors for obfuscation or suspicious API usage; (5) a lightweight on-device WebLLM [ 13 ] (Web-based Large Language Model) that assesses risk by analyzing the extension’s source code, metadata, and even privacy policy text to identify potential red flags in plain language; (6) a user-friendly web-based GUI that presents the comprehensive analysis results, including raw logs, flagged patterns, and LLM-generated summaries of risky behavior. Our aim is to provide a holistic analysis that can catch complex, stealthy malicious behaviors that single techniques might miss. For instance, dynamic monitoring can reveal if an extension tries to exfiltrate data or fetch external payloads at runtime, while static inspection can identify hidden backdoors or suspicious strings (like hardcoded webhook URLs or encrypted payloads). The inclusion of an LLM-based analysis offers a higher-level interpretation of the findings, bridging the gap between raw technical signals and an understandable risk assessment for the user. We validate JavaSith through case studies of known malicious extensions and packages. We show that JavaSith would have flagged the malicious Chrome extension involved in the Cyberhaven breach by detecting its cookie-stealing code and unusual network behavior, even if it remained dormant until a specific time window. In the case of VSCode cryptominer extensions, our sandbox observes the download of a PowerShell script and subsequent installation of a hidden cryptominer, actions that we surface as severe warnings to the user. We also demonstrate JavaSith on an example malicious NPM package that uses obfuscated install scripts, illustrating how combining static and dynamic analysis can uncover the hidden payload. In summary, the contributions of this work include: • JavaSith Framework : We design and implement a novel client-side framework to analyze browser extensions, VSCode extensions, and NPM packages for malicious behavior. JavaSith combines runtime sandboxing, time acceleration, static analysis, and LLM-based code understanding in a unified tool that is completely client based. • Runtime Sandbox with Time/Events Simulation : We introduce a sandbox that emulates the targeted runtime (browser or Node) and intercepts extension API calls, DOM manipulations, and network requests. A built-in “time machine” can accelerate timers and simulate future dates to trigger logic bombs or delayed payloads that would otherwise require long real-time waiting. the sandbox also simulates different set of events like page navigation to sensitive domains like login.microsoftonline.com or facebook.com and then monitor the extension code for malicious bahviour like reading cookies / injecting javascript / … • Integrated Static + LLM Analysis : JavaSith integrates static vulnerability scanning (using tools like Retire.js for known vulnerable libraries [ 14 ] and custom pattern matching for suspicious code constructs) with a WebLLM-based analysis that summarizes and highlights risky behavior from the extension’s source code and metadata. By running the LLM locally in the browser via WebGPU, we ensure privacy while leveraging advanced reasoning over code. • Evaluation on Real Attacks : Through detailed case studies (Chrome extension supply-chain attack, malicious VSCode cryptominer extensions, and others), we demonstrate that JavaSith can detect malicious behaviors (cookie/session theft, unauthorized network beaconing, cryptomining installation, credential exfiltration via webhooks, etc.) that might evade detection by conventional means. We measure JavaSith’s effectiveness in triggering hidden behaviors and its performance overhead on sample extensions. • Tool for the Community : We provide a browser-based graphical interface that allows users to navigate analysis results, including raw execution traces, flagged security issues, and explanatory risk reports generated by the LLM. This interface lowers the barrier for developers and security analysts to vet third-party extensions and packages, complementing official marketplace security measures. 2 Background and Motivation Browser extensions and plugin-based software ecosystems greatly expand functionality but also inherently expand the attack surface. Here we outline how browser and VSCode extensions operate, the current security measures in place, and

Read the complete text