CVE-2023-37902: Vyper's ecrecover can return undefined data if signature does not verify

Published Jul 25, 2023
·
Updated

Impact the ecrecover precompile does not fill the output buffer if the signature does not verify, see https://github.com/ethereum/go-ethereum/blob/b058cf454b3bdc7e770e2b3cec83a0bcb48f55ee/core/vm/contracts.go#L188. however, the ecrecover builtin will still return whatever is at memory location 0.

this means that the if the compiler has been convinced to write to the 0 memory location with specially crafted data (generally, this can happen with a hashmap access or immutable read) just before the ecrecover, a signature check might pass on an invalid signature.

A contract search was performed. Most uses of ecrecover are used for erc2612-style permit implementations, which typically look like:

vyper assert owner != empty(address) assert block.timestamp <= deadline nonce: uint256 = self.nonces[owner] digest: bytes32 = keccak256( concat( b"\x19\x01", self.DOMAINSEPARATOR, keccak256(abiencode(PERMITTYPEHASH, owner, spender, value, nonce, deadline)) ) ) assert ecrecover(digest, convert(v, uint256), convert(r, uint256), convert(s, uint256)) == owner

in this case, the immutable PERMITTYPEHASH is loaded into ecrecover's output buffer right before ecrecover(), and so the output of ecrecover() here when the signature is invalid will be the value of PERMITTYPEHASH. in this case, since PERMITTYPEHASH is not a valid address, it will never compare == to owner, and so the behaviour is exactly the same as if ecrecover() returned 0 in this case.

in general, a contract could have unexpected behavior (i.e. mistakenly pass this style of signature check) if an immutable representing a real address (ex. OWNER) was read right before the ecrecover operation.

Patches v0.3.10 (with 019a37ab98ff53f04fecfadf602b6cd5ac748f7f and #3586)

Workarounds Is there a way for users to fix or remediate the vulnerability without upgrading?

References Are there any links users can visit to find out more?

Other sources

Vyper is a Pythonic programming language that targets the Ethereum Virtual Machine (EVM). Prior to version 0.3.10, the ecrecover precompile does not fill the output buffer if the signature does not verify. However, the ecrecover builtin will still return whatever is at memory location 0. This means that the if the compiler has been convinced to write to the 0 memory location with specially crafted data (generally, this can happen with a hashmap access or immutable read) just before the ecrecover, a signature check might pass on an invalid signature. Version 0.3.10 contains a patch for this issue.

Affected Software

2 affected componentsFixes available
pip/vyper<0.3.10
0.3.10
vyperlang Vyper Python<0.3.9

Event History

Jul 25, 2023
Advisory Published
05:46 PM
CVE Published
via MITRE·08:05 PM
Data Sourced
via MITRE·08:05 PM
DescriptionSeverityWeakness
Data Sourced
09:15 PM
DescriptionWeakness
Data Sourced
via NVD·09:15 PM
RemedyDescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is CVE-2023-37902?

CVE-2023-37902 is a vulnerability found in the Vyper programming language that targets the Ethereum Virtual Machine (EVM).

2

What is the impact of CVE-2023-37902?

The impact of CVE-2023-37902 is that the ecrecover precompile does not fill the output buffer if the signature does not verify, potentially leading to unexpected behavior.

3

How can I fix CVE-2023-37902?

To fix CVE-2023-37902, update Vyper to version 0.3.10 or newer.

4

Where can I find more information about CVE-2023-37902?

You can find more information about CVE-2023-37902 in the Vyperlang Vyper GitHub repository and the NVD website.

5

What is the severity of CVE-2023-37902?

The severity of CVE-2023-37902 is medium with a CVSS score of 5.3.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203