SC07:2023 - ロジックエラー (Logic Errors)
説明:
事例 :
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract LendingPlatform {
mapping(address => uint256) public userBalances;
uint256 public totalLendingPool;
function deposit() public payable {
userBalances[msg.sender] += msg.value;
totalLendingPool += msg.value;
}
function withdraw(uint256 amount) public {
require(userBalances[msg.sender] >= amount, "Insufficient balance");
// Faulty calculation: Incorrectly reducing the user's balance without updating the total lending pool
userBalances[msg.sender] -= amount;
// This should update the total lending pool, but it's omitted here.
payable(msg.sender).transfer(amount);
}
}影響:
対策:
ロジックエラーの被害を受けたスマートコントラクトの事例:
PreviousSC06:2023 - サービス拒否攻撃 (Denial of Service (DoS) Attacks)NextSC08:2023 - 安全でないランダム性 (Insecure Randomness)
Last updated