-
Notifications
You must be signed in to change notification settings - Fork 813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the option to check the source address of ClientHello message on DTLS-SRTP #4261
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure this is tested with various scenarios, e.g:
- with & without ICE,
- ICE chooses TURN & STUN/host as valid candidate.
* | ||
* Default value: 0 | ||
*/ | ||
#ifndef PJMEDIA_SRTP_DTLS_CHECK_HELLO_ADDR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need a compile-time setting? and why is the default 0 if it may cause a security issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might add a slight delay in starting the handshake (wait for the transport address and RTP source address to be available) and possible issues when using aggressive nomination.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After reading the pdf, I believe the address check should be made mandatory for ICE, and the address should match one of the verified (valid?) candidates obtained during ICE check, so there should be no delay because ICE check has been done.
For no-ICE, then you can use the compile-time setting, because the best we can do is compare it with the SDP address, which may not be accurate.
When using this option, it is recommended to use regular nomination for ICE. When enabling STUN with aggressive nomination might result in a different candidate pair type being used between endpoints and preventing the handshake. |
This is the case when using ICE with STUN (aggressive nomination):
|
For trickle ICE, the candidates may be added rapidly while app is allowed to send/recv data before the ICE nego is completed. So if the proposed feature is on, perhaps it should indeed check the source address against all remote candidates. This may be applicable for aggressive mode too. |
- The check will always be performed when ICE is use - Check the RTP/RTPC address against the candidate when ICE is use
So now, does it work for aggressive & trickle modes? |
Yes, now working with aggressive and trickle |
For ICE: If no ICE is used: |
It looks like "verified" is specific to the recommendation, not really ICE things? |
Correct. ICE itself doesn't use the term "verified", and the document explains it in the media consent verification phase, which means that that the other party is the peer they claim to be. So this way, security can be achieved.
Yes, this is fine too. So, it means that |
Yes. Note that in ICE, the status belongs to pair-check instead of candidate, a remote candidate may be paired (& checked) against multiple local candidates. If DTLS just needs to list remote candidates that has been checked, it can be done but needs to be clarified in the docs. |
There's an issue when using aggressive nomination/trickle:
Controlled side:
Check 1 connectivity check was received late, so the controlling side will use Check 3 instead and fail the Check 1. |
It looks like it's caused by pjproject/pjnath/src/pjnath/ice_session.c Lines 1734 to 1741 in f986ad8
pjproject/pjnath/include/pjnath/config.h Lines 352 to 360 in f986ad8
I don't quite understand the reasoning why we enable this setting by default though, especially about the statement |
There is a possible issue with
DTLS
“ClientHello” Race Conditions leading to DDoS attack.This is done by sending a malicious DTLS ClientHello message from any
IP address to the expected port, potentially causing a “network race condition” if the malicious
message is processed before the legitimate one.
This patch will add the option (
PJMEDIA_SRTP_DTLS_CHECK_HELLO_ADDR
) to enable checking the source address of the "ClientHello" message is coming from a valid source.Notes:
ICE
, the valid address will be available after the negotiation is done, so any "ClientHello" message received prior to it might get ignored.