Bug 1966240 (CVE-2021-3570)

Summary: CVE-2021-3570 linuxptp: missing length check of forwarded messages
Product: [Other] Security Response Reporter: Guilherme de Almeida Suckevicz <gsuckevi>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: mlichvar, omejzlik, security-response-team, yalli
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: linuxptp 3.1.1, linuxptp 2.0.1, linuxptp 1.9.3, linuxptp 1.8.1, linuxptp 1.7.1, linuxptp 1.6.1, linuxptp 1.5.1 Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in the ptp4l program of the linuxptp package. A missing length check when forwarding a PTP message between ports allows a remote attacker to cause an information leak, crash, or potentially remote code execution. The highest threat from this vulnerability is to data confidentiality and integrity as well as system availability.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-07-06 16:40:27 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: 1966504, 1966505, 1966506, 1966507, 1966516, 1966524, 1979399    
Bug Blocks: 1966236, 1966242    

Description Guilherme de Almeida Suckevicz 2021-05-31 17:28:48 UTC
When ptp4l is forwarding a PTP message between ports, it uses the messageLength field as the length of transmitted data, but it does not check if the value is not larger than the actual length of the received message. An attacker with access to the network can send a crafted message to cause ptp4l to send data past the message buffer, causing an information leak or crash. If ptp4l runs on a little-endian architecture, the attacker can also craft a management message which causes a heap memory corruption by converting fields from host to network order, potentially leading to remote code execution.

Comment 6 Mauro Matteo Cascella 2021-07-05 21:33:27 UTC
Created linuxptp tracking bugs for this issue:

Affects: fedora-all [bug 1979399]

Comment 7 Mauro Matteo Cascella 2021-07-06 07:37:14 UTC
The length of a PTP message is determined by the message type and the appended TLVs. The current implementation validates the sizes of both the main message (according to the fixed header length and fixed length by type) and the TLVs (by using the 'L' of the TLV).

However, when forwarding a message, the messageLength field is used. If a message arrives with a messageLength field larger than the actual
message size, the code will read and possibly write data beyond the allocated buffer.

Comment 9 errata-xmlrpc 2021-07-06 15:21:31 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.1 Extended Update Support

Via RHSA-2021:2659 https://access.redhat.com/errata/RHSA-2021:2659

Comment 10 errata-xmlrpc 2021-07-06 15:37:30 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.2 Extended Update Support

Via RHSA-2021:2657 https://access.redhat.com/errata/RHSA-2021:2657

Comment 11 errata-xmlrpc 2021-07-06 15:41:05 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2021:2660 https://access.redhat.com/errata/RHSA-2021:2660

Comment 12 errata-xmlrpc 2021-07-06 16:05:41 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2021:2658 https://access.redhat.com/errata/RHSA-2021:2658

Comment 13 Product Security DevOps Team 2021-07-06 16:40:27 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2021-3570

Comment 14 Product Security DevOps Team 2021-07-06 22:40:20 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2021-3570