llamaCVEVulnerability Intelligence
/
Advisory · GitHub · PyPI · vyper

GHSA-4HWQ-4CPM-8VMX

Vyper's `extract32` can ready dirty memory

Parche disponible
Descargar PNG JSON
CVSS
—
low
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche a 115 d de la divulgación
Exposición997 dDesde la divulgación, 26 feb 2024, 3:11 p. m.
Detección994 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Modificada
Explotación
Remediación
Parche 0.4.0
Monitoreo
Detectada
26 feb 24
20 jun 24
10 jun 26
17 nov 26
20 nov 26
26 feb 24
2 nov 24
9 jul 25
15 mar 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-4HWQ-4CPM-8VMX divulgada
Remediación Parche 0.4.0 vyper · 115 d desde divulgación
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Summary

When using the built-in `extract32(b, start)`, if the `start` index provided has for side effect to update `b`, the byte array to extract `32` bytes from, it could be that some dirty memory is read and returned by `extract32`.

As of v0.4.0 (specifically, commit https://github.com/vyperlang/vyper/commit/3d9c537142fb99b2672f21e2057f5f202cde194f), the compiler will panic instead of generating bytecode.

Details

Before evaluating `start`, the function `Extract32.build_IR` caches only:

  • The pointer in memory/storage to `b`: https://github.com/vyperlang/vyper/blob/10564dcc37756f3d3684b7a91fd8f4325a38c4d8/vyper/builtins/functions.py#L916-L918
  • The length of `b`: https://github.com/vyperlang/vyper/blob/10564dcc37756f3d3684b7a91fd8f4325a38c4d8/vyper/builtins/functions.py#L920-L922

but do not cache the actual content of `b`. This means that if the evaluation of `start` changes `b`'s content and length, an outdated length will be used with the new content when extracting 32 bytes from `b`.

PoC

Calling the function `foo` of the following contract returns `b'uuuuuuuuuuuuuuuuuuuuuuuuuuu\x00\x00789'` meaning that `extract32` accessed some dirty memory.

var:Bytes[96]

@internal
def bar() -> uint256:
    self.var = b'uuuuuuuuuuuuuuuuuuuuuuuuuuuuuu'
    self.var = b''
    return 3

@external
def foo() -> bytes32:
    self.var = b'abcdefghijklmnopqrstuvwxyz123456789'
    return extract32(self.var, self.bar(), output_type=bytes32)
    # returns b'uuuuuuuuuuuuuuuuuuuuuuuuuuu\x00\x00789'
Impact

For contracts that are affected, it means that calling `extract32` returns dirty memory bytes instead of some expected output.

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Versiones

Rangos afectados

Afectada Corregida Última
vyper< 0.4.0
0.4.0
0.4.3
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
pypivyper
Corregida 0.4.0 115 d 0.4.3 no afectada
Versiones corregidas0.4.0
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://nvd.nist.gov/vuln/detail/CVE-2024-24564
Otrahttps://github.com/vyperlang/vyper/security/advisories/GHSA-4hwq-4cpm-8vmx
Otrahttps://github.com/vyperlang/vyper/commit/3d9c537142fb99b2672f21e2057f5f202cde194f
Otrahttps://github.com/pypa/advisory-database/tree/main/vulns/vyper/PYSEC-2024-205.yaml
Otrahttps://github.com/vyperlang/vyper
Otrahttps://github.com/vyperlang/vyper/blob/10564dcc37756f3d3684b7a91fd8f4325a38c4d8/vyper/builtins/functions.py#L916-L918
Otrahttps://github.com/vyperlang/vyper/blob/10564dcc37756f3d3684b7a91fd8f4325a38c4d8/vyper/builtins/functions.py#L920-L922

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.