Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

DHCP server unbounded option parsing - OOB read from packet buffer

Geschlossen
#11,323 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@cms19859230182-lang arbeitet bereits daran.

Seit 08.10.2026.

  • #11858 von @cms19859230182-lang — offen

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
68/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Ruhig
Tech-Stack
c

Rechercherichtung

Beginne in components/net/lwip-dhcpd/dhcp_server.c bei Zeile 346 und verfolge, wie die Länge des empfangenen Pakets und die Optionsposition dargestellt werden. Baue den DHCP-Server mit AddressSanitizer und sende das beschriebene fehlerhafte DHCP-Paket, einschließlich fehlender Endmarkierungen und übergroßer Optionslängen. Das Ziel ist erreicht, wenn fehlerhafte Optionen nicht mehr zu Lesezugriffen außerhalb des Paketpuffers führen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
C
Sterne
12.3k
Forks
5.5k
Ø Merge
7 T. 22 Std.
Gemergte PRs (30 T.)
30

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus RT-Thread/rt-thread

Alle Issues in RT-Thread/rt-thread

Ähnliche Issues

Weitere Issues zu C

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.