Media

ecrecover can return undefined data if signature does not verify

  • Publicada: 25.07.2023
  • Actualizado: 11.10.2026 11:20

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.DOMAIN_SEPARATOR,
            keccak256(_abi_encode(PERMIT_TYPEHASH, _owner, _spender, _value, nonce, _deadline))
        )         
    )             
    assert ecrecover(digest, convert(_v, uint256), convert(_r, uint256), convert(_s, uint256)) == _owner

in this case, the immutable PERMIT_TYPEHASH 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 PERMIT_TYPEHASH. in this case, since PERMIT_TYPEHASH 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?

Software afectado

Haz clic en una tecnología para ver todas sus vulnerabilidades.

PlataformaPaqueteVersiones vulnerablesCorregida en
Python (PyPI) vyper < 0.3.10 0.3.10

Referencias

Puntuación CVSS 5.3/10
Vector CVSS
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
Debilidad (CWE)
CWE-252
Plataforma
Python (PyPI)
Paquete
vyper
Publicada
25.07.2023
Actualizado
11.10.2026 11:20

Fuentes y licencias

OSV / GitHub Advisory Database - PYSEC-2023-133 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-f5x6-7qgp-jhf3 - CC BY 4.0

Historial de vulnerabilidades: vyper

Todas las vulnerabilidades publicadas de este paquete (Python (PyPI)), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.

Todas (47) en el archivo
Entradas en total
47
Primera → última
03.2020 10.2026
Sin corrección
5
Explotada en ataques
0

Distribución por gravedad

  • Crítica 3
  • Alta 14
  • Media 20
  • Baja 10

Divulgaciones por año

  1. 2020: 1
  2. 2021: 5
  3. 2022: 4
  4. 2023: 14
  5. 2024: 14
  6. 2025: 6
  7. 2026: 3
Gravedad:
  1. Crítica · 9.8 CVE-2024-24563 < 0.4.0 0.4.0
  2. Crítica · 9.8 CVE-2024-24561 < 0.4.0 0.4.0
  3. Alta · 7.3 CVE-2024-22419 >= 0.3.0, < 0.4.0 0.4.0
  4. Alta · 7.5 CVE-2023-46247 < 0.3.8 0.3.8
  5. Alta · 8.1 CVE-2023-42443 >= 0.3.4, < 0.3.10 0.3.10
  6. Crítica · 8.7 CVE-2023-39363 >= 0.2.15, < 0.3.1 0.3.1
  7. ecrecover can return undefined data if signature does not verify esta entrada
    Media · 5.3 CVE-2023-37902 < 0.3.10 0.3.10
  8. Alta · 7.5 CVE-2023-32058 < 0.3.8 0.3.8
  9. Alta · 7.5 CVE-2023-30837 < 0.3.8 0.3.8
  10. Alta · 7.5 CVE-2023-30629 >= 0.3.1, < 0.3.8 0.3.8
  11. Alta · 7.5 CVE-2022-29255 < 0.3.4 0.3.4
  12. Alta · 7.1 CVE-2022-24788 < 0.3.2 0.3.2
  13. Alta · 7.5 CVE-2022-24787 < 0.3.2 0.3.2
  14. Alta ghsa-7f92-rr6w-cq64 >= 0.2.13, < 0.2.15 0.2.15

Identifica las vulnerabilidades de tu aplicación

Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.

Conectar tu aplicación
Newsletter DockRay

La seguridad de tus aplicaciones en tu correo

Vulnerabilidades importantes, recomendaciones concretas y consejos prácticos para tus aplicaciones. Elige tus tecnologías y sigue lo que importa para tu proyecto.

  • Un resumen diario de nuevas vulnerabilidades, también las críticas.
  • Avisos sobre actualizaciones importantes.
  • Consejos prácticos sobre seguridad y monitorización de aplicaciones.

Déjalo vacío para recibir avisos de todas las tecnologías.

Suscripción gratuita. Date de baja con un clic en cualquier correo.