VYPR
High severity7.5NVD Advisory· Published May 4, 2026· Updated May 11, 2026

CVE-2026-37461

CVE-2026-37461

Description

An out-of-bounds read in the ParseIP6Extended function (/bgp/bgp.go) of gobgp v4.3.0 allows attackers to cause a Denial of Service (DoS) via supplying a crafted BGP UPDATE message.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
github.com/osrg/gobgp/v4Go
< 4.4.04.4.0

Affected products

1

Patches

2
9ce8936672eb

packet/bgp: fix uint16 underflow in BGPUpdate.DecodeFromBytes

https://github.com/osrg/gobgpFUJITA TomonoriMar 12, 2026via ghsa
2 files changed · +57 2
  • pkg/packet/bgp/bgp.go+15 2 modified
    @@ -15703,7 +15703,11 @@ func (msg *BGPUpdate) DecodeFromBytes(data []byte, options ...*MarshallingOption
     		if err != nil {
     			return err
     		}
    -		routelen -= uint16(w.Len(options...) + addpathLen)
    +		wLen := uint16(w.Len(options...) + addpathLen)
    +		if wLen > routelen {
    +			return NewMessageError(eCode, eSubCode, nil, "Withdrawn route length exceeds withdrawn routes boundary")
    +		}
    +		routelen -= wLen
     		if len(data) < w.Len(options...) {
     			return NewMessageError(eCode, eSubCode, nil, "Withdrawn route length is short")
     		}
    @@ -15758,7 +15762,16 @@ func (msg *BGPUpdate) DecodeFromBytes(data []byte, options ...*MarshallingOption
     				strongestError = e
     			}
     		}
    -		pathlen -= uint16(p.Len(options...))
    +		pLen := uint16(p.Len(options...))
    +		if pLen > pathlen {
    +			e = NewMessageErrorWithErrorHandling(
    +				eCode, BGP_ERROR_SUB_ATTRIBUTE_LENGTH_ERROR, data, ERROR_HANDLING_TREAT_AS_WITHDRAW, nil, "path attribute length exceeds path attributes boundary")
    +			if e.(*MessageError).Stronger(strongestError) {
    +				strongestError = e
    +			}
    +			return strongestError
    +		}
    +		pathlen -= pLen
     		if len(data) < p.Len(options...) {
     			e = NewMessageErrorWithErrorHandling(
     				eCode, BGP_ERROR_SUB_ATTRIBUTE_LENGTH_ERROR, data, ERROR_HANDLING_TREAT_AS_WITHDRAW, nil, "attribute length is short")
    
  • pkg/packet/bgp/bgp_test.go+42 0 modified
    @@ -1470,6 +1470,48 @@ func TestParseBogusShortData(t *testing.T) {
     	}
     }
     
    +func TestUpdateWithdrawnRouteUnderflow(t *testing.T) {
    +	// WithdrawnRoutesLen is 2, but the /32 prefix requires 5 bytes.
    +	// Without an underflow guard, routelen wraps from 2 to 65533 and the
    +	// loop silently consumes the entire remaining buffer as withdrawn
    +	// routes, returning no error (silent data corruption).
    +	const underflowed = 65533 // uint16(2 - 5)
    +	buf := make([]byte, 2+5+underflowed+2)
    +	buf[0], buf[1] = 0x00, 0x02                  // WithdrawnRoutesLen = 2
    +	buf[2] = 0x20                                // /32 prefix length
    +	buf[3], buf[4], buf[5], buf[6] = 10, 0, 0, 1 // 10.0.0.1
    +	// bytes 7..65539: zeros, decoded as 65533 /0 prefixes
    +	// bytes 65540..65541: TotalPathAttributeLen = 0
    +
    +	u := &BGPUpdate{}
    +	err := u.DecodeFromBytes(buf)
    +	require.Error(t, err)
    +}
    +
    +func TestUpdatePathAttrLenUnderflow(t *testing.T) {
    +	// TotalPathAttributeLen is 3, but the ORIGIN attribute is 4 bytes.
    +	// Without an underflow guard, pathlen wraps from 3 to 65535 and the
    +	// loop silently consumes the filler bytes as path attributes,
    +	// returning no error (silent data corruption).
    +	// 65535 is divisible by 3 (filler attr size), so the loop exits
    +	// cleanly with pathlen=0 instead of hitting the pathlen<3 guard.
    +	const underflowed = 65535 // uint16(3 - 4)
    +	const fillerAttrLen = 3
    +	buf := make([]byte, 2+2+4+underflowed)
    +	buf[0], buf[1] = 0x00, 0x00                             // WithdrawnRoutesLen = 0
    +	buf[2], buf[3] = 0x00, 0x03                             // TotalPathAttributeLen = 3
    +	buf[4], buf[5], buf[6], buf[7] = 0x40, 0x01, 0x01, 0x00 // ORIGIN(IGP)
    +	for i := 8; i+2 < len(buf); i += fillerAttrLen {
    +		buf[i] = 0xc0   // flags: optional + transitive
    +		buf[i+1] = 0xff // type: unknown
    +		buf[i+2] = 0x00 // length: 0
    +	}
    +
    +	u := &BGPUpdate{}
    +	err := u.DecodeFromBytes(buf)
    +	require.Error(t, err)
    +}
    +
     func TestFuzzCrashers(t *testing.T) {
     	crashers := []string{
     		"000000000000000000\x01",
    
362cce3e325f

packet/bgp: fix insufficient length check in ParseIP6Extended

https://github.com/osrg/gobgpFUJITA TomonoriMar 12, 2026via ghsa
1 file changed · +1 1
  • pkg/packet/bgp/bgp.go+1 1 modified
    @@ -15084,7 +15084,7 @@ type PathAttributeIP6ExtendedCommunities struct {
     }
     
     func ParseIP6Extended(data []byte) (ExtendedCommunityInterface, error) {
    -	if len(data) < 8 {
    +	if len(data) < 20 {
     		return nil, NewMessageError(BGP_ERROR_UPDATE_MESSAGE_ERROR, BGP_ERROR_SUB_MALFORMED_ATTRIBUTE_LIST, nil, "not all extended community bytes are available")
     	}
     	attrType := ExtendedCommunityAttrType(data[0])
    

Vulnerability mechanics

AI mechanics synthesis has not run for this CVE yet.

References

5

News mentions

0

No linked articles in our index yet.