How to protect data from MITM attacks via HTTPS?

I am working on an enterprise API that is available for enterprise services, where MITM can have dire consequences.

We decided to use HTTP instead of HTTP, but after googling I realized that SSL is not enough.

As I understand it, there are two main vulnerabilities when using SSL: 1) Now there are many CA provider companies, so no one is protected from a MITM attack where ordinary certificates are used by crackers (I found several articles that said VeriSign has a secret department that provides secret services for MITM when VeriSign was the only CA worldwide) 2) Most MITM attacks are possible using ARP Cache Poisoning

So, I can only see one solution for a moment, but I'm not sure if this is the best practice: Since the API is internal, I can use the following things: 1) Encrypt data with a symmetric encryption algorithm 2) Limit the ips that can use the API (like in the application and in the server firewall)

is that enough? maybe there are other best practices to make a really secure connection, which will make MITM impossible?

If this solution (SSL + symmetric encryption algorithm) is in order, could you advise the most suitable encryption algorithms for this kind of problem?

Thanks in advance, I will be happy for any help / advice.

UPD: VPN (frenchie recommended) is not appropriate in this context

UPD2: a public key (RSA-alike) is possible (thanks to 2 Craigy), but very expensive on the server side.

+6
source share
3 answers

We decided to use HTTP instead of HTTP, but after googling I did that SSL is not enough.

I'm not sure that you are googled, but SSL / TLS, if used correctly, can protect you from MITM attacks.

If this solution (SSL + symmetric encryption algorithm) is ok, can you advise the most suitable encryption algorithms for this kind of problem?

SSL / TLS encryption is already performed using symmetric cryptography. Only authentication is performed using asymmetric cryptography.

As I understand it, there are two main vulnerabilities when using SSL: 1) Now there are many CA service providers, so no one is protected from a MITM attack, where crackers use an ordinary certificate (I found several articles where it was said that VeriSign has a secret department, which provided secret services for MITM when VeriSign was the only CA in the whole world) 2) Most MITM attacks are possible during using ARP Cache Poisoning

MITM attack protection is precisely the purpose of the certificate. The client is only responsible for verifying that HTTPS is used when it is expected, and (b) verify the correctness of the server certificate.

The first point may be obvious, but this is the type of attack that tools like sslstrip make: they are down-MITM attacks that prevent the user from fully navigating to the HTTPS page. As a user, make sure you are on the HTTPS page when it should be HTTPS. In a corporate environment, tell your users that they need to verify that they are accessing your server using HTTPS: only they can know (if you do not want to use client certificate authentication).

The second point (certificate verification) also depends on the client, although most of it is automated in the browser. The user is responsible not to ignore browser warnings. The rest of the certificate verification is typically performed using pre-installed CA certificates (e.g. Verisign's).

If a MITM attack occurs (possibly using ARP poisoning), the user must receive the wrong certificate and should not act. Proper HTTPS checks should allow you to have a secure connection or no connection at all.

The vulnerabilities you mention are related to certificate validation (PKI model). Indeed, validating the server certificate depends on the CA certificates that your browser trusts. There, any trusted CA can, in principle, issue a certificate for any server, so this model is good as the weakest CA in the list. If one of the trusted CAs issues a fake certificate for the site and transfers it to the other party, it also has the right to have a passport office issuing a real "fake" passport. It's pretty hard to come across, but there are ways around this.

  • You can count on extensions, such as Prospective projects that control certificate changes, even if both trust. Such a warning should prompt the user to investigate whether the certificate change was legal (made by your company) or not.

  • More radically, you can deploy your own CA, remove all trusted CA certificates from the user's browser, and install only your own CA certificate. In this case, users will be able to securely connect to machines that have certificates issued by your CA. This can be a problem (including for software updates if your browser uses the OS certificate repository).

  • Basically, you can opt out of the certificate altogether and use Pre-Shared Keys . However, this is not supported by all SSL / TLS stacks and is not necessarily adapted for HTTP over TLS (in the absence of a specification for checking hostnames, as far as I know).

You may also be interested in these questions at Security.SE:

+6
source

If you want to protect against Man-in-the-middle attacks , then you are right that using cryptography with a symmetric key will prevent data from being compromised by a third party. However, then you were faced with the problem of key distribution, which is one of the reasons why asymmetric key cryptography is attractive.

To protect against MITM attacks when using asymmetric cryptography on your network, you can configure the public key infrastructure . You have created and managed a certification authority and disabled everyone else so that no one could pretend to be someone else, thereby preventing MITM attacks. If the CA was compromised, then MITM attacks will again be possible.

To make sure that we are on the same page, these offers are implementation independent. You can use any Symmetric-key algorithm for the first sentence.

For the second sentence, you will need a more complex system called asymmetric or public key cryptography . They are built on algorithms such as RSA .

SSL is a protocol that uses public key cryptography to exchange keys and symmetric cryptography to send messages.

+4
source

Proper defense against a person in a medium attack requires two things:

  • Never serve your site through HTTP; only listen to https traffic
  • Use the Strict-Transport-Security Header in Long Life Answers

ARP poisoning with an SSLStrip attack is based on the fact that the browser initiates an HTTP connection to the server and switches to HTTPS later. It is at this transition point that the attack takes effect.

However, if the browser initiates the request as an HTTPS request, then the handshake authenticates the server in the browser before anything else happens. In principle, if a man-in-the-middle attack occurs, the user will be notified that SSL is not possible or that the server is not the correct server.

Never serve your site via HTTP, so that anyone links to it in order to use HTTPS in the link. The Strict-Transport-Security header instructs compatible browsers to convert to HTTPS any attempt to communicate via HTTP with your server.

For your use case, it seems that any other solution other than the two recommendations above will be redundant. To learn more about Strict-Transport-Security, see the Wikipedia article on Strict-Transport-Security .

+1
source

Source: https://habr.com/ru/post/922381/


All Articles