How I Discovered My First Critical Vulnerability in My Bug Bounty Career

Sahil Bugade (snip3rgg)
2 min readMar 12, 2024

--

My journey into bug bounty hunting took an unexpected turn when I stumbled upon what would become my first critical discovery – Remote Code Execution via dependency confusion. But how did I find it? Let's dive into some foundational programming concepts first.

In many programming languages, dependencies play a crucial role in the development process. These dependencies are often imported into the program to extend its functionality. Sometimes, these dependencies include private code written by developers within the company, which are then imported into various applications.

In languages like Node.js, the `package.json` file is where developers list all the dependencies required for their application to function. Node.js, along with its package manager NPM, relies on a public registry where these dependencies are hosted and made publicly available. However, the private dependencies are not part of this public registry, creating an opportunity for malicious actors.

Here's where the vulnerability lies: I decided to publish my own package containing a reverse shell. This package mimicked the structure of legitimate dependencies and was designed to be automatically installed whenever the intended dependency was called or updated. This caused a confusion in the dependency resolution process, leading NPM to inadvertently install my malicious package instead of the intended private one.

And just like that, I had successfully exploited the dependency confusion vulnerability, showcasing the potential risks lurking within the software supply chain. This experience marked a significant milestone in my bug bounty journey, highlighting the importance of thorough code analysis and vigilance in identifying and mitigating vulnerabilities.

#infosec #bugbountytips #bugbounty #bugbountytip #bughunting

--

--

Sahil Bugade (snip3rgg)
Sahil Bugade (snip3rgg)

Written by Sahil Bugade (snip3rgg)

Security researcher | CTF Player/Developer | Bug Hunter | Pentester

Responses (1)