Nov 24, 2026·12 min read·4 visits
An adjacent network attacker can crash Go applications using github.com/insomniacslk/dhcp/dhcpv4/nclient4 by sending a single malformed IPv4 packet declaring a payload length under 8 bytes, resulting in a negative slice index and an uncaught Go runtime panic in BroadcastRawUDPConn.ReadFrom.
A denial-of-service vulnerability exists in the Go library github.com/insomniacslk/dhcp within the dhcpv4/nclient4 subpackage. In affected versions, the raw packet parsing function BroadcastRawUDPConn.ReadFrom subtracts the fixed 8-byte UDP header length from the IPv4 payload length declared in the packet header without first verifying that the declared payload length is at least 8 bytes. An unauthenticated attacker on an adjacent local network segment can broadcast or unicast a malformed IPv4 packet with a declared payload length between 0 and 7 bytes, causing a signed integer underflow that passes a negative slice bound into buf.Consume and triggers an unhandled Go runtime panic.
The Go package github.com/insomniacslk/dhcp provides client and server implementations for the DHCPv4 and DHCPv6 protocols. It is commonly integrated into network bootloaders (such as LinuxBoot and SystemBoot), bare-metal provisioning agents, container networking plugins, and embedded system utilities written in Go. Within this library, the github.com/insomniacslk/dhcp/dhcpv4/nclient4 subpackage implements a lightweight DHCPv4 client designed to acquire IP configurations over local network interfaces.
Because a DHCPv4 client must receive DHCP Offer and ACK broadcast messages before the host network interface has an assigned IPv4 address, nclient4 utilizes a raw socket listener implemented by the BroadcastRawUDPConn type. Unlike standard OS-managed UDP sockets where the kernel network stack validates and strips Layer 3 (IPv4) and Layer 4 (UDP) headers before delivering the payload to user space, BroadcastRawUDPConn ingests raw IPv4 packets directly from the interface and manually parses the IPv4 and UDP headers inside the ReadFrom method in dhcpv4/nclient4/conn_unix.go.
Tracked as GHSA-jp3c-6v3g-mpxv and GO-2026-6237, a flaw in BroadcastRawUDPConn.ReadFrom fails to validate that the IPv4 payload length declared in the packet header is large enough to contain an 8-byte UDP header before subtracting the UDP header length (8) to determine the DHCP payload size. This improper boundary check maps to CWE-191 (Integer Underflow / Decrement Upon Subtraction) and CWE-129 (Improper Validation of Array Index).
When BroadcastRawUDPConn.ReadFrom processes an inbound IPv4 packet whose header declares a payload length between 0 and 7 bytes, the subtraction produces a negative integer (-8 to -1). Passing this negative length into the internal packet buffer consumer (buf.Consume) violates Go slice bounds rules and triggers an immediate, uncaught runtime panic (runtime error: slice bounds out of range), terminating the entire Go process.
The root cause of GHSA-jp3c-6v3g-mpxv resides in how BroadcastRawUDPConn.ReadFrom trusts the untrusted Total Length field inside an inbound IPv4 header when calculating the length of the encapsulated DHCPv4 payload. In an IPv4 header, the 16-bit Total Length field (bytes 2 and 3) specifies the combined length of the IPv4 header and its data payload in bytes. Meanwhile, the 4-bit Internet Header Length (IHL, lower nibble of byte 0) specifies the length of the IPv4 header in 32-bit words (a minimum of 5 words, or 20 bytes).
During packet reception in dhcpv4/nclient4/conn_unix.go, the parser wraps the raw byte slice in a buffer helper (buf) and extracts the IPv4 header (ipHdr). The helper method ipHdr.payloadLength() computes the declared IPv4 payload size by subtracting the IPv4 header length (IHL * 4) from the IPv4 Total Length field. In a valid UDP-over-IPv4 packet, this value must be at least 8 bytes to accommodate the mandatory 8-byte UDP header (Source Port, Destination Port, Length, and Checksum).
Prior to the patch, BroadcastRawUDPConn.ReadFrom verified that the physical buffer still contained at least 8 bytes (if !buf.Has(udpHdrLen)), and then parsed the 8 bytes following the IPv4 header as a UDP header. However, it never checked whether ipHdr.payloadLength()—the logical payload length declared in the IPv4 header—was greater than or equal to udpHdrLen (8).
Immediately after verifying the UDP source and destination ports, the function attempted to strip any trailing Layer 2 Ethernet padding by calculating the exact DHCP payload length from the IPv4 header:
dhcpLen := int(ipHdr.payloadLength()) - udpHdrLen
return copy(b, buf.Consume(dhcpLen)), srcAddr, nilIf an incoming packet has a standard 20-byte IPv4 header (IHL = 5) and sets the IPv4 Total Length field to any value between 20 and 27, ipHdr.payloadLength() returns a value between 0 and 7. Subtracting udpHdrLen (8) yields a negative signed int between -8 and -1. Furthermore, because Ethernet frames have a minimum payload size of 46 bytes (often padded with zeros by the network interface card) or an attacker can intentionally append trailing bytes after the IPv4 header, the physical buffer check buf.Has(udpHdrLen) passes even when the IPv4 Total Length header field declares 0 payload bytes.
When buf.Consume(dhcpLen) is called with a negative argument, the underlying buffer method attempts to slice its internal byte array using the negative index as an upper bound (b[:n]). The Go runtime enforces strict slice bounds checks and immediately aborts execution with an unrecoverable slice bounds panic unless explicitly caught by a recover() handler in the calling goroutine. Additionally, a secondary bug existed on the same line: if an IPv4 header declared a large Total Length that exceeded the actual number of bytes received in buf, buf.Consume(dhcpLen) was called without checking buf.Has(dhcpLen), which also triggered an out-of-bounds slice panic on truncated frames.
The vulnerability is isolated to dhcpv4/nclient4/conn_unix.go, which is compiled on Unix-like operating systems (darwin, freebsd, linux, netbsd, openbsd, and dragonfly). In the vulnerable implementation of BroadcastRawUDPConn.ReadFrom, the receive loop iterates over raw packets read from upc.PacketConn until a matching UDP packet addressed to the bound DHCP client port is found.
Below is the vulnerable code path prior to commit c76316d4aa825673b208730779843d0711021e81:
// Vulnerable code in dhcpv4/nclient4/conn_unix.go
func (upc *BroadcastRawUDPConn) ReadFrom(b []byte) (int, net.Addr, error) {
for {
// ... [Raw packet read into buf and IPv4 header parsed into ipHdr] ...
// BUG 1: ipHdr.payloadLength() is not checked to be >= udpHdrLen (8).
// Even if the IPv4 header declares 0 bytes of payload, trailing physical
// bytes in the frame allow buf.Has(udpHdrLen) to succeed.
if !buf.Has(udpHdrLen) {
continue
}
udpHdr := udp(buf.Consume(udpHdrLen))
if udpHdr.destinationPort() != uint16(upc.boundAddr.Port) {
continue
}
if upc.boundAddr.IP != nil && !upc.boundAddr.IP.Equal( net.IPv4bcast) && !ipHdr.destinationAddress().Equal(upc.boundAddr.IP) {
continue
}
srcAddr := &net.UDPAddr{
IP: ipHdr.sourceAddress(),
Port: int(udpHdr.sourcePort()),
}
// Extra padding after end of IP packet should be ignored,
// if not dhcp option parsing will fail.
// BUG 2: If ipHdr.payloadLength() < 8, dhcpLen becomes negative (-8..-1),
// and if dhcpLen > remaining buffer bytes, buf.Consume panics as well.
dhcpLen := int(ipHdr.payloadLength()) - udpHdrLen
return copy(b, buf.Consume(dhcpLen)), srcAddr, nil
}
}The upstream fix in Pull Request #583 (commit c76316d4aa825673b208730779843d0711021e81) resolves both conditions by validating the declared IPv4 payload length before parsing the UDP header and verifying physical buffer availability before consuming the DHCP payload:
diff --git a/dhcpv4/nclient4/conn_unix.go b/dhcpv4/nclient4/conn_unix.go
index f3e48c66e..51b93e6af 100644
--- a/dhcpv4/nclient4/conn_unix.go
+++ b/dhcpv4/nclient4/conn_unix.go
@@ -111,6 +111,14 @@ func (upc *BroadcastRawUDPConn) ReadFrom(b []byte) (int, net.Addr, error) {
continue
}
+ // The IPv4 payload must be large enough to hold a UDP header. Discarding
+ // frames that declare fewer bytes keeps the DHCP length computed below
+ // non-negative and avoids parsing trailing padding as a UDP header.
+ ipPayloadLen := int(ipHdr.payloadLength())
+ if ipPayloadLen < udpHdrLen {
+ continue
+ }
+
if !buf.Has(udpHdrLen) {
continue
}
@@ -128,9 +136,12 @@ func (upc *BroadcastRawUDPConn) ReadFrom(b []byte) (int, net.Addr, error) {
IP: ipHdr.sourceAddress(),
Port: int(udpHdr.sourcePort()),
}
- // Extra padding after end of IP packet should be ignored,
- // if not dhcp option parsing will fail.
- dhcpLen := int(ipHdr.payloadLength()) - udpHdrLen
+ // Extra padding after the end of the IP payload is ignored; otherwise
+ // dhcp option parsing would fail.
+ dhcpLen := ipPayloadLen - udpHdrLen
+ if !buf.Has(dhcpLen) {
+ continue
+ }
return copy(b, buf.Consume(dhcpLen)), srcAddr, nil
}
}The patch in commit c76316d4aa825673b208730779843d0711021e81 is complete with respect to slice boundary invariants in BroadcastRawUDPConn.ReadFrom. By enforcing ipPayloadLen >= udpHdrLen (8) up front, the computed dhcpLen := ipPayloadLen - udpHdrLen is guaranteed to be greater than or equal to 0. Moreover, adding if !buf.Has(dhcpLen) { continue } directly before buf.Consume(dhcpLen) ensures that an inflated IPv4 Total Length field (where dhcpLen exceeds the remaining bytes in buf) cannot trigger an upper-bound slice panic (slice bounds out of range [:dhcpLen]). Malformed frames are silently skipped via continue, keeping the receive loop active for subsequent valid packets.
Exploiting GHSA-jp3c-6v3g-mpxv requires no authentication, no cryptographic material, and no prior interaction with the target host. Because BroadcastRawUDPConn binds to a raw network interface to receive Layer 2 broadcast traffic during DHCPv4 discovery and lease acquisition, any adversary or compromised host situated on the same Layer 2 broadcast domain (local subnet or VLAN) can reach the vulnerable parser.
To trigger the panic over the network, an attacker constructs and transmits a single 28-byte IPv4/UDP packet encapsulated in an Ethernet frame:
ff:ff:ff:ff:ff:ff) or the target host's unicast MAC address, and the EtherType to IPv4 (0x0800).Version / IHL): Set to 0x45 (IPv4, header length 5 words = 20 bytes).Total Length): Set to any integer in the range 20 (0x0014) through 27 (0x001b). Setting 20 declares 0 bytes of IPv4 payload (dhcpLen = -8); setting 27 declares 7 bytes of IPv4 payload (dhcpLen = -1).Protocol): Set to 17 (0x11, UDP), so the packet passes the IPv4 protocol check.Destination IP): Set to 255.255.255.255 (or the bound IP of the client if configured).Total Length field claims the packet ends at byte 20..27, append an 8-byte UDP header structure at offset 20..28 so buf.Has(8) succeeds and the port filter (udpHdr.destinationPort() == 68) matches the listening DHCP client port.The upstream commit includes a unit test in dhcpv4/nclient4/conn_unix_test.go that constructs this exact packet layout to reproduce the crash and verify the fix:
// frame builds an IPv4+UDP frame. ipTotalLen is written into the IPv4
// total-length field; dhcp is placed after the UDP header.
func frame(ipTotalLen int, dhcp []byte) []byte {
pkt := make([]byte, 28+len(dhcp))
pkt[0] = 0x45 // IPv4, IHL 5 -> header length 20
binary.BigEndian.PutUint16(pkt[2:], uint16(ipTotalLen))
pkt[8] = 64 // TTL
pkt[9] = byte(udpProtocolNumber)
copy(pkt[12:16], []byte{1, 2, 3, 4}) // source address
copy(pkt[16:20], []byte{255, 255, 255, 255})
binary.BigEndian.PutUint16(pkt[20:], 67) // UDP source port
binary.BigEndian.PutUint16(pkt[22:], 68) // UDP dest port (matches boundAddr)
binary.BigEndian.PutUint16(pkt[24:], uint16(8+len(dhcp)))
copy(pkt[28:], dhcp)
return pkt
}> [!NOTE]
> In nclient4/client.go, Client.readLoop() runs BroadcastRawUDPConn.ReadFrom inside a dedicated background goroutine (go c.readLoop()) without a defer recover() block. In Go, an unhandled panic in any goroutine immediately crashes the entire runtime process, not just the receiving goroutine.
The primary security impact of GHSA-jp3c-6v3g-mpxv is a complete denial of service (DoS) of the Go application utilizing github.com/insomniacslk/dhcp/dhcpv4/nclient4. Because Go's runtime terminates the process upon an uncaught slice bounds panic in any spawned goroutine, a single malformed packet on the local network segment causes the affected daemon, provisioning agent, or network bootloader to exit immediately.
In environments where nclient4 is embedded inside a monolithic agent or multi-service daemon (such as a bare-metal provisioning controller, an initramfs network boot client, or an embedded device management service), crashing the DHCP client goroutine brings down all co-located services sharing the same Go binary. If a single attacker on the Layer 2 broadcast domain periodically transmits the 28-byte broadcast frame (for example, once per second), any target system attempting to boot via network provisioning or renew its DHCPv4 lease will enter a continuous crash loop.
Under CVSS v3.1, the vulnerability scores 6.5 (Medium) with vector CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H. Under CVSS v4.0 (as assigned in the GitHub Advisory Database and Go Vulnerability Database), the vulnerability scores 7.1 (High) with vector CVSS:4.0/AV:A/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N. The Attack Vector is Adjacent (AV:A) because raw packets sent to BroadcastRawUDPConn operate on the local broadcast domain and cannot traverse standard IPv4 routers when addressed to 255.255.255.255 or carrying malformed IPv4 total lengths.
There is no Confidentiality (C:N) or Integrity (I:N) impact. Because Go checks slice boundaries at runtime before dereferencing memory, the negative index calculation results in a safe abort (panic) rather than an out-of-bounds memory read or memory corruption.
All applications and downstream libraries importing github.com/insomniacslk/dhcp/dhcpv4/nclient4 should upgrade github.com/insomniacslk/dhcp to pseudo-version v0.0.0-20260719225207-c76316d4aa82 (commit c76316d4aa825673b208730779843d0711021e81) or later.
To update the dependency in a Go module project and verify that the vulnerable symbol is no longer present:
go get github.com/insomniacslk/dhcp@c76316d4aa825673b208730779843d0711021e81
go mod tidy
govulncheck ./...In deployments where recompiling and redeploying the Go binary is not immediately feasible, operators can reduce exposure through the following compensating controls:
nclient4.BroadcastRawUDPConn (invoked by default on Unix via nclient4.NewRawUDPConn). If the network topology and use case only require unicast DHCP operations (or operate on platforms/configurations where NewBroadcastUDPConn using standard net.PacketConn is sufficient), configuring nclient4.NewWithConn with a standard kernel UDP socket delegates IPv4 and UDP header length validation to the OS kernel stack.67 -> 68) to client hosts.nftables / ebtables): Because raw sockets (AF_PACKET) intercept frames prior to standard iptables Layer 3 hooks, host-based filtering must be applied at the netdev ingress hook in nftables or via ebtables / tc on Linux to drop IPv4 frames where the IPv4 Total Length is less than 28 bytes on UDP protocol 17.CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
github.com/insomniacslk/dhcp/dhcpv4/nclient4 insomniacslk | >= v0.0.0-20190522091526-5dce45b2b680, < v0.0.0-20260719225207-c76316d4aa82 | v0.0.0-20260719225207-c76316d4aa82 |
| Attribute | Detail |
|---|---|
| Advisory ID | GHSA-jp3c-6v3g-mpxv / GO-2026-6237 |
| CWE Classification | CWE-191 (Integer Underflow) / CWE-129 (Improper Validation of Array Index) |
| CVSS v3.1 / v4.0 | 6.5 Medium (v3.1) / 7.1 High (v4.0) |
| Attack Vector | Adjacent Network (Layer 2 Broadcast Domain, UDP Port 67 -> 68) |
| Affected Symbol | BroadcastRawUDPConn.ReadFrom (dhcpv4/nclient4) |
| Primary Impact | Denial of Service via Unhandled Go Runtime Slice Bounds Panic |
| Exploit Status | Proof-of-Concept (Unit test reproduction in upstream commit) |
| Patched Version | v0.0.0-20260719225207-c76316d4aa82 |
The product subtracts one value from another, such that the result is less than the minimum allowable integer value, which produces a value that is not equal to the correct result or violates downstream bounds assumptions.
CVE-2026-64855 (GHSA-859w-52fx-hcm6) is a cryptographic signature verification and authentication bypass vulnerability in the soapbar Python library prior to version 0.13.0. In vulnerable versions, the verify_envelope_bsp() function derives its trust anchor directly from the incoming SOAP message by extracting an untrusted X.509 certificate embedded inside the wsse:BinarySecurityToken header. Because the function checks only the temporal validity of the extracted certificate without performing Certificate Authority (CA) chain validation or certificate pinning, an unauthenticated network attacker can generate a self-signed certificate, sign an arbitrary SOAP payload, and pass verification.
CVE-2026-63305 (GHSA-g9x9-q7qj-6mv5) is an operating system command injection vulnerability affecting WWBN AVideo (formerly YouPHPTube) versions up to and including 29.0. The defect resides in the standalone FFmpeg execution handler at plugin/API/standAlone/ffmpeg.json.php. When assembling asynchronous post-processing commands, the script concatenates the notifyCode and callback properties from a decrypted payload directly into a shell command string without sanitization. An attacker capable of providing or forging a valid encrypted execution payload can inject shell metacharacters to achieve remote code execution under the privileges of the web server user.
The cakephp/twig-view plugin integrates the Twig templating engine into the CakePHP framework. Prior to versions 1.3.3 and 2.1.2, the UtilsExtension class exposes PHP's native unserialize() function as a Twig filter without restricting allowed classes. When untrusted data is passed into the unserialize filter within a template, an attacker can trigger PHP Object Injection and execute Property-Oriented Programming (POP) gadget chains, leading to arbitrary code execution or data manipulation.
CVE-2026-63402 is a prototype-chain traversal and shared built-in object corruption vulnerability in the i18next internationalization framework for JavaScript prior to version 26.3.4. The flaw resides in the deepExtend utility function within src/utils.js, which uses the JavaScript 'in' operator to verify property existence on target objects. When an application passes untrusted resource bundles to i18next.addResourceBundle() with both the deep and overwrite parameters set to true, an attacker can traverse into inherited methods on Object.prototype and overwrite properties on shared built-in function objects, causing process-wide denial of service.
CVE-2026-58262 (tracked internally as KLR-04 and via GitHub Security Advisory GHSA-f9h7-4mmq-vgcq) is a cryptographic verification and consensus quorum bypass vulnerability in Klever-Go (`klever-io/klever-go`), the Go implementation of the Klever blockchain protocol. Prior to version 1.7.20, the block header signature verification logic (`HeaderSigVerifier.verifyConsensusSize`) counts all set bits across the entire `PubKeysBitmap` byte slice toward the required two-thirds validator quorum without masking or validating unused trailing padding bits in the final byte. Because the underlying Boneh-Lynn-Shacham (BLS) multi-signature verification function (`blsMultiSigner.Verify`) iterates strictly over the indices of configured validator public keys, it ignores any bits set at indices beyond the active consensus group size. When the consensus group size is not an exact multiple of 8, a compromised or malicious block producer can set these unused trailing padding bits to artificially inflate the apparent signer count by up to 7 signatures, enabling blocks with fewer genuine validator signatures than required by the protocol to pass consensus validation.
CVE-2026-77423 is a Regular Expression Denial of Service (ReDoS) vulnerability in the built-in less viewer of the JLine Java library (versions 3.0.0 prior to 3.30.15, and 4.0.0 prior to 4.3.1). The org.jline.builtins.Less class passes user-supplied search and display-filter patterns directly to Java's standard backtracking regular expression engine without complexity validation or execution timeouts. An attacker with access to an interactive JLine session can submit patterns containing nested quantifiers, causing catastrophic backtracking that consumes 100% of a CPU core and blocks the session thread indefinitely. In network-facing deployments such as SSH or Telnet administration consoles, repeated exploitation across concurrent sessions can exhaust bounded worker thread pools and result in a complete denial of service.