From a5b99715e1c142c2c83d744a89b4d04a2c65ed50 Mon Sep 17 00:00:00 2001 From: "advisory-database[bot]" <45398580+advisory-database[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:05:38 +0000 Subject: [PATCH] Publish GHSA-5jrj-52x8-m64h --- .../2024/04/GHSA-5jrj-52x8-m64h/GHSA-5jrj-52x8-m64h.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/advisories/github-reviewed/2024/04/GHSA-5jrj-52x8-m64h/GHSA-5jrj-52x8-m64h.json b/advisories/github-reviewed/2024/04/GHSA-5jrj-52x8-m64h/GHSA-5jrj-52x8-m64h.json index 63fca4397b9..eb605e44003 100644 --- a/advisories/github-reviewed/2024/04/GHSA-5jrj-52x8-m64h/GHSA-5jrj-52x8-m64h.json +++ b/advisories/github-reviewed/2024/04/GHSA-5jrj-52x8-m64h/GHSA-5jrj-52x8-m64h.json @@ -1,13 +1,13 @@ { "schema_version": "1.4.0", "id": "GHSA-5jrj-52x8-m64h", - "modified": "2024-04-25T19:50:16Z", + "modified": "2024-06-18T15:04:13Z", "published": "2024-04-25T19:50:16Z", "aliases": [ "CVE-2024-32649" ], - "summary": "vyper performs double eval of the argument of sqrt", - "details": "### Summary\nUsing the `sqrt` builtin can result in multiple eval evaluation of side effects when the argument has side-effects. The bug is more difficult (but not impossible!) to trigger as of 0.3.4, when the unique symbol fence was introduced (https://github.com/vyperlang/vyper/pull/2914).\n\nA contract search was performed and no vulnerable contracts were found in production.\n\n### Details\nIt can be seen that the `build_IR` function of the `sqrt` builtin doesn't cache the argument to the stack: \nhttps://github.com/vyperlang/vyper/blob/4595938734d9988f8e46e8df38049ae0559abedb/vyper/builtins/functions.py#L2151\n\nAs such, it can be evaluated multiple times (instead of retrieving the value from the stack).\n\n### PoC\nWith at least Vyper version `0.2.15+commit.6e7dba7` the following contract:\n```vyper\nc: uint256\n\n@internal\ndef some_decimal() -> decimal:\n self.c += 1\n return 1.0\n\n@external\ndef foo() -> uint256:\n k: decimal = sqrt(self.some_decimal())\n return self.c\n```\npasses the following test:\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity >=0.8.13;\n\nimport \"../../lib/ds-test/test.sol\";\nimport \"../../lib/utils/Console.sol\";\nimport \"../../lib/utils/VyperDeployer.sol\";\n\nimport \"../ITest.sol\";\n\ncontract ConTest is DSTest {\n VyperDeployer vyperDeployer = new VyperDeployer();\n\n ITest t;\n\n function setUp() public {\n t = ITest(vyperDeployer.deployContract(\"Test\"));\n }\n\n function testFoo() public {\n uint256 val = t.foo();\n console.log(val);\n assert (val == 4);\n }\n}\n```\n \n\n### Impact\nNo vulnerable production contracts were found.", + "summary": "vyper performs multiple eval of `sqrt()` argument built in", + "details": "### Summary\nUsing the `sqrt` builtin can result in multiple eval evaluation of side effects when the argument has side-effects. The bug is more difficult (but not impossible!) to trigger as of 0.3.4, when the unique symbol fence was introduced (https://github.com/vyperlang/vyper/pull/2914).\n\nA contract search was performed and no vulnerable contracts were found in production.\n\n### Details\nIt can be seen that the `build_IR` function of the `sqrt` builtin doesn't cache the argument to the stack: \nhttps://github.com/vyperlang/vyper/blob/4595938734d9988f8e46e8df38049ae0559abedb/vyper/builtins/functions.py#L2151\n\nAs such, it can be evaluated multiple times (instead of retrieving the value from the stack).\n\n### PoC\nWith at least Vyper version `0.2.15+commit.6e7dba7` the following contract:\n```vyper\nc: uint256\n\n@internal\ndef some_decimal() -> decimal:\n self.c += 1\n return 1.0\n\n@external\ndef foo() -> uint256:\n k: decimal = sqrt(self.some_decimal())\n return self.c\n```\npasses the following test:\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity >=0.8.13;\n\nimport \"../../lib/ds-test/test.sol\";\nimport \"../../lib/utils/Console.sol\";\nimport \"../../lib/utils/VyperDeployer.sol\";\n\nimport \"../ITest.sol\";\n\ncontract ConTest is DSTest {\n VyperDeployer vyperDeployer = new VyperDeployer();\n\n ITest t;\n\n function setUp() public {\n t = ITest(vyperDeployer.deployContract(\"Test\"));\n }\n\n function testFoo() public {\n uint256 val = t.foo();\n console.log(val);\n assert (val == 4);\n }\n}\n```\n \n### Patches\nPatched in https://github.com/vyperlang/vyper/pull/3976.\n\n### Impact\nNo vulnerable production contracts were found.", "severity": [ { "type": "CVSS_V3", @@ -28,7 +28,7 @@ "introduced": "0" }, { - "last_affected": "0.3.10" + "fixed": "0.4.0" } ] }