TempleGold

TempleDAO
Foundry
25,000 USDC
View results
Submission Details
Severity: medium
Invalid

Lack of Parameter Validation in `TempleTeleporter:_lzReceive` Function

Summary

The _lzReceive function in the TempleTeleporter smart contract is responsible for handling cross-chain message receipt and subsequent token minting. However, the function does not validate the parameters decoded from the received payload. This lack of validation can lead to potential security vulnerabilities, including unauthorized minting and misuse of the contract.

Vulnerability Details

The _lzReceive function decodes the _payload to retrieve the recipient address (_recipient) and the amount of tokens (_amount). However, it fails to validate these parameters. Specifically, the function does not check whether:

  • The _recipient address is a valid, non-zero address.

  • The _amount is greater than zero.

See the following code:

function _lzReceive(
Origin calldata /*_origin*/,
bytes32 /*_guid*/,
bytes calldata _payload,
address /*_executor,*/, // Executor address as specified by the OApp.
bytes calldata /*_extraData */ // Any extra data or options to trigger on receipt.
) internal override {
// Decode the payload to get the message
(address _recipient, uint256 _amount) = abi.decode(_payload, (address, uint256));
temple.mint(_recipient, _amount);
}

Impact

If the _recipient address is not validated, tokens could be minted to invalid or unintended addresses, leading to loss of tokens and potential unauthorized access. Without validation of the _amount, tokens could be minted with zero, which can disrupt the token supply and contract logic. Malicious actors could craft payloads with invalid parameters to exploit the minting function, causing harm to the token ecosystem and affecting trust.

Tools Used

Manual Review

Recommendations

To mitigate this issue, it is essential to validate the parameters before proceeding with the minting operation. Specifically, the function should:

  • Ensure the _recipient is a valid, non-zero address.

  • Ensure the _amount is greater than zero.

Updates

Lead Judging Commences

inallhonesty Lead Judge 12 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.