Skip to content

bgpd: improve flowspec NLRI validation#20814

Merged
donaldsharp merged 1 commit intoFRRouting:masterfrom
mjstapp:fix_bgp_flowspec_parse
Feb 13, 2026
Merged

bgpd: improve flowspec NLRI validation#20814
donaldsharp merged 1 commit intoFRRouting:masterfrom
mjstapp:fix_bgp_flowspec_parse

Conversation

@mjstapp
Copy link
Contributor

@mjstapp mjstapp commented Feb 13, 2026

Validate flowspec NLRIs more carefully during parsing, especially offsets into the message buffer.

Validate flowspec NLRIs more carefully during parsing.

Reported-by: Joshua Rogers <joshua@joshua.hu>
Signed-off-by: Mark Stapp <mjs@cisco.com>
@mjstapp mjstapp added this to the 10.6 milestone Feb 13, 2026
@mjstapp mjstapp added the bugfix label Feb 13, 2026
@frrbot frrbot bot added the bgp label Feb 13, 2026
@greptile-apps
Copy link

greptile-apps bot commented Feb 13, 2026

Greptile Overview

Greptile Summary

Enhanced buffer validation in flowspec NLRI parsing functions to prevent out-of-bounds reads. Added three categories of checks:

  • Initial buffer size validation before do/while loops in bgp_flowspec_op_decode and bgp_flowspec_bitmask_decode
  • Offset boundary checks before dereferencing buffer contents within loops
  • Value size validation to ensure computed sizes don't exceed remaining buffer space

These changes address potential security vulnerabilities from malformed BGP flowspec messages.

Confidence Score: 4/5

  • Safe to merge - fixes security issues with minimal functional risk
  • Adds defensive boundary checks to prevent buffer overruns without changing parsing logic. All new checks properly set error codes and break/return appropriately. Minor deduction due to lack of test coverage visible in the PR.
  • No files require special attention - the changes are straightforward security improvements

Important Files Changed

Filename Overview
bgpd/bgp_flowspec_util.c Added buffer boundary checks in three parsing functions to prevent out-of-bounds reads when parsing flowspec NLRI data

Last reviewed commit: aa0a8cc

@mjstapp
Copy link
Contributor Author

mjstapp commented Feb 13, 2026

@Mergifyio backport dev/10.6 stable/10.5 stable/10.4 stable/10.3 stable/10.2 stable/10.1 stable/10.0

@mergify
Copy link

mergify bot commented Feb 13, 2026

backport dev/10.6 stable/10.5 stable/10.4 stable/10.3 stable/10.2 stable/10.1 stable/10.0

✅ Backports have been created

Details

@donaldsharp donaldsharp merged commit d481ea2 into FRRouting:master Feb 13, 2026
25 checks passed
donaldsharp added a commit that referenced this pull request Feb 13, 2026
bgpd: improve flowspec NLRI validation (backport #20814)
donaldsharp added a commit that referenced this pull request Feb 13, 2026
bgpd: improve flowspec NLRI validation (backport #20814)
donaldsharp added a commit that referenced this pull request Feb 13, 2026
bgpd: improve flowspec NLRI validation (backport #20814)
donaldsharp added a commit that referenced this pull request Feb 13, 2026
bgpd: improve flowspec NLRI validation (backport #20814)
donaldsharp added a commit that referenced this pull request Feb 13, 2026
bgpd: improve flowspec NLRI validation (backport #20814)
donaldsharp added a commit that referenced this pull request Feb 13, 2026
bgpd: improve flowspec NLRI validation (backport #20814)
donaldsharp added a commit that referenced this pull request Feb 13, 2026
bgpd: improve flowspec NLRI validation (backport #20814)
@mattiaswal mattiaswal mentioned this pull request Mar 18, 2026
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants