Remediation for SSL/TLS Recommended Cipher Suites (PCI DSS) Finding - NETSEC

Latest

Learning, Sharing, Creating

Cybersecurity Memo
Please enable / Bitte aktiviere JavaScript!
Veuillez activer / Por favor activa el Javascript![ ? ]

Thursday, January 16, 2025

Remediation for SSL/TLS Recommended Cipher Suites (PCI DSS) Finding

SSL/TLS Recommended Cipher Suites (PCI DSS) Vulnerability

Severity : MEDIUM

Tenable PLUGIN ID: 159543



 

Background

Our vulnerbaility scan found this issue. Some ssl/tls ports are using unsecure cipher suites such as: 
  • ECDHE-RSA-AES256-SHA
  • ECDHE-RSA-AES256-SHA384

Description

The remote host has open SSL/TLS ports which advertise discouraged cipher suites. It is recommended to only enable support for the following cipher suites: TLSv1.3: - 0x13,0x01 TLS13_AES_128_GCM_SHA256 - 0x13,0x02 TLS13_AES_256_GCM_SHA384 - 0x13,0x03 TLS13_CHACHA20_POLY1305_SHA256 TLSv1.2: - 0xC0,0x2B ECDHE-ECDSA-AES128-GCM-SHA256 - 0xC0,0x2F ECDHE-RSA-AES128-GCM-SHA256 - 0xC0,0x2C ECDHE-ECDSA-AES256-GCM-SHA384 - 0xC0,0x30 ECDHE-RSA-AES256-GCM-SHA384 - 0xCC,0xA9 ECDHE-ECDSA-CHACHA20-POLY1305 - 0xCC,0xA8 ECDHE-RSA-CHACHA20-POLY1305 - 0xCC,0xAA DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 This is the recommended configuration for the vast majority of services, as it is highly secure and compatible with nearly every client released in the last five (or more) years.


Solution

Only enable support for recommended cipher suites.




Tenable Scan Finding


The remote host has listening SSL/TLS ports which advertise the discouraged cipher suites outlined below: High Strength Ciphers (>= 112-bit key) Name Code KEX Auth Encryption MAC ---------------------- ---------- --- ---- --------------------- --- ECDHE-RSA-AES256-SHA 0xC0, 0x14 ECDH RSA AES-CBC(256) SHA1 ECDHE-RSA-AES256-SHA384 0xC0, 0x28 ECDH RSA AES-CBC(256) SHA384 The fields above are : {Tenable ciphername} {Cipher ID code} Kex={key exchange} Auth={authentication} Encrypt={symmetric encryption method} MAC={message authentication code} {export flag}


Basically, Tenable scanner is thinking our server is supporting AES-CBC encryption, but actually our server only supports AES-GCM. 

Verification

 
Find the cipher using Chrome
  1. Launch Chrome.
  2. Enter the URL you wish to check in the browser.
  3. Click on the ellipsis located on the top-right in the browser.
  4. Select More tools > Developer tools > Security.
  5. Look for the line "Connection...". This will describe the version of TLS or SSL used.






Testing Cipher Suites    

 

https://hackertarget.com/ssl-check/





2. Nmap

  • nmap --script ssl-enum-ciphers -p 443 1.1.1.1

root@ehq-syslog:~# nmap --script ssl-enum-ciphers -p 443 5.14.14.24
Starting Nmap 7.80 ( https://nmap.org ) at 2025-03-02 19:32 UTC
Nmap scan report for 52.149.142.234
Host is up (0.017s latency).

PORT    STATE SERVICE
443/tcp open  https
| ssl-enum-ciphers:
|   TLSv1.2:
|     ciphers:
|       TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A
|     compressors:
|       NULL
|     cipher preference: server
|_  least strength: A

Nmap done: 1 IP address (1 host up) scanned in 1.79 seconds
root@ehq-syslog:~#

3. Openssl

  • openssl s_client 1.1.1.1:443 -tls1_3 -cipher 'ALL:eNULL' 2>&1 | grep Cipher

Chatgpt should be able to help out for those commands. 

If you want to check all available cipher suites, you can use a loop in Bash:


for cipher in $(openssl ciphers 'ALL:eNULL' | tr ':' ' '); do echo Testing $cipher... openssl s_client -connect 1.1.1.1:443 -cipher $cipher </dev/null 2>&1 | grep -E "Cipher|handshake failure" done

Run this bash file using command "bash testing_cipher.sh".  This will attempt to connect using each cipher and display the result.

  • openssl s_client -connect 1.1.1.1:443 -cipher $cipher </dev/null 2>&1 | grep -E "Cipher|handshake failure" | grep -v 'NONE' | grep -v 'handshake failure'


Remediation


Nginx Configuration:
Since it is Nginx service. Here is the remediation configuraiton for this issue happening on port 443. 


server {
    listen       443 default_server ssl;            # 该 server 监听的地址(必填)
                ssl_certificate /usr/local/nginx/conf/ssl/*.cer;
                ssl_certificate_key  /usr/local/nginx/conf/ssl/*key;
                ssl_session_timeout 5m;
                ssl_protocols TLSv1.2 TLSv1.3;
                ssl_ciphers TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-CHACHA20-POLY1305;
                ssl_prefer_server_ciphers on;
                ssl_session_cache shared:SSL:20m;

 

    # 返回 403 Forbidden
                location / {
                        return 403;
                }
}

 

server {
    listen 80 default;

 

    return 301 https://$host$request_uri;
}


Disable Certain Cipher suite, e.g. Cipher    : ECDHE-RSA-AES256-SHA:


NGINX controls supported cipher suites using the ssl_ciphers directive in its configuration file (typically /etc/nginx/nginx.conf or /etc/nginx/sites-available/default).

ssl_ciphers 'HIGH:!ECDHE-RSA-AES256-SHA:!aNULL:!MD5:!RC4';

This means:

  • HIGH → Includes strong ciphers.
  • !ECDHE-RSA-AES256-SHA → Excludes this specific cipher.
  • !aNULL, !MD5, !RC4 → Exclude weak ciphers.
Restart nginx

then verify with following command:
  • openssl s_client -connect yourserver.com:443 -cipher ECDHE-RSA-AES256-SHA

Example:
Support ECDHE-RSA-AES256-GCM-SHA384 and ECDHE-ECDSA-ARIA256-GCM-SHA384
Disable ECDHE-RSA-AES256-SHA and ECDHE-RSA-AES256-SHA384

ssl_ciphers 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-ARIA256-GCM-SHA384:HIGH:!ECDHE-RSA-AES256-SHA:!ECDHE-RSA-AES256-SHA384:!aNULL:!MD5:!RC4';



References

  • https://www.ssllabs.com/ssltest/
  • https://hackertarget.com/ssl-check/

No comments:

Post a Comment