TempleGold

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

Lack of Revert Mechanism in `TempleGold::send` for Failed Message Inspection Leads to Potential Bypass of Security Checks

Summary

The TempleGold contract, which implements the OFT (Omnichain Fungible Token) standard, fails to properly handle message inspection failures in its send function. While the base OFT contract expects implementations to revert on failed inspections, TempleGold does not implement this crucial security check, potentially allowing malicious transactions to bypass intended security measures.

Vulnerability Details

In the OFT base contract, the _buildMsgAndOptions function includes a message inspection mechanism:

if (msgInspector != address(0)) IOAppMsgInspector(msgInspector).inspect(message, options);

The comment above this code explicitly states:

// @dev If it fails inspection, needs to revert in the implementation. ie. does not rely on return boolean

However, the TempleGold contract, which overrides the send function, does not implement any mechanism to revert the transaction if the message inspection fails. This oversight creates a critical security vulnerability.

The TempleGoldAdmin contract includes a function to set a message inspector:

function setMsgInspector(address _msgInspector) external virtual onlyElevatedAccess {
IOFTCore(address(templeGold)).setMsgInspector(_msgInspector);
}

This confirms that message inspection is an intended feature, yet its proper implementation is missing in the TempleGold contract.

Impact

Bypass of Security Checks: Malicious transactions that should be blocked by the message inspector could potentially be processed, compromising the integrity of cross-chain transfers.

Recommendations

Implement Revert Mechanism: Modify the TempleGold contract to explicitly revert the transaction if the message inspection fails. This can be done by overriding the _buildMsgAndOptions function:

function _buildMsgAndOptions(
SendParam calldata _sendParam,
uint256 _amountLD
) internal view virtual override returns (bytes memory message, bytes memory options) {
(message, options) = super._buildMsgAndOptions(_sendParam, _amountLD);
if (msgInspector != address(0)) {
bool inspectionPassed = IOAppMsgInspector(msgInspector).inspect(message, options);
require(inspectionPassed, "Message inspection failed");
}
return (message, options);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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