CVE-2026-5122 Overview
A security flaw has been discovered in osrg GoBGP up to version 4.3.0. This vulnerability affects the function DecodeFromBytes of the file pkg/packet/bgp/bgp.go of the component BGP OPEN Message Handler. Performing a manipulation of the argument domainNameLen results in improper access controls. The attack may be initiated remotely, though a high degree of complexity is needed for successful exploitation.
Critical Impact
Remote attackers can exploit improper validation of the domainNameLen parameter in BGP OPEN messages to bypass access controls in network routing infrastructure running GoBGP.
Affected Products
- osrg GoBGP up to version 4.3.0
- Systems utilizing the BGP OPEN Message Handler component
- Deployments using the FQDN capability in BGP sessions
Discovery Timeline
- 2026-03-30 - CVE-2026-5122 published to NVD
- 2026-04-01 - Last updated in NVD database
Technical Details for CVE-2026-5122
Vulnerability Analysis
This vulnerability is classified under CWE-266 (Incorrect Privilege Assignment) and affects the BGP OPEN message processing functionality in GoBGP. The flaw exists in the CapFQDN.DecodeFromBytes function within pkg/packet/bgp/bgp.go, where the domainNameLen parameter is not properly validated during packet parsing.
The vulnerability allows an attacker to manipulate the domainNameLen argument to read beyond the intended buffer boundaries when extracting the domain name from BGP capability data. While exploitation requires high complexity due to the nature of BGP protocol interactions and typical network architecture constraints, successful attacks could impact routing infrastructure integrity.
Root Cause
The root cause lies in improper bounds checking when parsing the FQDN (Fully Qualified Domain Name) capability in BGP OPEN messages. The original implementation ignored the domainNameLen field when extracting the domain name, instead reading all remaining bytes after the hostname. This oversight allowed attackers to potentially access memory beyond the intended data boundaries or inject malformed data into the parsing routine.
Attack Vector
The attack vector is network-based, requiring the attacker to send specially crafted BGP OPEN messages to a vulnerable GoBGP instance. The attacker must have network access to communicate with the BGP service, typically on TCP port 179. Due to the high complexity requirements, successful exploitation demands precise manipulation of the domainNameLen parameter within the BGP OPEN message's FQDN capability structure.
// Vulnerable code (before patch) - Source: pkg/packet/bgp/bgp.go
// The domainNameLen parameter was ignored, reading all remaining bytes
c.DomainName = string(data[hostNameLen+2:])
// Patched code - properly respects domainNameLen boundary
c.DomainName = string(data[hostNameLen+2 : hostNameLen+2+int(domainNameLen)])
Source: GitHub Commit 2b09db3
Detection Methods for CVE-2026-5122
Indicators of Compromise
- Unusual or malformed BGP OPEN messages with abnormal FQDN capability lengths
- BGP session establishment attempts from unexpected sources
- Error logs indicating BGP message parsing failures in GoBGP
- Anomalous traffic patterns targeting TCP port 179
Detection Strategies
- Deploy network intrusion detection rules to identify malformed BGP OPEN messages with mismatched domainNameLen values
- Monitor GoBGP application logs for BGP_ERROR_OPEN_MESSAGE_ERROR events indicating capability parsing issues
- Implement deep packet inspection for BGP traffic to detect capability field anomalies
- Configure alerting for repeated BGP session establishment failures from single sources
Monitoring Recommendations
- Enable verbose logging for BGP session negotiations in GoBGP configurations
- Establish baseline metrics for normal BGP OPEN message characteristics in your environment
- Monitor for unexpected changes in BGP peer relationships or routing table modifications
- Implement real-time alerting on BGP error conditions related to capability negotiation
How to Mitigate CVE-2026-5122
Immediate Actions Required
- Upgrade GoBGP to a patched version containing commit 2b09db390a3d455808363c53e409afe6b1b86d2d
- Review BGP peer configurations and restrict connections to known, trusted peers only
- Implement network segmentation to limit exposure of BGP services to untrusted networks
- Audit recent BGP session logs for any suspicious connection attempts
Patch Information
The vulnerability has been addressed in GitHub Pull Request #3343. The fix ensures that the DecodeFromBytes function properly respects the domainNameLen boundary when parsing the domain name from FQDN capability data. The patch is identified by commit hash 2b09db390a3d455808363c53e409afe6b1b86d2d. Users should update to a GoBGP version that includes this commit.
Workarounds
- Restrict BGP service access using firewall rules to permit connections only from authorized BGP peers
- Disable FQDN capability negotiation if not required in your BGP deployment
- Deploy BGP-aware network security appliances to filter malformed BGP messages before they reach GoBGP instances
# Configuration example - Restrict BGP access with iptables
# Allow BGP connections only from known peer IP addresses
iptables -A INPUT -p tcp --dport 179 -s <TRUSTED_PEER_IP_1> -j ACCEPT
iptables -A INPUT -p tcp --dport 179 -s <TRUSTED_PEER_IP_2> -j ACCEPT
iptables -A INPUT -p tcp --dport 179 -j DROP
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

