GoLeash: Mitigating Golang Software Supply Chain Attacks with Runtime Policy Enforcement
Carmine Cesarano 1 , Martin Monperrus 1 , Roberto Natella 2 · 2025
Read GoLeash: Mitigating Golang Software Supply Chain Attacks with Runtime Policy Enforcement by Carmine Cesarano 1 , Martin Monperrus 1 , Roberto Natella 2 (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-11016.txt.
Introduction
Carmine Cesarano, Martin Monperrus, and Roberto Natella present a 2025 computing paper on supply chain attacks in the Go language ecosystem. Attackers slip malicious powers into trusted third-party packages, which then spread through dependency chains. Go code runs much of the cloud, so the stakes are high.
Their system, GoLeash, applies least privilege at the level of each package. Every package in a program gets its own runtime policy for what it may do. That finer grain catches malicious packages that process-level sandboxes would miss. The enforcement works even when the bad code is obfuscated, a case where static analysis struggles. The authors report that the runtime cost stays acceptable. The design treats each package as a separate trust zone inside one program.
Catalog record
| CREATOR | Carmine Cesarano 1 , Martin Monperrus 1 , Roberto Natella 2 |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 85 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2505-11016
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
GoLeash: Mitigating Golang Software Supply Chain Attacks with Runtime Policy Enforcement Carmine Cesarano 1 , Martin Monperrus 1 , Roberto Natella 2 Abstract Modern software supply chain attacks consist of introducing new, malicious capabilities into trusted third-party software components, in order to propagate to a victim through a package dependency chain. These attacks are especially concerning for the Go language ecosystem, which is extensively used in critical cloud infrastructures. We present GoLeash, a novel system that applies the principle of least privilege at the package-level granularity, by enforcing distinct security policies for each package in the supply chain. This finer granularity enables GoLeash to detect malicious packages more precisely than traditional sandboxing that handles security policies at process- or container-level. Moreover, GoLeash remains effective under obfuscation, can overcome the limitations of static analysis, and incurs acceptable runtime overhead. \tl_set:Ne \Definition Definition \tl_set:Ne \Def Def I Introduction In recent years, software supply chain (SSC) attacks have jumped to the forefront of cybersecurity concerns. Rather than attacking end-users directly, adversaries now infiltrate the software development pipeline. Attackers have been injecting harmful code into widely-used software packages through social engineering, malicious commits, typosquatting, and hijacking unmaintained repositories [ 1 , 2 ] . Once a compromised package is released, downstream projects are infected by malicious code through normal dependency resolution and build processes. Their users then become susceptible to credential theft, resource hijacking, and remote command execution [ 3 ] . These supply chain attacks are especially alarming for the Go language (Golang) ecosystem. This language has been heavily used for critical cloud software [ 4 ] , including Kubernetes [ 5 ] , Docker [ 6 ] , Terraform [ 7 ] , Etcd [ 8 ] , and several others mission-critical infrastructures [ 9 ] . Injecting malicious code into these Golang software projects would enable unauthorized control over cloud infrastructures, with potentially devastating consequences. We are already witnessing supply chain attacks against the Golang ecosystem, including the recent typosquatting attacks to the BoltDB database [ 10 ] and Hypert testing library [ 11 ] , and the huge number of Go packages found on GitHub that are vulnerable to repojacking [ 12 ] . In this paper, we aim to improve the state of the art of mitigating software supply chain attacks on Golang critical applications. We present GoLeash , a novel approach and its research prototype for mitigating malicious behavior of Go packages once they have been compromised. GoLeash is inspired by the “principle of least privilege”, that is, the idea that accesses should be limited to the minimal set that is feasible and practical [ 13 , 14 ] . GoLeash has two modes: 1) an analysis mode to automatically infer the policies of Go packages; and 2) an enforcement mode that restricts the behavior of Go packages at run-time, by checking that Go packages comply with the package policy. Go packages in the supply chain are forbidden to perform operations with capabilities that they are not supposed to have (for example, opening a network connection in a package for local data processing). GoLeash monitors Go programs at run-time, using the eBPF framework [ 15 ] , to collect information about capabilities accessed by Go packages and automatically build a security policy (analysis). Thus, it enforces Go packages to have the minimal set of capabilities required to perform their intended purpose (enforcement). GoLeash is a novel approach for policy enforcement. Existing approaches for monitoring and sandboxing of system calls for Go [ 16 , 17 ] only apply to entire processes and containers, which makes enforcement too coarse-grained to mitigate supply chain attacks. If a package in the program is allowed to use a capability (e.g., a privileged system call), the entire process or container needs to be assigned that capability. GoLeash works at a finer grain, since it is able to trace back which Go package is using a capability at a given moment, thus it can enforce separate policies across different Go packages. While runtime sandboxing is itself a well-studied area, the contribution of GoLeash lies doing per-dependency sandboxing with three contributions: per-package syscall attribution within a single statically-linked binary; automated per-package policy inference from observed execution; and an enforcement design that holds under a threat model in which dependencies themselves are treated as adversarial and untrusted. As we demonstrate in our experiments, this makes GoLeash more precise and less prone to omissions than alternatives. To evaluate GoLeash, we systematically inject malicious behaviors (e.g., exfiltrate or infiltrate files) into the software supply chain of real-world, complex applications such as kubernetes. Our evaluation shows that GoLeash is able to successfully identify malicious packages in 98\% of cases, compared to 32\% in the case of coarse-grained monitoring. Moreover, our approach is effective even when obfuscation techniques are used for hiding the malicious code. GoLeash has an acceptable overhead, by introducing 1.3 – 5.1\% per-request CPU overhead. In summary, the main contributions of this work are: • A new approach for run-time capability enforcement based on tracing and enforcing specific capabilities for individual packages in a software supply chain. • GoLeash, an efficient implementation of the approach for Golang, based on the eBPF observability framework, available as open-source for future research [ 18 ] . GoLeash is able to both learn and enforce package-level dependency policies. • An evaluation of GoLeash on five real-world, complex Go projects, incl. one of the largest Go application ever, Kubernetes, in terms of software supply chain attack mitigation and performance overhead. The paper is structured as follows. In Section II , we provide technical background and motivation for the paper. In Section III , we present the threat model and assumptions. Section IV presents the design of GoLeash. Section V evaluates the approach. Section VII analyzes related work. Section VI discusses use cases and limitations of GoLeash. Section VIII concludes the paper. II Background II-A Real-world Go Supply Chain Attack A concrete real-world example of the pressing supply chain threats in Go is the recent compromise of the popular boltdb/bolt module [ 10 ] . An adversary published a typosquatted module impersonating the original library. While appearing entirely benign and preserving its normal database functionality, the malicious module stealthily introduced remote code execution (RCE) capabilities at run-time. Specifically, the compromised package established a persistent, obfuscated network connection to a command-and-control (C2) server using Go’s standard net.Dial function. Once connected, the package awaited commands from attackers and executed arbitrary shell instructions through the os/exec.Command API, effectively enabling unrestricted file manipulation, process control, and network access, which are capabilities never intended by the original BoltDB library. After the malicious package was cached by the Go Module Mirror, the attacker rewrote the Git tag to point to a clean commit, concealing the backdoor in the public repository. However, the proxy had already cached the malicious pseudo-version, which downstream applications continued to fetch long after the repository appeared clean. This allowed the backdoor to persist in the Go ecosystem for years. Software supply chain attacks are powerful. Attackers increasingly leverage sophisticated obfuscation techniques, ranging from encryption of malicious payloads to more subtle strategies. Go’s runtime provides uniquely powerful features such as CGO (integration of C code into