{"id":1453,"date":"2026-10-26T20:37:07","date_gmt":"2026-10-26T12:37:07","guid":{"rendered":"https:\/\/lezoo6.com\/index.php\/news\/daily\/erc4626-share-inflation-attack\/"},"modified":"2026-10-26T20:37:07","modified_gmt":"2026-10-26T12:37:07","slug":"erc4626-share-inflation-attack","status":"publish","type":"page","link":"https:\/\/lezoo6.com\/index.php\/news\/daily\/erc4626-share-inflation-attack\/","title":{"rendered":"\u4efd\u989d\u662f\u4e00\u884c\u9664\u6cd5\uff1aERC-4626 \u91d1\u5e93\u600e\u4e48\u88ab\u4e00\u7b14\u8f6c\u8d26\u638f\u7a7a"},"content":{"rendered":"<div class=\"lz-art\">\n<p>\u91d1\u5e93\u9875\u9762\u5199\u7740\u201c\u5b58\u5165 10,000 USDC\uff0c\u5e74\u5316 6%\u201d\uff0c\u4f46\u51b3\u5b9a\u4f60\u5230\u624b\u4efd\u989d\u7684\u4e0d\u662f\u5e74\u5316\uff0c\u800c\u662f\u4e00\u884c\u9664\u6cd5\uff1a\u4efd\u989d = \u5b58\u5165\u8d44\u4ea7 \u00d7 \u603b\u4efd\u989d \u00f7 \u603b\u8d44\u4ea7\u3002\u8fd9\u884c\u9664\u6cd5\u7684\u5206\u6bcd\uff0c\u53ef\u4ee5\u88ab\u4e00\u7b14\u4e0e\u91d1\u5e93\u65e0\u5173\u7684\u666e\u901a\u8f6c\u8d26\u62ac\u9ad8\uff1b\u62ac\u9ad8\u4e4b\u540e\uff0c\u4e0b\u4e00\u4e2a\u5b58\u5165\u7684\u4eba\u53ef\u80fd\u62ff\u5230 0 \u4efd\u989d\u3002<\/p>\n<h2>\u4e00\u3001EIP-4626 \u53ea\u89c4\u5b9a\u4e86\u4e00\u4e2a\u9664\u6cd5\uff0c\u548c\u4e24\u4e2a\u53d6\u6574\u65b9\u5411<\/h2>\n<p>EIP-4626 \u628a\u6536\u76ca\u91d1\u5e93\u62bd\u8c61\u6210\u56db\u4e2a\u51fd\u6570\uff1adeposit\/withdraw \u4e0e convertToShares\/convertToAssets\u3002\u6838\u5fc3\u6362\u7b97\u5f0f\u53ea\u6709\u4e00\u4e2a\uff1a\u4efd\u989d = \u8d44\u4ea7 \u00d7 \u603b\u4efd\u989d \u00f7 \u603b\u8d44\u4ea7\uff1b\u53cd\u89e3\u4e3a\u8d44\u4ea7 = \u4efd\u989d \u00d7 \u603b\u8d44\u4ea7 \u00f7 \u603b\u4efd\u989d\u3002\u6807\u51c6\u540c\u65f6\u89c4\u5b9a\u4e86\u53d6\u6574\u65b9\u5411\uff0c\u65b9\u5411\u6c38\u8fdc\u662f\u201c\u5bf9\u7528\u6237\u4e0d\u5229\u3001\u5bf9\u91d1\u5e93\u6709\u5229\u201d\u3002\u5dee\u4e00\u4e24\u4e2a wei \u65f6\u65e0\u6240\u8c13\uff0c\u4f46\u5f53\u5206\u6bcd\u8fdc\u5927\u4e8e\u5206\u5b50\uff0c\u5411\u4e0b\u53d6\u6574\u5c31\u7b49\u4e8e\u5f52\u96f6\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th>\u52a8\u4f5c<\/th>\n<th>\u6362\u7b97<\/th>\n<th>\u53d6\u6574\u65b9\u5411<\/th>\n<th>\u504f\u5dee\u5f52\u8c01<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>deposit<\/td>\n<td>\u8d44\u4ea7 \u2192 \u4efd\u989d<\/td>\n<td>\u5411\u4e0b<\/td>\n<td>\u91d1\u5e93<\/td>\n<\/tr>\n<tr>\n<td>mint<\/td>\n<td>\u8d44\u4ea7 \u2192 \u4efd\u989d<\/td>\n<td>\u5411\u4e0a<\/td>\n<td>\u7528\u6237<\/td>\n<\/tr>\n<tr>\n<td>withdraw<\/td>\n<td>\u4efd\u989d \u2192 \u8d44\u4ea7<\/td>\n<td>\u5411\u4e0a<\/td>\n<td>\u91d1\u5e93<\/td>\n<\/tr>\n<tr>\n<td>redeem<\/td>\n<td>\u4efd\u989d \u2192 \u8d44\u4ea7<\/td>\n<td>\u5411\u4e0b<\/td>\n<td>\u7528\u6237<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u4e8c\u3001\u5206\u6bcd\u662f\u4f59\u989d\uff0c\u6240\u4ee5\u4efb\u4f55\u4eba\u90fd\u80fd\u6539<\/h2>\n<p>\u591a\u6570\u5b9e\u73b0\u91cc totalAssets() \u76f4\u63a5\u8fd4\u56de asset.balanceOf(address(this))\uff0c\u6240\u4ee5\u4efb\u4f55\u4eba\u5411\u91d1\u5e93\u5730\u5740\u505a\u4e00\u6b21 ERC-20 transfer \u5c31\u80fd\u62ac\u9ad8\u603b\u8d44\u4ea7\uff0c\u800c\u603b\u4efd\u989d\u4e00\u679a\u4e0d\u53d8\u3002\u6bcf\u4efd\u51c0\u8d44\u4ea7\uff08\u4ef7\u683c\uff09\u968f\u4e4b\u8df3\u5347\uff0c\u4e0d\u9700\u8981\u4efb\u4f55\u6743\u9650\uff0c\u4e5f\u4e0d\u4f1a\u53d1\u51fa\u63d0\u793a\u3002<\/p>\n<h2>\u4e09\u3001\u7b97\u4f8b\uff1a9,999 USDC \u6362\u5230 0 \u4efd\u989d<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u6b65\u9aa4<\/th>\n<th>\u52a8\u4f5c<\/th>\n<th>\u603b\u8d44\u4ea7<\/th>\n<th>\u603b\u4efd\u989d<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>\u91d1\u5e93\u521a\u90e8\u7f72\uff0c\u7a7a<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>\u653b\u51fb\u8005 deposit 1 wei<\/td>\n<td>1 wei<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>\u653b\u51fb\u8005\u76f4\u63a5 transfer 10,000 USDC \u5230\u91d1\u5e93<\/td>\n<td>10,000.000\u2026<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>\u53d7\u5bb3\u8005 deposit 9,999 USDC\uff1a\u4efd\u989d = floor(9999 \u00d7 1 \u00f7 10000) = 0<\/td>\n<td>19,999<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>\u653b\u51fb\u8005 redeem 1 \u4efd\u989d\uff0c\u62ff\u8d70\u5168\u90e8<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u53d7\u5bb3\u8005\u4ed8\u51fa 9,999 \u5f97\u5230 0 \u4efd\u989d\uff0c\u8d44\u4ea7\u5df2\u8fdb\u91d1\u5e93\uff0c\u6ca1\u6709\u4efb\u4f55\u51ed\u636e\u53ef\u53d6\u56de\uff1b\u653b\u51fb\u8005\u672c\u91d1 10,000 \u52a0 1 wei\uff0c\u6536\u76ca\u5c31\u662f\u8fd9\u7b14\u5b58\u6b3e\u3002<\/p>\n<h2>\u56db\u3001\u5371\u9669\u533a\u4e0d\u662f\u201c\u5b58\u5f97\u5c11\u201d\uff0c\u662f\u201c\u6350\u8d60\u989d\u7684\u91cf\u7ea7\u201d<\/h2>\n<p>\u4efd\u989d = floor(\u5b58\u5165\u989d \u00d7 \u603b\u4efd\u989d \u00f7 \u603b\u8d44\u4ea7)\u3002\u603b\u4efd\u989d\u4e3a 1 \u65f6\uff1a\u5b58\u5165\u989d\u5c0f\u4e8e\u603b\u8d44\u4ea7\uff0c\u4efd\u989d\u4e3a 0\uff0c\u5168\u635f\uff1b\u5b58\u5165\u989d\u7b49\u4e8e\u603b\u8d44\u4ea7\uff0c\u5f97 1 \u4efd\u989d\uff0c\u8d4e\u56de\u4e00\u534a\uff0c\u635f\u5931\u7ea6 50%\uff1b\u5b58\u5165\u989d\u662f\u603b\u8d44\u4ea7\u7684 10 \u500d\uff0c\u5f97 10 \u4efd\u989d\uff0c\u635f\u5931\u7ea6 9%\u3002\u6240\u4ee5\u5371\u9669\u533a\u96c6\u4e2d\u5728\u91d1\u5e93\u521a\u4e0a\u7ebf\u3001TVL \u8fd8\u5c0f\u3001\u5ba3\u4f20\u5374\u5f88\u731b\u7684\u90a3\u51e0\u5929\u3002\u653b\u51fb\u6210\u672c\u4e0e\u6536\u76ca\u4e0a\u9650\u90fd\u7ea6\u7b49\u4e8e\u6350\u8d60\u989d\uff0c\u56e0\u6b64\u53ea\u5728\u4e00\u7b14\u8fdc\u5927\u4e8e\u6350\u8d60\u989d\u7684\u5b58\u6b3e\u5373\u5c06\u5230\u6765\u65f6\u624d\u5212\u7b97\u3002<\/p>\n<h2>\u4e94\u3001\u4e09\u79cd\u4fee\u6cd5\uff0c\u548c\u5404\u81ea\u7684\u4ee3\u4ef7<\/h2>\n<ul>\n<li><b>\u6b7b\u4efd\u989d \/ \u6700\u5c0f\u9996\u5b58<\/b>\uff1aUniswap V2 \u5c31\u94f8\u9020 1,000 \u6700\u5c0f\u6d41\u52a8\u6027\u5e76\u6c38\u4e45\u9500\u6bc1\uff0c\u628a\u5206\u6bcd\u9501\u5728 1,000 \u4ee5\u4e0a\u3002\u4ee3\u4ef7\u662f\u4e00\u7b14\u6c89\u6ca1\u6210\u672c\u3002<\/li>\n<li><b>\u865a\u62df\u4efd\u989d<\/b>\uff1aOpenZeppelin 5.x \u7684 _decimalsOffset() \u628a\u5185\u90e8\u4efd\u989d\u7cbe\u5ea6\u653e\u5927 10^offset\uff0c\u653b\u51fb\u6210\u672c\u540c\u6bd4\u653e\u5927 10^offset \u500d\u3002\u4ee3\u4ef7\u662f offset \u8d8a\u5927\uff0c\u65e9\u671f\u5b58\u6b3e\u4eba\u7684\u7cbe\u5ea6\u635f\u5931\u8d8a\u660e\u663e\u3002<\/li>\n<li><b>\u5185\u90e8\u8bb0\u8d26<\/b>\uff1a\u4e0d\u7528 balanceOf \u5f53\u603b\u8d44\u4ea7\uff0c\u6539\u7528\u53ea\u7531 deposit\/withdraw \u66f4\u65b0\u7684\u4f1a\u8ba1\u53d8\u91cf\uff0c\u6350\u8d60\u4e0d\u8fdb\u5206\u6bcd\u3002\u4ee3\u4ef7\u662f\u9700\u8981\u989d\u5916\u4f1a\u8ba1\u6821\u9a8c\u3002<\/li>\n<\/ul>\n<h2>\u516d\u3001\u5b58\u6b3e\u524d\u81ea\u5df1\u9a8c\u4e00\u904d\u7684\u4e94\u6b65<\/h2>\n<ul>\n<li>\u8bfb totalAssets() \u4e0e totalSupply()\uff0c\u624b\u52a8\u7b97\u4e00\u6b21\u6bcf\u4efd\u51c0\u8d44\u4ea7\u3002<\/li>\n<li>\u770b totalAssets \u7684\u5b9e\u73b0\uff1a\u662f balanceOf\uff0c\u8fd8\u662f\u4f1a\u8ba1\u53d8\u91cf\u3002<\/li>\n<li>\u770b\u6709\u6ca1\u6709\u6700\u5c0f\u9996\u5b58\u3001deadline\u3001decimalsOffset\u3002<\/li>\n<li>\u7528 convertToShares(\u4f60\u7684\u91d1\u989d) \u5148\u7b97\u4e00\u904d\uff0c\u786e\u8ba4\u7ed3\u679c\u5927\u4e8e 0 \u4e14\u4e0d\u662f 1 \u4efd\u989d\u3002<\/li>\n<\/ul>\n<div class=\"lz-note\">\u98ce\u9669\u63d0\u793a\uff1a\u672c\u6587\u53ea\u8bb2\u6761\u6b3e\u4e0e\u7b97\u5f0f\uff0c\u4e0d\u6784\u6210\u6295\u8d44\u5efa\u8bae\u3002\u91d1\u5e93\u7c7b\u4ea7\u54c1\u7684\u672c\u91d1\u635f\u5931\u6765\u81ea\u5408\u7ea6\u6f0f\u6d1e\u3001\u7b56\u7565\u4e8f\u635f\u4e0e\u6324\u5151\uff0c\u5b58\u6b3e\u524d\u5e94\u5047\u8bbe\u6700\u574f\u60c5\u51b5\u662f\u5168\u90e8\u672c\u91d1\u5f52\u96f6\uff1b\u7528\u6760\u6746\u8d44\u91d1\u53c2\u4e0e\u4f1a\u653e\u5927\u8fd9\u4e00\u7ed3\u679c\u3002<\/div>\n<h2>\u4e03\u3001\u5e38\u89c1\u95ee\u9898<\/h2>\n<div class=\"faq\">\n<p><b>\u4e3a\u4ec0\u4e48\u9875\u9762\u663e\u793a\u7684 totalAssets \u6bd4\u6211\u5b58\u8fdb\u53bb\u7684\u603b\u989d\u591a\uff1f<\/b><\/p>\n<p>\u56e0\u4e3a\u6709\u4eba\u76f4\u63a5\u5411\u5408\u7ea6\u8f6c\u8d26\u3002ERC-20 \u8f6c\u8d26\u4e0d\u7ecf\u8fc7 deposit \u903b\u8f91\uff0c\u4f59\u989d\u53d8\u4e86\u800c\u4f1a\u8ba1\u53d8\u91cf\u6ca1\u53d8\uff0c\u5dee\u989d\u5c31\u662f\u201c\u6350\u8d60\u201d\u3002<\/p>\n<p><b>\u6211\u53ea\u662f\u5b58\u6b3e\uff0c\u4e3a\u4ec0\u4e48\u4f1a\u62ff\u5230 0 \u4efd\u989d\uff1f<\/b><\/p>\n<p>\u4efd\u989d\u5411\u4e0b\u53d6\u6574\u3002\u5f53\u603b\u4efd\u989d\u5f88\u5c0f\u800c\u603b\u8d44\u4ea7\u88ab\u62ac\u9ad8\u65f6\uff0c\u5b58\u5165\u989d\u9664\u4ee5\u6bcf\u4efd\u51c0\u8d44\u4ea7\u4e0d\u8db3 1\uff0c\u53d6\u6574\u7ed3\u679c\u5c31\u662f 0\u3002<\/p>\n<p><b>\u5e74\u5316\u9ad8\u662f\u4e0d\u662f\u5c31\u66f4\u5bb9\u6613\u9047\u5230\u8fd9\u79cd\u95ee\u9898\uff1f<\/b><\/p>\n<p>\u5e74\u5316\u6765\u81ea\u7b56\u7565\u4e0e\u6760\u6746\uff0c\u4e0e\u4efd\u989d\u673a\u5236\u65e0\u5173\uff1b\u4f46\u9ad8\u5e74\u5316\u91d1\u5e93\u5f80\u5f80\u4e0a\u7ebf\u4e0d\u4e45\u3001TVL \u5c0f\uff0c\u66f4\u5bb9\u6613\u843d\u5728\u524d\u9762\u8bf4\u7684\u5371\u9669\u533a\u3002<\/p>\n<\/div>\n<h2>\u516b\u3001\u6765\u6e90\u4e0e\u66f4\u65b0<\/h2>\n<p class=\"src\">\n1. EIP-4626: Tokenized Vaults\uff08\u6362\u7b97\u516c\u5f0f\u4e0e\u53d6\u6574\u65b9\u5411\uff09\uff0chttps:\/\/eips.ethereum.org\/EIPS\/eip-4626 \uff08\u8bbf\u95ee\u65e5\u671f\uff1a2026-10-26\uff09\u3002<br \/>\n2. OpenZeppelin Contracts 5.x\uff0cERC-4626 \u6587\u6863\uff08_decimalsOffset \u4e0e\u56db\u820d\u4e94\u5165\u8bf4\u660e\uff09\uff0chttps:\/\/docs.openzeppelin.com\/contracts\/5.x\/erc4626 \uff08\u8bbf\u95ee\u65e5\u671f\uff1a2026-10-26\uff09\u3002<br \/>\n3. \u7ad9\u5185\u5bf9\u7167\uff1a<a href=\"\/index.php\/news\/daily\/tvl-six-scopes-double-counting\/\">\u540c\u4e00\u4e2a\u534f\u8bae\u4e09\u4e2a TVL<\/a>\u3001<a href=\"\/index.php\/news\/daily\/audit-report-eleven-checks\/\">\u4e00\u4efd\u5ba1\u8ba1\u62a5\u544a\u7684 11 \u9879\u68c0\u67e5<\/a>\uff1b\u57fa\u7840\u6982\u5ff5\u89c1<a href=\"\/index.php\/learn\/\">\u52a0\u5bc6\u5b66\u9662<\/a>\uff0c\u8d39\u7387\u4e0e\u6210\u672c\u901f\u7b97\u7528<a href=\"\/index.php\/tools\/\">\u5de5\u5177\u9875<\/a>\u3002\n<\/p>\n<p><script type=\"application\/ld+json\">{\"@context\":\"https:\/\/schema.org\",\"@type\":\"FAQPage\",\"mainEntity\":[{\"@type\":\"Question\",\"name\":\"\u4e3a\u4ec0\u4e48\u9875\u9762\u663e\u793a\u7684 totalAssets \u6bd4\u6211\u5b58\u8fdb\u53bb\u7684\u603b\u989d\u591a\uff1f\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"\u56e0\u4e3a\u6709\u4eba\u76f4\u63a5\u5411\u5408\u7ea6\u8f6c\u8d26\u3002ERC-20 \u8f6c\u8d26\u4e0d\u7ecf\u8fc7 deposit \u903b\u8f91\uff0c\u4f1a\u8ba1\u53d8\u91cf\u4e0d\u53d8\u800c\u4f59\u989d\u53d8\u4e86\uff0c\u5dee\u989d\u5c31\u662f\u6350\u8d60\u3002\"}},{\"@type\":\"Question\",\"name\":\"\u6211\u53ea\u662f\u5b58\u6b3e\uff0c\u4e3a\u4ec0\u4e48\u4f1a\u62ff\u5230 0 \u4efd\u989d\uff1f\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"\u4efd\u989d\u5411\u4e0b\u53d6\u6574\u3002\u603b\u4efd\u989d\u5f88\u5c0f\u800c\u603b\u8d44\u4ea7\u88ab\u62ac\u9ad8\u65f6\uff0c\u5b58\u5165\u989d\u9664\u4ee5\u6bcf\u4efd\u51c0\u8d44\u4ea7\u4e0d\u8db3 1\uff0c\u53d6\u6574\u7ed3\u679c\u5c31\u662f 0\u3002\"}},{\"@type\":\"Question\",\"name\":\"\u5e74\u5316\u9ad8\u662f\u4e0d\u662f\u5c31\u66f4\u5bb9\u6613\u9047\u5230\u8fd9\u79cd\u95ee\u9898\uff1f\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"\u5e74\u5316\u6765\u81ea\u7b56\u7565\u4e0e\u6760\u6746\uff0c\u4e0e\u4efd\u989d\u673a\u5236\u65e0\u5173\uff1b\u4f46\u9ad8\u5e74\u5316\u91d1\u5e93\u5f80\u5f80\u4e0a\u7ebf\u4e0d\u4e45\u3001TVL \u5c0f\uff0c\u66f4\u5bb9\u6613\u843d\u5728\u5371\u9669\u533a\u3002\"}}]}<\/script><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u91d1\u5e93\u9875\u9762\u5199\u7740\u201c\u5b58\u5165 10,000 USDC\uff0c\u5e74\u5316 6%\u201d\uff0c\u4f46\u51b3\u5b9a\u4f60\u5230\u624b\u4efd\u989d\u7684\u4e0d\u662f\u5e74\u5316\uff0c\u800c\u662f\u4e00\u884c\u9664\u6cd5\uff1a\u4efd\u989d =  &#8230; <a title=\"\u4efd\u989d\u662f\u4e00\u884c\u9664\u6cd5\uff1aERC-4626 \u91d1\u5e93\u600e\u4e48\u88ab\u4e00\u7b14\u8f6c\u8d26\u638f\u7a7a\" class=\"read-more\" href=\"https:\/\/lezoo6.com\/index.php\/news\/daily\/erc4626-share-inflation-attack\/\" aria-label=\"\u9605\u8bfb \u4efd\u989d\u662f\u4e00\u884c\u9664\u6cd5\uff1aERC-4626 \u91d1\u5e93\u600e\u4e48\u88ab\u4e00\u7b14\u8f6c\u8d26\u638f\u7a7a\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":857,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_forum_subforum_count":0,"footnotes":""},"class_list":["post-1453","page","type-page","status-publish"],"_links":{"self":[{"href":"https:\/\/lezoo6.com\/index.php\/wp-json\/wp\/v2\/pages\/1453","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lezoo6.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/lezoo6.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/lezoo6.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lezoo6.com\/index.php\/wp-json\/wp\/v2\/comments?post=1453"}],"version-history":[{"count":0,"href":"https:\/\/lezoo6.com\/index.php\/wp-json\/wp\/v2\/pages\/1453\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/lezoo6.com\/index.php\/wp-json\/wp\/v2\/pages\/857"}],"wp:attachment":[{"href":"https:\/\/lezoo6.com\/index.php\/wp-json\/wp\/v2\/media?parent=1453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}