Update coreSNTP demo to avoid issues from open UDP socket (#647)

Issue
There is a possible vulnerability of Denial of Service attack by keeping the UDP socket for the SNTP client task always open in the coreSNTP demo. The Denial of Service attack can occur from receiving multiple server response (duplicated or malicious) for a single SNTP time request sent by the client, and thereby, filing the socket network buffer response packets that affect future time requests.

Solution
This PR fixes this vulnerability by updating the demo to keep a UDP socket open only for the time period of waiting for server response, closing the socket on either receiving a server response or experiencing server timeout, and re-creating a UDP socket for the next polling try. This PR also adds another security functionality using a random port for UDP socket to protect against spoofing attacks from "off-network path" attackers.
This commit is contained in:
Archit Aggarwal 2021-07-14 13:21:40 -07:00 committed by GitHub
parent 3fd635b39e
commit 5a4fe788d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 149 additions and 64 deletions

View file

@ -1836,6 +1836,7 @@ psignature
psl
pslotlist
psoc
psocket
psr
psslcontext
pstplatformimagestate
@ -3385,4 +3386,4 @@ yyyy
yyyymmddhhmmss
zc
zer
zynq
zynq