25930 - [SC - Insight] Malicious owner can update the DepositParams st...
Description
Bug Description
Details
38: function deposit(
39: ExchangeData.State storage S,
40: address from,
41: address to,
42: address tokenAddress,
43: uint248 amount, // can be zero
44: bytes memory extraData
45: )
46: internal // inline call
47: {
48: require(to != address(0), "ZERO_ADDRESS");
49: require(from == to, "INVALID_DEPOSIT_FROM"); // Only allow deposits to the user's own account
50:
51: // Deposits are still possible when the exchange is being shutdown, or even in withdrawal mode.
52: // This is fine because the user can easily withdraw the deposited amounts again.
53: // We don't want to make all deposits more expensive just to stop that from happening.
54:
55: (uint32 tokenID, bool tokenFound) = S.findTokenID(tokenAddress);
56: if(!tokenFound) {
57: tokenID = S.registerToken(tokenAddress, false);
58: }
59:
60: if (tokenID == 0 && amount == 0) {
61: require(msg.value == 0, "INVALID_ETH_DEPOSIT");
62: }
63:
64: // A user may need to pay a fixed ETH deposit fee, set by the protocol.
65: uint256 depositFeeETH = 0;
66: if (needChargeDepositFee(S)) {
67: depositFeeETH = S.depositState.depositFee;
68: emit DepositFee(depositFeeETH);
69: }
70:
71: // Check ETH value sent
72: require(msg.value >= depositFeeETH, "INSUFFICIENT_DEPOSIT_FEE");Impact
Risk Breakdown
Recommendation
Proof of concept
Previous25927 - [SC - Insight] MultiSig Owners can set malicious implementatio...Next25933 - [SC - Insight] The last person to confirm can control the exec...
Last updated
Was this helpful?