Bug 1316571 (CVE-2016-2342)

Summary: CVE-2016-2342 quagga: VPNv4 NLRI parser memcpys to stack on unchecked length
Product: [Other] Security Response Reporter: Andrej Nemec <anemec>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: balajig81, carnil, mruprich, msekleta
Target Milestone: ---Keywords: Reopened, Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: quagga 1.0.20160309 Doc Type: Bug Fix
Doc Text:
A stack-based buffer overflow flaw was found in the way the Quagga BGP routing daemon (bgpd) handled Labeled-VPN SAFI routes data. A remote attacker could use this flaw to crash the bgpd daemon resulting in denial of service.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-08 02:49:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1316572, 1391916    
Bug Blocks: 1316575, 1386080    

Description Andrej Nemec 2016-03-10 14:03:48 UTC
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
  address family.

Upstream fix:

http://git.savannah.gnu.org/cgit/quagga.git/commit/?id=a3bc7e9400b214a0f078fdb19596ba54214a1442

External references:

http://mirror.easyname.at/nongnu//quagga/quagga-1.0.20160309.changelog.txt

Comment 1 Andrej Nemec 2016-03-10 14:04:27 UTC
Created quagga tracking bugs for this issue:

Affects: fedora-all [bug 1316572]

Comment 2 Andrej Nemec 2016-03-14 10:44:24 UTC
References:

https://www.kb.cert.org/vuls/id/270232

Comment 4 errata-xmlrpc 2017-03-21 11:58:35 UTC
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