Preventing Supply Chain Vulnerabilities in Java with a Fine-Grained Permission Manager

Paschal C. Amusuo, Kyle A. Robinson, Santiago Torres-Arias, Laurent Simon, James C. DavisarXiv 2023 · arXiv · OpenReview

TL;DR

This paper introduces Zero-Trust Dependencies (ZTD), a novel approach to mitigate software supply chain (SSC) vulnerabilities in Java applications. By applying Zero-Trust Architecture principles at the dependency level, ZTDsys and its prototype ZTDJAVA significantly reduce the risk of exploits without imposing high performance costs or complex configuration.

What Problem Does This Paper Address?

Modern software development heavily relies on third-party libraries (TPLs) to accelerate development. However, these TPLs introduce significant security risks, as vulnerabilities within them can be exploited to compromise the host system. This is known as a Software Supply Chain (SSC) attack. Existing security defenses often grant implicit trust to dependencies, allowing them to access resources with the same privileges as the main application. This broad access means that even a minor vulnerability in a TPL can lead to severe consequences. While Zero-Trust Architecture (ZTA) principles offer a robust security model by enforcing least privilege and continuous monitoring, applying them to individual dependencies within an application at runtime has been challenging due to performance overhead and configuration complexity.

Methods

The paper proposes Zero-Trust Dependencies (ZTD), a concept that adapts ZTA principles to software applications. The core idea is to grant zero implicit trust to dependencies and require explicit authorization for any resource access. This is achieved through a system called ZTDsys, which has five key components:

  • Application Transformer (AT): Modifies application bytecodes to insert calls to the runtime monitor.
  • Runtime Monitor: Intercepts resource access attempts.
  • Policy Generator: Infers least-privilege policies for dependencies by observing their runtime behavior.
  • Policy Context: Stores and manages these policies.
  • Policy Enforcer: Authorizes or denies resource access based on the policies.

ZTDJAVA, a prototype implementation for Java applications, is developed. It supports both coarse-grained (e.g., allow/deny access to a resource type) and fine-grained (e.g., allow/deny access to specific files or network hosts) permissions. The system handles direct dependency interactions and attempts to manage indirect interactions through thread delegation. Two enforcement modes are offered: "Fatal Enforcement" to block unauthorized actions and "Non-fatal Enforcement" to log alerts for investigation.

Datasets

The paper utilizes several datasets for its feasibility study and evaluation:

  • Open-Source Vulnerabilities (OSV) database: Used to identify Java SSC vulnerabilities.
  • Ecosystems database: Used to identify popular Maven Central libraries.
  • DaCapo benchmark suite: A collection of 22 Java applications used for realistic performance evaluation.

No new benchmarks were introduced; instead, existing datasets were leveraged to assess the effectiveness and performance of ZTDJAVA on real-world applications.

Key Insights and Ideas

  • ZTA at the Dependency Level is Feasible and Necessary: The study demonstrates that applying ZTA principles to individual dependencies is not only possible but crucial for mitigating a significant portion of SSC vulnerabilities.
  • Fine-Grained Policies are Key: Many SSC vulnerabilities can be mitigated by coarse-grained policies, but a substantial percentage (42%) require fine-grained policies that specify access to specific resource objects.
  • Low Configuration Effort for Real Applications: Contrary to initial concerns, the automated policy generation by ZTDJAVA significantly reduces the configuration effort for engineers, with most applications requiring policies for only a few dependencies with minimal permissions.
  • Minimal Performance Overhead: ZTDJAVA introduces negligible performance overhead, making it practical for adoption in real-world applications, outperforming existing solutions like the Java Security Manager.

Key Results

  • Vulnerability Mitigation: ZTDJAVA successfully blocked exploits for 11 out of 12 injected vulnerabilities in sample applications. For real applications, the generated least-privilege policies prevented all 9 injected vulnerability exploits.
  • Performance: ZTDJAVA introduces modest overhead for file write, socket connection, and shell execution operations. Overall, it shows less than 1% overhead on 13 out of 16 DaCapo benchmark applications, with some applications experiencing no noticeable overhead. This is significantly better than the Java Security Manager, which can incur over 200% overhead.
  • Configuration Effort: For 9 out of 16 DaCapo applications, fewer than 5 dependencies required policy specification, and each policy provided only 1-3 permissions on average. This indicates a low configuration effort for engineers.

Limitations and Future Work

  • Asynchronous Delegation: ZTDJAVA's current handling of indirect dependency interactions does not fully cover complex scenarios involving independent threads or processes. Future work could expand the permission model to recognize threads and processes as resources.
  • Native Execution: Attackers could potentially bypass ZTD's authorization by using native libraries. While the application transformer could be extended to protect native library usage, alternative designs might involve sandboxing native libraries, which could introduce performance overhead.
  • False Positives: Incomplete generated policies might lead to false positives. The non-fatal enforcement mode helps mitigate this by alerting engineers rather than disrupting the application. Future work could involve developing lightweight coverage metrics to guide engineers in ensuring sufficient program behavior is covered.
  • Namespace Pollution: While rare, multiple dependencies sharing the same namespace could be a concern. However, enforcing fine-grained policies can limit the attacker's ability to inherit privileges.
  • Ecosystem Expansion: The current work focuses on Java. Future directions include extending ZTDJAVA to other JVM-based languages and potentially other ecosystems and programming languages.
  • Improved Visibility of Library Capabilities: Encouraging third-party library engineers to communicate their capabilities and resource usage more transparently would further enhance security.

Summary updated

Abstract

Integrating third-party packages accelerates modern software engineering, but introduces the risk of software supply chain vulnerabilities. Vulnerabilities in applications' dependencies are being exploited worldwide. Often, these exploits leverage features that are present in a package, yet unneeded by an application. Unfortunately, the current generation of permission managers, such as SELinux, Docker containers, and the Java Security Manager, are too coarse-grained to usefully support engineers and operators in mitigating these vulnerabilities. Current approaches offer permissions only at the application's granularity, lumping legitimate operations made by safe packages with illegitimate operations made by exploited packages. This strategy does not reflect modern engineering practice. we need a permission manager capable of distinguishing between actions taken by different packages in an application's supply chain. In this paper, we describe Next-JSM, the first fine-grained ("supply chain aware") permission manager for Java applications. Next-JSM supports permission management at package-level granularity. Next-JSM faces three key challenges: operating on existing JVMs and without access to application or package source code, minimizing performance overhead in applications with many packages, and helping operators manage finer-grained permissions. We show that these challenges can be addressed through bytecode rewriting; appropriate data structures and algorithms; and an expressive permission notation plus automated tooling to establish default permission. In our evaluation, we report that Next-JSM mitigates 11 of the 12 package vulnerabilities we evaluated and incurs an average 2.72% overhead on the Dacapobench benchmark. Qualitatively, we argue that Next-JSM addresses the shortcomings of the (recently deprecated) Java Security Manager (JSM).
BibTeX
@misc{amusuo2023preventing,
  author = {Paschal C. Amusuo and Kyle A. Robinson and Santiago Torres-Arias and Laurent Simon and James C. Davis},
  title = {{Preventing Supply Chain Vulnerabilities in Java with a Fine-Grained Permission Manager}},
  year = {2023},
  eprint = {2310.14117},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.14117},
}
Figure