Blog

코드 시리즈로 보안 인프라를 정복한 코더: 불충분한 전송 계층 보호

June 1, 2020
Matias Madou, Ph.D.

If you're a developer looking to learn more about the steps you can take to begin deploying secure infrastructure as code (IaC) in your organization, then you've come to the right place. This is the next chapter in our IaC series, designed to level you up in IaC security best practices.

Before we start, how did you fare with the challenge from the last installment? If you have mastered insecure cryptography, let's see how you go with insufficient transport layer protection before we dig into the details:

Want to learn more and achieve a perfect score? Read on:

In our last article, we talked about the importance of having secure cryptography to protect any important or personal data stored by applications and programs. If you have strong encryption, it acts as a perfect last line of defense. Even if an attacker is able to steal that data, if it's strongly encrypted, then the information locked inside those files is still protected.

Protecting data at rest, however, is only one part of a complete data defense. Whenever valid users need to access protected data, it has to be sent to them. At times, applications will also share data with other programs as part of an overall workload. Unless the transport layer is protected, it makes it vulnerable to both outside snooping and unauthorized internal viewing. As such, having insufficient transport layer protection can cause serious issues.

It's a common problem. The OWASP security organization even maintains a full page about insufficient transport layer protection.

Why is insufficient transport layer protection dangerous?

If you don't sufficiently protect your transport layers, then it's relatively easy for skilled hackers to intercept information flowing between your users and your applications using techniques like man-in-the-middle attacks. Probably the most dangerous aspect of this kind of snooping is that it's almost completely invisible to any internal cybersecurity platforms or scans because it occurs outside of your network and your control.

For example, in a Docker environment deploying an Nginx service:

services:
 nginx:
   image: localhost:5000/scw_nginx
   build: ./nginx
   secrets:
     - nginx_cert
     - nginx_key
   volumes:
     - type: bind
       source: ./nginx/nginx.conf
       target: /etc/nginx/nginx.conf
       read_only: yes
   ports:
     - 80:8443
   networks:
     - frontend
   deploy:
     restart_policy: *default-restart_policy
     resources: *default-resources_policy

The Nginx service configuration will not encrypt or protect the connection, making all information exchanged through the link vulnerable to a variety of attacks or snooping.

server {
       server_name scw-dev-blog.org;
       listen 8443;
       ssl_protocols TLSv1.2 TLSv1.3;
       ssl_ciphers EECDH+AESGCM:EDH+AESGCM;
       ssl_prefer_server_ciphers on;
       ssl_certificate /run/secrets/nginx_cert;
       ssl_certificate_key /run/secrets/nginx_key;
       access_log /dev/stdout;
       error_log /dev/stderr;
       location / {
           proxy_pass http://wordpress:8080;
           proxy_set_header Host $http_host;
           proxy_set_header X-Forwarded-Host $http_host;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_set_header X-Forwarded-Proto $scheme;
       }
   }

Often times, the first signal that someone might be snooping through your transport layers is when a large number of stolen user passwords are used in subsequent attacks. If other data like customer information, financial records or important company secrets are stolen via an insecure transport layer, you may never even realize that you have been compromised.

And it's not just the transport layer between users and applications that requires protection. On the backend, many applications communicate with one another and with servers farther along in the workflow chain. While these internal communications are generally not vulnerable to outside snooping, it can expose data to users who may be allowed on the network but not authorized to see certain highly-protected or sensitive information.

Properly securing transport layers for total data protection

Protecting transport layers is best done while applications are being created. This process begins with having a secure backend infrastructure. For websites, everything should be done using HTTPS. Never mix HTTP and HTTPS infrastructure. You should even set your sites to automatically route unsecured HTTP requests over to the HTTPS infrastructure.

In the example from above, a proper method of protecting the transport layer would be:

server {
       server_name scw-dev-blog.org;
       listen 8443 ssl;
       ssl_protocols TLSv1.2 TLSv1.3;
       ssl_ciphers EECDH+AESGCM:EDH+AESGCM;
       ssl_prefer_server_ciphers on;
       ssl_certificate /run/secrets/nginx_cert;
       ssl_certificate_key /run/secrets/nginx_key;
       access_log /dev/stdout;
       error_log /dev/stderr;
       location / {
           proxy_pass http://wordpress:8080;
           proxy_set_header Host $http_host;
           proxy_set_header X-Forwarded-Host $http_host;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_set_header X-Forwarded-Proto $scheme;
       }
   }

In that example, all connections with the Nginx service are strongly encrypted. The server section of the Nginx configuration only includes listen 8443 ssl in order to force SSL to protect connections.

To protect your data from insider threats, developers should employ a strong transport layer encryption protocol like TLS 1.2. Once you have TLS 1.2 or its equivalent in place, weaker protocols like SSL v2 should be completely removed from your infrastructure and automatically barred from ever being used.

And always keep in mind that securing an application isn't fully complete until both the data at rest and the transport layers are sufficiently protected. That way you can guarantee complete end-to-end protection for data both internally and when flowing to authorized external users.
Check out the Secure Code Warrior blog pages for more insight about this vulnerability and how to protect your organization and customers from the ravages of other security flaws. You can also try a demo of the Secure Code Warrior training platform to keep all your cybersecurity skills honed and up-to-date.

태그라인

Govern AI-driven development before it ships

Measure AI-assisted risk, enforce secure coding policy at commit, and accelerate secure delivery across your SDLC.

book a demo
태그라인

Explore more blogs

우리는 이 방법을 잘 알고 있습니다. 우리는 이 두 가지 축복을 골고루 살기 위해 노력하고 있습니다.

browse all
Case Study
Filter Label
This is some text inside of a div block.

Supercharged Security Awareness: How Tournaments are Inspiring Developers at Erste Group

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Learn More
Case Study
Filter Label
This is some text inside of a div block.

Security as culture: How Blue Prism cultivates world-class secure developers

Learn how Blue Prism, the global leader in intelligent automation for the enterprise, used Secure Code Warrior's agile learning platform to create a security-first culture with their developers, achieve their business goals, and ship secure code at speed

Learn More
Case Study
Filter Label
This is some text inside of a div block.

One Culture of Security: How Sage built their security champions program with agile secure code learning

Discover how Sage enhanced security with a flexible, relationship-focused approach, creating 200+ security champions and achieving measurable risk reduction.

Learn More
Blog
Filter Label
This is some text inside of a div block.

The Future of AI Software Governance Is Built on Strong Partnerships

Discover why Secure Code Warrior is becoming a channel-first company and how trusted partners help organizations adopt AI Software Governance securely and at scale.

Learn More
Blog
Filter Label
This is some text inside of a div block.

Citizen AI by Secure Code Warrior: Build an AI-Ready Workforce

Secure Code Warrior's AI literacy program for non-developer employees.

Learn More
Blog
Filter Label
This is some text inside of a div block.

Why most CISOs are navigating AI adoption blindfolded (and how they can remove it)

Today, Secure Code Warrior issued an all-new white paper covering a prescriptive, directional AI adoption model that security leaders can use to identify their adoption stage and make real progress in bringing the AI security risks within their organization under control.

Learn More

Secure AI-driven development before it ships

See developer risk, enforce policy, and prevent vulnerabilities across your software development lifecycle.

Book a demo