sherlock-audit / 2023-12-avail-judging

4 stars 4 forks source link

KiteWeb3 - Potential Denial-of-Service (DoS) Risk Due to Lack of Upper Limit and Absence of Event Emission in ```AvailBridge::updateFeePerByte()``` #95

Closed sherlock-admin closed 8 months ago

sherlock-admin commented 8 months ago

KiteWeb3

medium

Potential Denial-of-Service (DoS) Risk Due to Lack of Upper Limit and Absence of Event Emission in AvailBridge::updateFeePerByte()

Summary

The AvailBridge::updateFeePerByte() function is responsible for updating the feePerByte charged for message transfers across the bridge. This function is callable only by addresses with the DEFAULT_ADMIN_ROLE, which is intended to be a multisig address.

Vulnerability Detail

Note: The multisig management rules aren't yet defined so it doesn't ensure the necessary security level. For example, the signers could be set to 1/3. This means that 1 signer can set the new fees and change it.

Impact

Code Snippet

Link to the code snippet: https://github.com/sherlock-audit/2023-12-avail/blob/main/contracts/src/AvailBridge.sol#L153C5-L155C6

function updateFeePerByte(uint256 newFeePerByte) external onlyRole(DEFAULT_ADMIN_ROLE) {
@>        feePerByte = newFeePerByte;
    }

Tool used

Manual Review

Recommendation

// Event to be emitted when the fee per byte is updated
+ event FeePerByteUpdated(uint256 oldFeePerByte, uint256 newFeePerByte, address indexed admin);

function updateFeePerByte(uint256 newFeePerByte) external onlyRole(DEFAULT_ADMIN_ROLE) {
+    require(newFeePerByte <= MAX_FEE_PER_BYTE, "Fee exceeds upper limit");
    uint256 oldFee = feePerByte;
    feePerByte = newFeePerByte;
+    emit FeePerByteUpdated(oldFee, newFeePerByte, msg.sender);
}
sherlock-admin commented 8 months ago

1 comment(s) were left on this issue during the judging contest.

takarez commented:

invalid because { invalid: low or even suggestion}