The Black Duck Cybersecurity Research Center (CyRC) has identified problems in Zephyr OS related to protecting against internet protocol (IP) address spoofing attacks.
Zephyr OS is a popular real-time operating system used in connected, resource-constrained systems like Internet of Things and embedded devices. It is highly customizable and supports multiple architectures, systems-on-a-chip, and boards, making it useful for a wide range of applications.
Zephyr OS comes with a native network stack that supports a wide range of networking protocols. The network stack is configurable and can support IPv4 and IPv6 protocols at the same time, allowing developers to create connected devices that can communicate over the internet or variable local networks.
IP address spoofing involves creating IP packets with a fake source IP address. This is typically done with the intention of deceiving the recipient into believing that the packet is coming from a legitimate source. When the recipient sends a response back to the source IP address, it is sent to the fake source IP address instead.
A Zephyr OS network stack implementation does not drop IP packets arriving from an external interface with a source address equal to the localhost or the destination address, which is a violation of the recommended security practice.
When the localhost or destination address is used as a fake source address, the response goes to the loopback interface, bypassing host-side IP address–based access control. Depending on the implementation and protocol (UDP/TCP), the target device might handle all or some of the data from the response. One example of this kind of behavior being used to extend local vulnerability to an adjacent network can be seen here.
When responses are handled by loopback interfaces, the target becomes more vulnerable to denial-of-service attacks. In Zephyr OS, there was also a bug causing system instability (a crash) when the loopback interface was handling packets from the external interface. The crash was reproduced with IPv4 and IPv6 packets over TCP connection.
IPv4 packets with the spoofed localhost address are not dropped in any network. IPv6 packets with the spoofed localhost address are handled correctly. IPv4 and IPv6 packets with a spoofed source address equal to the destination address are not dropped in any network. This behavior is present on all unpatched releases of Zephyr OS supporting IPv6 or IPv4.
The fix is included as of the commit
Zephyr OS v.3.6 and newer versions inherit the fix from the main repository.
Kari Hulkko from the CyRC discovered these vulnerabilities by using the Defensics® fuzz testing tool with IPv4 and IPv6 protocol test suites.
Black Duck would like to thank the maintainers of Zephyr OS for their responsiveness and cooperation.
FIRST.Org, Inc (FIRST) is a nonprofit organization based out of US that owns and manages CVSS. It is not required to be a member of FIRST to utilize or implement CVSS but FIRST does require any individual or organization give appropriate attribution while using CVSS. FIRST also states that any individual or organization that publishes scores follow the guideline so that anyone can understand how the score was calculated.