BIRD/BIRD2 BGP AS_PATH Mask Matching Stack Buffer Overflow (CVE-2026-49943)
by Bakabaka_9 (9Bakabaka) · 2026-07-05
- Severity
- High
- CVE
- CVE-2026-49943
- Category
- network
- Affected product
- BIRD Internet Routing Daemon (BGP implementation)
- Affected versions
- Confirmed: BIRD 2.18; potentially other BIRD 2.x versions containing the fixed-size pm_pos pos[2048 + 1] stack buffer in as_path_match()
- Disclosed
- 2026-07-05
- Patch status
- unpatched
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-07 |
| Author / Researcher | Bakabaka_9 (9Bakabaka) |
| CVE / Advisory | CVE-2026-49943 |
| Category | network |
| Severity | High |
| CVSS Score | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H (suggested by researcher; not an official vendor score) |
| Status | PoC |
| Tags | bird, bird2, bgp, as-path, stack-buffer-overflow, denial-of-service, routing, dos |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | BIRD Internet Routing Daemon (BGP implementation) |
| Versions Affected | Confirmed: BIRD 2.18; potentially other BIRD 2.x versions containing the fixed-size pm_pos pos[2048 + 1] stack buffer in as_path_match() |
| Language / Platform | C (BIRD daemon), Python 3 PoC client |
| Authentication Required | Yes — attacker must be an established, authenticated BGP peer of the target |
| Network Access Required | Yes |
Summary
This repository documents a stack-based buffer overflow in BIRD’s BGP AS_PATH mask matching code (as_path_match() in nest/a-path.c). The function uses a fixed-size stack array of 2048 + 1 pm_pos entries, but parse_path() expands AS_PATH segments from a received BGP UPDATE message without enforcing a matching capacity limit. When a BGP peer sends an UPDATE containing an AS_PATH longer than 2048 ASNs while the target evaluates an AS path mask filter (e.g. bgp_path ~ [= ... =]) with BGP Extended Messages enabled, the matcher writes past the end of the stack buffer, crashing the daemon. The included poc.py establishes a minimal BGP session with the target and sends a single UPDATE containing an AS_PATH of 2295 ASNs to trigger the crash.
Vulnerability Details
Root Cause
as_path_match() allocates a fixed-size stack array (pm_pos pos[2048 + 1]) for path-mask matching state. parse_path() expands AS_PATH segments received in a BGP UPDATE into that array without checking that the number of ASNs stays within the array’s capacity. AS_PATH attributes with more than 2048 ASNs cause writes beyond the end of the stack buffer. The researcher also notes that as_path_getlen() does not count AS_PATH_CONFED_SEQUENCE entries even though parse_path() still expands them into the same fixed buffer, so mitigations that only check bgp_path.len are incomplete for BGP confederation paths.
Attack Vector
- Attacker establishes a BGP session with the target BIRD instance (BGP OPEN/KEEPALIVE handshake), acting as a legitimate, already-authorized peer.
- Target must have BGP Extended Messages (RFC 8654) enabled and must evaluate an AS path mask filter (e.g.
bgp_path ~ [= ... =]) on the session. - Attacker sends a BGP UPDATE message whose AS_PATH attribute contains more than 2048 ASNs (the PoC uses 2295, split across 9 AS_SEQUENCE segments of 255 ASNs each, using the Extended Length attribute flag).
- When the target’s filter interpreter calls
as_path_match()→parse_path()on the oversized AS_PATH, the fixed-size stack buffer is overrun, crashing the daemon (confirmed via AddressSanitizer as a stack-buffer-overflow).
Impact
Denial of service: the BIRD BGP daemon crashes/segfaults, causing BGP sessions to drop and routes to be withdrawn or recalculated. In route server, route reflector, BGP collector, or internal backbone deployments this can cause control-plane disruption and route churn. No memory corruption beyond the crash (write primitive) was demonstrated as leading to code execution in the source material.
Environment / Lab Setup
Target: BIRD 2.18 (or other affected BIRD 2.x) configured as a BGP speaker with an AS path mask filter and BGP Extended Messages enabled, reachable over an established BGP session
Attacker: Python 3 host with network access to the target's BGP port (179/tcp), running poc.py
Proof of Concept
PoC Script
See
poc.pyin this folder. See alsoadvisory.mdfor the full technical write-up, ASan crash trace, and confederation-path caveats.
| |
The script opens a TCP connection to the target’s BGP port, completes a minimal OPEN/KEEPALIVE handshake (4-byte ASN and Extended Message capabilities advertised), then immediately sends a crafted UPDATE message containing an AS_PATH of 2295 ASNs. If the connection resets or times out immediately afterward, this indicates the target daemon has crashed.
Detection & Indicators of Compromise
Signs of compromise:
- Sudden BIRD daemon crash or restart coinciding with receipt of a BGP UPDATE from a peer
- Route flapping / withdrawal churn correlated with a single peering session
- Core dumps or ASan/crash logs referencing
as_path_matchornest/a-path.c
Remediation
| Action | Detail |
|---|---|
| Primary fix | No source-level fixed version was available at time of disclosure; monitor BIRD project advisories for a patch enforcing bounds during AS_PATH expansion/matching |
| Interim mitigation | Avoid enabling BGP Extended Messages unless required; avoid evaluating AS path mask filters on untrusted/loosely trusted BGP sessions; reject unusually long AS_PATH attributes before filter evaluation; note that filtering only on bgp_path.len is incomplete for confederation paths; restrict BGP sessions to trusted peers |
References
Notes
Mirrored from https://github.com/9Bakabaka/CVE-2026-49943-PoC on 2026-07-05.
| |