The swapRegistered function allows an existing asset in the registry to be replaced with a new one. This is particularly sensitive, as it directly modifies the asset registry and can alter the composition of assets recognized by the system. The function currently lacks access control, allowing any external user to execute it.
Impact
If a malicious actor gains access to this function, they could replace a legitimate asset with a malicious or incompatible one. This could disrupt the operations of dependent contracts, lead to the loss of funds, or introduce vulnerabilities into the system.
Exploit Scenario:
1.A malicious user identifies a legitimate asset in the registry.
2.They create a contract that appears similar to the legitimate asset but contains harmful code.
3.The user calls swapRegistered to replace the legitimate asset with their malicious contract.
4.The registry now contains the malicious asset, potentially causing widespread issues within the system.
Proof of Concept
Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.
Tools Used
Manual Review
Recommended Mitigation
Restrict access to the swapRegistered function by implementing access control mechanisms. Only trusted and authorized parties should be able to perform asset swaps within the registry.
Lines of code
https://github.com/code-423n4/2024-07-reserve/blob/3f133997e186465f4904553b0f8e86ecb7bbacbf/contracts/p1/AssetRegistry.sol#L90
Vulnerability details
Summary
The swapRegistered function allows an existing asset in the registry to be replaced with a new one. This is particularly sensitive, as it directly modifies the asset registry and can alter the composition of assets recognized by the system. The function currently lacks access control, allowing any external user to execute it.
Impact
If a malicious actor gains access to this function, they could replace a legitimate asset with a malicious or incompatible one. This could disrupt the operations of dependent contracts, lead to the loss of funds, or introduce vulnerabilities into the system.
Exploit Scenario:
1.A malicious user identifies a legitimate asset in the registry.
2.They create a contract that appears similar to the legitimate asset but contains harmful code.
3.The user calls swapRegistered to replace the legitimate asset with their malicious contract.
4.The registry now contains the malicious asset, potentially causing widespread issues within the system.
Proof of Concept
Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.
Tools Used
Manual Review
Recommended Mitigation
Restrict access to the swapRegistered function by implementing access control mechanisms. Only trusted and authorized parties should be able to perform asset swaps within the registry.
Assessed type
Access Control