Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🐹
🐹 Go
Not in CISA KEV
MEDIUM severity

CVE-2026-49838

MEDIUM

CVE-2026-49838 is a medium-severity (CVSS 5.9) remote code execution vulnerability in github.com/osrg/gobgp/v4. O3 Security confirms whether CVE-2026-49838 is actually reachable in your code before you act, and blocks exploitation at runtime until you patch.

GoBGP confederation validation panics on empty AS_PATH attribute

Also known asGO-2026-5954
Published
Jul 9, 2026
Updated
Sep 10, 2026
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Sep 10, 2026 · OSV.dev, FIRST.org (EPSS)

Real-World Exposure

1 pkg affected
🐹github.com/osrg/gobgp/v4

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Go packages — download data is not available via public APIs for these ecosystems.

Description

Found through variant analysis based on CVE-2026-41643

Summary

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.

Affected

Root cause

An 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.

Reproduction

INT-bgp-gobgp-confed-empty-aspath-panic.zip

bash ./poc/run.sh
TRIGGERED: confed empty AS_PATH validation panic: runtime error: index out of range

The 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.

Impact

A 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.

Suggested fix

diff --git a/pkg/packet/bgp/validate.go b/pkg/packet/bgp/validate.go
index 2237afb..f07f4fa 100644
--- a/pkg/packet/bgp/validate.go
+++ b/pkg/packet/bgp/validate.go
@@ -159,6 +159,9 @@ func ValidateAttribute(a PathAttributeInterface, rfs map[Family]BGPAddPathMode,
 	case *PathAttributeAsPath:
 		if isEBGP {
 			if isConfed {
+				if len(p.Value) == 0 {
+					return false, NewMessageError(eCode, eSubCodeMalformedAspath, nil, "empty AS_PATH for confederation eBGP")
+				}
 				if segType := p.Value[0].GetType(); segType != BGP_ASPATH_ATTR_TYPE_CONFED_SEQ {
 					return false, NewMessageError(eCode, eSubCodeMalformedAspath, nil, fmt.Sprintf("segment type is not confederation seq (%d)", segType))
 				}

Resources

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
🐹Gogithub.com/osrg/gobgp/v4all versions4.7.0

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for github.com/osrg/gobgp/v4. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.

  2. Fix

    Update github.com/osrg/gobgp/v4 to 4.7.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-49838 is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 pinpoints whether CVE-2026-49838 is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.

Tailored to CVE-2026-49838. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

Found through variant analysis based on `CVE-2026-41643` ## Summary 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. ## Affected - Project: gobgp - Repo: https://github.com/osrg/gobgp - Pinned ref: c24629411ba49f160d9dc09126f418218127e016 ## Root cause An estab
O3 Security · Impact-Aware SCA

Is CVE-2026-49838 in your dependencies?

O3 detects CVE-2026-49838 across Go dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.

CVE-2026-49838: v4 Authentication Bypass… | O3 Security