bgpd: Fix VU#270232, VPNv4 NLRI parser memcpys to stack on unchecked length
A vulnerability was found in a way VPNv4 NLRI parser copied packet data to the stack. Memcpy to stack data structure based on length field from packet data whose length field upper-bound was not properly checked.
This likely allows BGP peers that are enabled to send Labeled-VPN SAFI routes to Quagga bgpd to remotely exploit Quagga bgpd.
Mitigation: Do not enable Labeled-VPN SAFI with untrusted neighbours.
Impact: Labeled-VPN SAFI is not enabled by default.
* bgp_mplsvpn.c: (bgp_nlri_parse_vpnv4) The prefixlen is checked for
lower-bound, but not for upper-bound against received data length.
The packet data is then memcpy'd to the stack based on the prefixlen.
Extend the prefixlen check to ensure it is within the bound of the NLRI
packet data AND the on-stack prefix structure AND the maximum size for the
Created quagga tracking bugs for this issue:
Affects: fedora-all [bug 1316572]
This issue has been addressed in the following products:
Red Hat Enterprise Linux 6
Via RHSA-2017:0794 https://rhn.redhat.com/errata/RHSA-2017-0794.html