The constant lives at the call site. The parser does not know it.
as_path_match() is the BIRD filter language's implementation of the AS path mask operator. When an operator writes a filter line like bgp_path ~ [= 65000 =] and a BGP UPDATE arrives carrying an AS_PATH attribute, the interpreter dispatches to this function:
int
as_path_match(const struct adata *path, const struct f_path_mask *mask)
{
struct pm_pos pos[2048 + 1];
int plen = parse_path(path, pos);
int l, h, i, nh, nl, last, loop;
u32 val = 0;
u32 val2 = 0;
/* l and h are bound of interval of positions where
are marked states */
pos[plen].set = 0;
pos[plen].mark = 0;
The matcher is a nondeterministic finite state machine. Each pm_pos entry holds one position in the expanded AS path; the algorithm walks the input mask, marking which positions remain valid. The +1 is a sentinel for the auxiliary position after the last real ASN. The author of this function wrote twenty lines of comment defending the NFSM design and zero lines defending the array length.
The expansion is delegated:
static int
parse_path(const struct adata *path, struct pm_pos *pp)
{
const byte *pos = path->data;
const byte *end = pos + path->length;
struct pm_pos *op = pp;
uint i;
while (pos < end)
{
uint type = pos[0];
uint len = pos[1];
pos += 2;
switch (type)
{
case AS_PATH_SET:
case AS_PATH_CONFED_SET:
pp->set = 1;
pp->mark = 0;
pp->val.sp = pos - 1;
pp++;
pos += BS * len;
break;
case AS_PATH_SEQUENCE:
case AS_PATH_CONFED_SEQUENCE:
for (i = 0; i < len; i++)
{
pp->set = 0;
pp->mark = 0;
pp->val.asn = get_as(pos);
pp++;
pos += BS;
}
break;
parse_path() takes the destination as struct pm_pos *pp. No count. No end pointer. No bound of any kind. The number of iterations through the inner loop is len, read directly from the wire at pos[1]. The number of segments through the outer loop is whatever fits in path->length, also from the wire. The destination's capacity is encoded in the caller's stack frame on line 906. The parser does not know about the caller's stack frame. The parser was not asked.
The bug is the asymmetry. The bound on the destination is a compile-time constant in as_path_match. The bound on the source is a runtime length the BGP peer chose. The function that decides how many entries get written is not the function that decided how many entries fit.
RFC 8654 took the cap off. The array did not move.
git log -L 906,906:nest/a-path.c returns one commit. c8a6b9a3, 2009-04-17, "Rewrite of buggy AS path matching," authored by Ondrej Zajicek. The line struct pm_pos pos[2048 + 1]; was introduced that day and has not been touched since.
In April 2009, the BGP base specification (RFC 4271) capped a single BGP message at 4096 octets, total, including the 19-byte header. Subtract the path attribute headers and the NLRI and the AS_PATH attribute had room for, generously, a thousand four-byte ASNs. The number 2048 was a comfortable margin above what the wire could deliver. The closed-network assumption did not need to be a check because the framing did the check.
RFC 8654 was published in October 2019. It raised the BGP message cap to 65535 octets when both peers advertise the Extended Messages capability during OPEN. At 65535 octets, an AS_PATH attribute fits roughly sixteen thousand four-byte ASNs. Comfortably above 2048.
The PoC's capability negotiation is three options:
cap_mp = b'\x01\x04\x00\x01\x00\x01' # IPv4 Unicast
cap_as4 = b'\x41\x04\x00\x00\xfd\xe8' # 4-byte ASN
cap_ext = b'\x06\x00' # Extended Message support, RFC 8654
Only the third capability matters for the overflow. Without it, the BGP framing layer would truncate the attacker's message before parsing began. With it, the attacker can ship a path attribute that the framing layer happily accepts and parse_path() happily expands.
The malicious UPDATE carries nine AS_SEQUENCE segments, each carrying 255 ASNs of 0x41414141:
as_segment = b'\x02\xff' + (struct.pack('!I', 0x41414141) * 255)
as_path_data = as_segment * 9 # 2295 ASNs total
Nine times 255 is 2295. The stack array holds 2049. parse_path() runs the SEQUENCE branch nine times, writing 255 entries each time, and walks 246 entries past the end of the buffer. Then as_path_match() returns from parse_path() and immediately writes the sentinel:
int plen = parse_path(path, pos);
...
pos[plen].set = 0;
pos[plen].mark = 0;
plen is now 2295. pos[2295] is hundreds of bytes past the end of the stack frame. ASan caught the sentinel write at line 915 because the sentinel is the first write the function makes after returning from the parser; the actual overflow began halfway through the second-to-last segment. The advisory's boundary table records the cutover:
AS_PATH with 2048 ASNs: no crash
AS_PATH with 2049 ASNs: stack-buffer-overflow
AS_PATH with 2050 ASNs: out-of-bounds write during parse_path expansion
The vulnerable function is reached only when the operator's filter evaluates a path mask. bgp_path ~ [= ... =] is the canonical example. Operators who run BIRD as a route reflector, a route server, or a backbone forwarder routinely write such filters, because path masks are how you express policy in BGP. The PoC reaches the function the same way: connect as a peer, negotiate, send UPDATE, let the filter pipeline call into as_path_match().
CVSS gave this CVE 6.3 with AC:H for the operator-filter precondition and PR:L because you have to be a configured BGP peer. The "high attack complexity" rating describes the filter-configuration requirement. It does not describe the network position; "configured BGP peer" is the trust position route-server operators grant by the hundreds.
The mitigation CZ.NIC expects is the one BIRD lets you write halfway.
The vendor's coordination note in the advisory reads: "The vendor response indicated that there was no fixed timeline for a source-level fix and that they may release a general public advisory reminding operators to reject routes with unusually long attributes."
The NOTE field on the CVE record itself reads: "reportedly, the Supplier's position is that a fix is not being prioritized because all network operators should already be rejecting routes with unusually long attributes."
The natural way for a BIRD operator to enforce that mitigation is a filter expression against bgp_path.len. The filter language's bgp_path.len is computed by as_path_getlen(), six hundred lines above the bug in the same file:
int
as_path_getlen(const struct adata *path)
{
const byte *pos = path->data;
const byte *end = pos + path->length;
uint res = 0;
while (pos < end)
{
uint t = pos[0];
uint l = pos[1];
uint n = 0;
switch (t)
{
case AS_PATH_SET: n = 1; break;
case AS_PATH_SEQUENCE: n = l; break;
case AS_PATH_CONFED_SEQUENCE: n = 0; break;
case AS_PATH_CONFED_SET: n = 0; break;
default: bug("as_path_getlen: Invalid path segment");
}
res += n;
pos += 2 + BS * l;
}
return res;
}
Confederation segments do not contribute to bgp_path.len. They do contribute to parse_path(). The AS_PATH_CONFED_SEQUENCE case in parse_path() falls through into the same loop as AS_PATH_SEQUENCE, writing one pm_pos entry per expanded ASN. Two functions in the same file disagree about what counts as length: the one the operator queries returns zero for confederation entries, the one the matcher uses to size its work writes one entry for each.
The researcher's confederation-path table records the result:
asns=2049 segment=confed_sequence bgp_path_len=0 -> stack-buffer-overflow
asns=2050 segment=confed_sequence bgp_path_len=0 -> out-of-bounds write
A confederation AS_PATH with 2049 entries crashes the daemon while reading as length zero to the filter language. An operator who follows the vendor's advisory and adds bgp_path.len > 2048 to their import filter catches the AS_SEQUENCE variant of the bug and misses the AS_CONFED_SEQUENCE variant entirely. The mitigation CZ.NIC told MITRE was already in place does not cover the crash they declined to fix.
The advisory acknowledges this. The advisory is the researcher's, not the vendor's. CZ.NIC's reply to MITRE does not mention confederations.
The 2048 is a closed-network assumption. CZ.NIC wrote it down.
This is the Closed Network Assumed pattern. A parser written for a "trusted" bus accepts framing fields as if the protocol's valid-range constraints were guaranteed by the medium. Sequence numbers, length fields, and indices arrive without bounds checks because the developer's threat model excludes adversaries on the wire. When the bus admits a malformed frame, the protocol-derived constant becomes the size of the overflow.
BIRD is not OP-TEE J1939 reading sequence numbers off a CAN frame, and it is not Tasmota reading MJPEG length fields off an HTTP response, but the shape is the same. The 2048 in as_path_match() is what a 2009 author wrote when the BGP framing layer guaranteed nothing longer would arrive. The medium changed in 2019. The author was not asked.
The unusual move here is the vendor's. CZ.NIC took the closed-network assumption out of the implementer's head and wrote it down inside the CVE record. "All network operators should already be rejecting routes with unusually long attributes" is the threat model that produced line 906, restated in the body of the public CVE, on the public record, as the reason a memory-safety bug in a BGP daemon does not warrant a patch. The number 2048 is the bound the parser does not enforce. The bound exists. It exists on the wire. It exists in the operator's filter. It exists in CZ.NIC's reply to MITRE. It does not exist in parse_path().
The unpatched-at-disclosure shape is the rare case where the vendor's closed-network assumption has been published. Every other exhibit on the pattern page is a developer's worldview inferred from the code. This one came with attribution.
PoC: 9Bakabaka/CVE-2026-49943-PoC
The bound is in the array. The bound is in CZ.NIC's reply to MITRE. The bound is not in parse_path().