Open code423n4 opened 2 years ago
Created the organisation. Thank you.
I think this is an interesting attack vector and useful find!
I would normally mark findings unrelated to Solidity code as invalid
, however, I think the issue here raises an interesting exploit where an attacker could inject malicious code into a smart contract dependency. As such, I think this is relevant and a valid attack path.
Lines of code
https://github.com/code-423n4/2022-03-timeswap/blob/00317d9a8319715a8e28361901ab14fe50d06172/Timeswap/Convenience/package.json#L40
Vulnerability details
Impact
I discovered an npm package and the scope of the package is unclaimed on the NPM website. This will give any User to claim that package and be able to Upload a Malicious Code under that unclaimed package. This results in achieving the Remote code execution on developers/users' machine who depends on the timeswap repository to build it on local env.
Vulnerable Package Name: @timeswap-labs/timeswap-v1-core
Proof of Concept
Till now "The Package is not claimed on NPM Registry, but it's vulnerable to dependency confusion". You can read more dependency confusion here: https://dhiyaneshgeek.github.io/web/security/2021/09/04/dependency-confusion/
Tools Used
Nothing Just OSINT
Recommended Mitigation Steps
Claim the Scope name called "timeswap-labs" By Following the above POC Step 1.