Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

DHCP server unbounded option parsing - OOB read from packet buffer

Abierto
#11,323 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Tranquilo
Stack tecnológico
c

Línea de trabajo

Empieza en components/net/lwip-dhcpd/dhcp_server.c, en la línea 346, y sigue cómo se representan la longitud del paquete recibido y la posición de la opción. Compila el servidor DHCP con AddressSanitizer y envía el paquete DHCP malformado descrito, incluidos los marcadores de fin ausentes y las longitudes de opción excesivas. El trabajo está terminado cuando las opciones malformadas ya no provocan lecturas más allá del búfer del paquete.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

RT-Thread Version

tested HEAD, commit 38c007af

Hardware Type/Architectures

independent (Bug is in lwip-dhcpd C implementation)

Develop Toolchain

Other

Describe the bug
Summary

A buffer over-read vulnerability exists in RT-Thread's DHCP server implementation (components/net/lwip-dhcpd/dhcp_server.c) where the DHCP option parsing loop has no bounds check on the input buffer position, allowing a crafted DHCP packet to read past the allocated buffer.

Details

File: components/net/lwip-dhcpd/dhcp_server.c, line 346

The DHCP options parsing loop uses while(finished == 0) to iterate through options in the received packet. The loop reads option type and length fields from the packet data but does NOT check whether the current read position exceeds the packet buffer boundary.

/* dhcp_server.c:346 */
while(finished == 0) {
    /* reads option type and length from packet data */
    /* NO check that position < packet_length */
}

Since DHCP packets are received over the network with no authentication, this is reachable pre-authentication on the local network segment.

PoC

Send a crafted DHCP packet on the local network segment with:

  • Valid DHCP header (op=1, htype=1, hlen=6)
  • Options section containing a chain of options where each option's length field points past the end of the packet
  • No DHCP_OPTION_END (0xFF) marker

The server's option parsing loop will read past the packet buffer boundary until it hits unmapped memory (crash) or reads adjacent heap data (info leak).

Build and run the RT-Thread DHCP server component with AddressSanitizer enabled to observe the over-read:

# Cross-compile RT-Thread with ASAN, enable lwip-dhcpd,
# send crafted DHCP DISCOVER on the local interface
Other additional context
Impact
  • Out-of-bounds read from the packet buffer
  • Potential information disclosure from adjacent heap memory
  • Potential crash (DoS) if reading into unmapped memory
  • Affects any RT-Thread device running the built-in DHCP server
  • Attack vector: adjacent network (DHCP is link-local), no authentication required

Suggested fix:

- while(finished == 0) {
+ while(finished == 0 && position < packet_length) {

Also validate that position + option_length does not exceed packet_length before reading option data.

Lenguaje dominante
C
Estrellas
12.3k
Forks
5.5k
Merge medio
4 d 12 h
PR fusionados (30 d)
32

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de RT-Thread/rt-thread

Todos los issues de RT-Thread/rt-thread

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.