Baja

Vyper's `slice()` may elide side-effects when output length is 0

  • Publicada: 16.05.2025
  • Actualizado: 11.10.2026 13:19

Impact

the slice() builtin can elide side effects when the output length is 0, and the source bytestring is a builtin (msg.data or <address>.code). the reason is that for these source locations, the check that length >= 1 is skipped: https://github.com/vyperlang/vyper/blob/68b68c4b30c5ef2f312b4674676170b8a6eaa316/vyper/builtins/functions.py#L315-L319

the result is that a 0-length bytestring constructed with slice can be passed to make_byte_array_copier, which elides evaluation of its source argument when the max length is 0: https://github.com/vyperlang/vyper/blob/68b68c4b30c5ef2f312b4674676170b8a6eaa316/vyper/codegen/core.py#L189-L191

the impact is that side effects in the start argument may be elided when the length argument is 0, e.g. slice(msg.data, self.do_side_effect(), 0).

the following example illustrates how the issue would look in user code

vyper
counter: public(uint256)

@external
def test() -> Bytes[10]:
    b: Bytes[10] = slice(msg.data, self.side_effect(), 0)
    return b

def side_effect() -> uint256:
    self.counter += 1
    return 0

the severity assigned is low, since this is not a very useful pattern and unlikely to be found in user code.

Patches

the fix is tracked in https://github.com/vyperlang/vyper/pull/4645, which disallows any invocation of slice() with length 0, including for the ad hoc locations discussed in this advisory.

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.4.2rc1 sin corrección

Referencias

Puntuación CVSS -
Vector CVSS
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N/E:P
Debilidad (CWE)
CWE-691
Plataforma
Python (PyPI)
Paquete
vyper
Publicada
16.05.2025
Actualizado
11.10.2026 13:19

Fuentes y licencias

OSV / GitHub Advisory Database - PYSEC-2026-2028 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-3vcg-j39x-cwfm - 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. Vyper's `slice()` may elide side-effects when output length is 0 esta entrada
    Baja CVE-2025-47774 <= 0.4.2rc1 sin corrección
  2. Crítica · 9.8 CVE-2024-24563 < 0.4.0 0.4.0
  3. Crítica · 9.8 CVE-2024-24561 < 0.4.0 0.4.0
  4. Alta · 7.3 CVE-2024-22419 >= 0.3.0, < 0.4.0 0.4.0
  5. Alta · 7.5 CVE-2023-46247 < 0.3.8 0.3.8
  6. Alta · 8.1 CVE-2023-42443 >= 0.3.4, < 0.3.10 0.3.10
  7. Crítica · 8.7 CVE-2023-39363 >= 0.2.15, < 0.3.1 0.3.1
  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.