{"id":"CVE-2026-49838","aliases":["CVE-2026-49838","GHSA-frrj-87jh-2772","GO-2026-5954"],"related":[],"kind":"vulnerability","state":"published","title":"GoBGP confederation validation panics on empty AS_PATH attribute","summary":"GoBGP is an open source Border Gateway Protocol (BGP) implementation in the Go Programming Language. Prior to version 4.7.0, GoBGP accepts a zero-length AS_PATH during UPDATE decoding and later panics while validating that attribute for a confederation eBGP peer. The vulnerable path is in the BGP UPDATE validator: a malformed UPDATE that should be rejected as a malformed AS_PATH instead reaches an unchecked `p.Value[0]` access, allowing a configured confederation eBGP peer to trigger a denial of service. Version 4.7.0 patches the issue.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"GoBGP is an open source Border Gateway Protocol (BGP) implementation in the Go Programming Language. Prior to version 4.7.0, GoBGP accepts a zero-length AS_PATH during UPDATE decoding and later panics while validating that attribute for a confederation eBGP peer. The vulnerable path is in the BGP UPDATE validator: a malformed UPDATE that should be rejected as a malformed AS_PATH instead reaches an unchecked `p.Value[0]` access, allowing a configured confederation eBGP peer to trigger a denial of service. Version 4.7.0 patches the issue.","source":"cvelist"},{"lang":"en","text":"Found through variant analysis based on `CVE-2026-41643`\n\n## Summary\nGoBGP accepts a zero-length AS_PATH during UPDATE decoding and later panics while validating that attribute for a confederation eBGP peer. The vulnerable path is in the BGP UPDATE validator: a malformed UPDATE that should be rejected as a malformed AS_PATH instead reaches an unchecked `p.Value[0]` access, allowing a configured confederation eBGP peer to trigger a denial of service.\n\n## Affected\n- Project: gobgp\n- Repo: https://github.com/osrg/gobgp\n- Pinned ref: c24629411ba49f160d9dc09126f418218127e016\n\n## Root cause\nAn established peer's receive path reads BGP bytes from the network connection in `pkg/server/fsm.go:1267`, parses UPDATE bodies through the BGP message decoder, and validates decoded UPDATEs with peer state at `pkg/server/fsm.go:1849`. The UPDATE decoder walks the path-attribute list in `pkg/packet/bgp/bgp.go:15773` and selects the concrete attribute parser from the attacker-controlled attribute type at `pkg/packet/bgp/bgp.go:15855`. For AS_PATH, `PathAttributeAsPath.DecodeFromBytes` returns nil when the decoded attribute length is zero (`pkg/packet/bgp/bgp.go:11533`, `pkg/packet/bgp/bgp.go:11538`), leaving `p.Value` empty rather than reporting a malformed attribute. Validation then dispatches each decoded attribute through `ValidateAttribute` (`pkg/packet/bgp/validate.go:34`); in the confederation eBGP branch, `pkg/packet/bgp/validate.go:162` indexes `p.Value[0]` before checking that any AS_PATH segment was decoded. The eBGP and confederation guards are normal peer-state gates: `pkg/config/oc/util.go:127` defines eBGP as peer AS differing from local AS, `pkg/config/oc/util.go:116` checks confederation membership, and `pkg/server/fsm.go:740` and `pkg/server/fsm.go:741` copy those results into the FSM state used by the validator.\n\n## Reproduction\n\n[INT-bgp-gobgp-confed-empty-aspath-panic.zip](https://github.com/user-attachments/files/28203698/INT-bgp-gobgp-confed-empty-aspath-panic.zip)\n\n```bash\nbash ./poc/run.sh\n```\n\n```text\nTRIGGERED: confed empty AS_PATH validation panic: runtime error: index out of range\n```\n\nThe `TRIGGERED` line is the recovered panic fingerprint from the confederation eBGP validation path after a zero-length AS_PATH has decoded successfully. A build failure or any output without that fingerprint would not demonstrate this bug, because the signal is tied to the unchecked AS_PATH segment access.\n\n## Impact\nA remote unauthenticated peer that is configured as a confederation eBGP neighbor can establish a BGP session and send a single malformed UPDATE containing a syntactically valid AS_PATH attribute header with zero value length. Because the decode path does not turn that empty AS_PATH into a `MessageError`, normal malformed-attribute handling is bypassed and validation panics before GoBGP can return a BGP NOTIFICATION. The demonstrated effect is denial of service for the receive goroutine and peer session, with potential process termination if the panic is not recovered by the runtime path; no memory corruption, data disclosure, authentication bypass, or code execution is claimed.\n\n## Suggested fix\n```001-fix.diff\ndiff --git a/pkg/packet/bgp/validate.go b/pkg/packet/bgp/validate.go\nindex 2237afb..f07f4fa 100644\n--- a/pkg/packet/bgp/validate.go\n+++ b/pkg/packet/bgp/validate.go\n@@ -159,6 +159,9 @@ func ValidateAttribute(a PathAttributeInterface, rfs map[Family]BGPAddPathMode,\n \tcase *PathAttributeAsPath:\n \t\tif isEBGP {\n \t\t\tif isConfed {\n+\t\t\t\tif len(p.Value) == 0 {\n+\t\t\t\t\treturn false, NewMessageError(eCode, eSubCodeMalformedAspath, nil, \"empty AS_PATH for confederation eBGP\")\n+\t\t\t\t}\n \t\t\t\tif segType := p.Value[0].GetType(); segType != BGP_ASPATH_ATTR_TYPE_CONFED_SEQ {\n \t\t\t\t\treturn false, NewMessageError(eCode, eSubCodeMalformedAspath, nil, fmt.Sprintf(\"segment type is not confederation seq (%d)\", segType))\n \t\t\t\t}\n```\n\n## Resources\n- https://github.com/osrg/gobgp/blob/c24629411ba49f160d9dc09126f418218127e016/pkg/packet/bgp/bgp.go#L11533-L11540\n- https://github.com/osrg/gobgp/blob/c24629411ba49f160d9dc09126f418218127e016/pkg/packet/bgp/validate.go#L159-L164","format":"markdown","source":"ghsa"},{"lang":"en","text":"GoBGP confederation validation panics on empty AS_PATH attribute in github.com/osrg/gobgp","format":"markdown","source":"go"}],"published":"2026-07-09T23:21:05.000Z","modified":"2026-09-16T13:42:46.970Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H","score":5.9,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H","score":5.9,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H","score":5.9,"rating":"MEDIUM"}],"cwes":["CWE-129"],"affected":[{"ranges":[{"version":"< 4.7.0","status":"affected"}],"vendor":"osrg","product":"gobgp","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"4.7.0"}],"ecosystem":"Go","package":"github.com/osrg/gobgp/v4","purl":"pkg:golang/github.com/osrg/gobgp/v4","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"4.7.0"}],"ecosystem":"Go","package":"github.com/osrg/gobgp/v4","purl":"pkg:golang/github.com/osrg/gobgp/v4","source":"go"}],"references":[{"url":"https://github.com/osrg/gobgp/security/advisories/GHSA-frrj-87jh-2772","tags":["advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/osrg/gobgp/commit/4a319a6c25630fb3cdbda3e9ccfe56e702bdaaa0","tags":["fix","x-refsource-misc"],"sources":["cvelist","go","nvd"]},{"url":"https://github.com/osrg/gobgp","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-09-11T16:31:55.831Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-49838","url":"https://www.cve.org/CVERecord?id=CVE-2026-49838","licence":"CVE Terms of Use","modified":"2026-09-11T20:31:16.420Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-frrj-87jh-2772","url":"https://github.com/advisories/GHSA-frrj-87jh-2772","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:51.948Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5954","url":"https://pkg.go.dev/vuln/GO-2026-5954","licence":"CC-BY-4.0","modified":"2026-07-24T19:00:28.029Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-49838","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-49838","licence":"Public domain","modified":"2026-09-16T13:42:46.970Z"}],"updatedAt":"2026-11-25T22:59:37.908Z","epss":{"score":0.00333,"percentile":0.2862,"date":"2026-12-01T12:00:22.000Z"}}