首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ERC721A安全测试漏洞

ERC721A安全测试漏洞
EN

Ethereum用户
提问于 2023-04-26 23:33:42
回答 1查看 33关注 0票数 0

在使用Slither测试一些合同时,我遇到了2件奇怪的事情。

  1. 在下面的合同EtherStore.sol中,它最初具有重入漏洞,我想出了一个想法,我将添加ReentrancyGuard并再次用Slither测试它,以查看漏洞是否消失,但它没有.

知道为什么吗?Slither没有实现可重入保护,或者他只是在指出这个函数中存在重入性,我们应该用ReentrancyGuard来覆盖它吗?

代码语言:javascript
复制
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

contract EtherStore is ReentrancyGuard {
    mapping(address => uint256) public balances;

    function deposit() external payable {
        balances[msg.sender] += msg.value;
    }

    function withdraw() external nonReentrant {
        uint256 balance = balances[msg.sender];
        require(balance > 0);
        (bool success, ) = msg.sender.call{value: balance}("");
        require(success, "Failed to send Ether");
        balances[msg.sender] = 0;
    }

    // Helper function to check the balance of this contract
    function getBalance() external view returns (uint256) {
        return address(this).balance;
    }
}
  1. 我还想出了在ERC721A中发现错误的方法,在我看来,这有点荒谬,因为很多协议都使用它.你知道为什么斯利瑟在ERC721A上大喊大叫吗?使用ERC721A安全吗? Slither是错误的,还是确实存在漏洞?

谢谢您的反馈!

EN

回答 1

Ethereum用户

回答已采纳

发布于 2023-04-27 10:30:29

实际上,Slither提供的大多数漏洞都是可以忽略的。它只是打印出每一个可能的漏洞,其中很少有实际可以被认为是漏洞。

它还指出了OZ合同中存在的许多漏洞,这些漏洞并不易受攻击。你可以忽略它们,除非那些突出的线条看起来很脆弱。

票数 0
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/149535

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档