Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: high
Invalid

External Call Safety

Summary

contractInteractions() allows arbitrary contract calls. Consider whitelisting trusted protocols.

Vulnerability Details

contractInteractions() Allows Unrestricted External Calls

Impact

This function allows arbitrary external calls without whitelisting, enabling potential exploits.

Tools Used

function contractInteractions(address _target, bytes calldata _payload, uint256 _value, bool _storeTarget)
external nonReentrant onlyOwner
{
(bool success, bytes memory data) = _target.call{value: _value}(_payload); // ❌ Potential exploit vector
require(success, "interaction failed");
if (_storeTarget) {
interactions[_target] = data;
}
}

Recommendations

Restrict arbitrary external calls for security. Implement whitelisted contracts for interactions.

mapping(address => bool) private approvedContracts;
modifier onlyWhitelistedContract(address _target) {
require(approvedContracts[_target], "Contract not whitelisted");
_;
}
function contractInteractions(address _target, bytes calldata _payload, uint256 _value, bool _storeTarget)
external nonReentrant onlyOwner onlyWhitelistedContract(_target)
{
(bool success, bytes memory data) = _target.call{value: _value}(_payload);
require(success, "interaction failed");
if (_storeTarget) {
interactions[_target] = data;
}
}
function addApprovedContract(address _contract) external onlyOwner {
approvedContracts[_contract] = true;
}
function removeApprovedContract(address _contract) external onlyOwner {
approvedContracts[_contract] = false;
}
Updates

Lead Judging Commences

0xtimefliez Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.