V5612. OWASP. Do not use old versions of SSL/TLS protocols as it may cause security issues.
The analyzer detected the use of old SSL/TLS protocol versions in the code. This can make an application vulnerable to attacks like man-in-the-middle, BEAST, etc.
Problems related to outdated protocols can be attributed to two categories from OWASP Top Ten 2017:
Example:
public void Run(ApplePushChannelSettings settings)
{
....
var certificates = new X509CertificateCollection();
....
var stream = new SslStream(....);
stream.AuthenticateAsClient(settings.FeedbackHost,
certificates,
SslProtocols.Tls, // <=
false);
....
}
In the code above, the 'SslProtocols.Tls' entity represents the 1.0 version of the TLS protocol. This version is outdated and is not recommended, because TLS 1.0 is vulnerable to a number of attacks, including the previously mentioned BEAST.
Experts recommend newer versions of protocols, for example, TLS 1.2:
public void Run(ApplePushChannelSettings settings)
{
....
var certificates = new X509CertificateCollection();
....
var stream = new SslStream(....);
stream.AuthenticateAsClient(settings.FeedbackHost,
certificates,
SslProtocols.Tls12,
false);
....
}
Protocol versions below TLS 1.2 are not recommended because they may cause security problems. Such protocols are SSL 2.0 and 3.0, as well as TLS 1.0 and 1.1.
Experts also do not recommend using the 'SslProtocols.Default' value, because it corresponds to the use of outdated protocols: SSL 3.0 or TLS 1.0.
As a rule, the most suitable values are 'SslProtocols.None' and 'SecurityProtocolType.SystemDefault'. They allow the operating system to choose the data transfer protocol. If for some reason these values do not suit in your scenario, set the newest version available.
The analyzer also issues a warning if the outdated protocols are used in a called method:
SslStream _sslStream;
public string TargetHost { get; set; }
public X509CertificateCollection Certificates { get; set; }
private void PrepareSslStream()
{
....
var protocol = SslProtocols.Ssl3 | SslProtocols.Tls12;
Authenticate(protocol); // <=
....
}
private void Authenticate(SslProtocols protocol)
{
_sslStream.AuthenticateAsClient(TargetHost,
Certificates,
protocol,
true);
}
In the code above, the 'Authenticate' method takes a value, that represents the SSL 3.0 and TLS 1.2 protocols, as a parameter. The method uses them to set protocols that the standard 'AuthenticateAsClient' method will use. This triggers the analyzer's warning, because SSL 3.0 is outdated and its use may lead to new vulnerabilities in the code.
In this case, the fix is the same as before - exclude the insecure protocol from the list of the available ones:
private void PrepareSslStream()
{
....
var protocol = SslProtocols.Tls12;
Authenticate(protocol);
....
}
Additional resources:
- Transport Layer Security (TLS) best practices with the .NET Framework
- Testing for Weak SSL TLS Ciphers Insufficient Transport Layer Protection
- Transport Layer Protection Cheat Sheet
- Manipulator-in-the-middle attack
- Man-in-the-browser attack
This diagnostic is classified as:
|