Fundamentals

T1573

TLS and Certificates

How TLS encryption works, the handshake process, cipher suite selection, TLS 1.3 improvements, certificate transparency, and the indicators analysts use to spot suspicious TLS traffic.

View on Graph

What TLS Is and How It Encrypts Network Traffic

  • TLS (Transport Layer Security) is the cryptographic protocol that encrypts communication between two endpoints — typically a client (browser, application) and a server (web server, API, C2 infrastructure).
  • TLS replaced SSL (Secure Sockets Layer), which was deprecated after the POODLE attack in 2014.
  • TLS 1.2 (RFC 5246, 2008) remains the most widely deployed version.
  • TLS 1.3 (RFC 8446, 2018) is the current standard and significantly improves security and speed.

The TLS Handshake Step by Step

The TLS handshake is the negotiation that establishes encrypted communication. Understanding it is critical for analysts because the handshake reveals information about both the client and server — even without decrypting the payload.

TLS 1.2 Handshake (4 round trips — slower but still dominant)

Client                     Server
  │                          │
  │  ClientHello              │
  │  ├─ Supported TLS version │
  │  ├─ Cipher suites list    │
  │  ├─ Random bytes          │
  │  └─ Session ID (optional) │
  │─────────────────────────>│
  │                          │
  │  ServerHello              │
  │  ├─ Selected TLS version  │
  │  ├─ Selected cipher suite │
  │  └─ Random bytes          │
  │  ServerCertificate       │
  │  ├─ Server's public key   │
  │  └─ CA signature chain    │
  │  ServerHelloDone          │
  │<─────────────────────────│
  │                          │
  │  ClientKeyExchange       │
  │  └─ Pre-master secret     │
  │     (encrypted with       │
  │      server's public key) │
  │  ChangeCipherSpec         │
  │  Finished                 │
  │─────────────────────────>│
  │                          │
  │  ChangeCipherSpec         │
  │  Finished                 │
  │<─────────────────────────│
  │                          │
  │  ── Encrypted data ────> │

The pre-master secret is the key insight: the client generates a random value, encrypts it with the server’s public key, and sends it. Only the server can decrypt it with its private key. Both sides then derive the session keys from this shared secret.

TLS 1.3 Handshake (1 round trip — much faster)

Client                     Server
  │                          │
  │  ClientHello              │
  │  ├─ Supported versions    │
  │  ├─ Key share (Client     │
  │  │  sends its public key  │
  │  │  guess in advance)     │
  │  ├─ PSK (if resuming)     │
  │  └─ Supported signature   │
  │     algorithms            │
  │─────────────────────────>│
  │                          │
  │  ServerHello              │
  │  ├─ Selected version      │
  │  ├─ Key share (Server's   │
  │  │  public key)           │
  │  ├─ Certificate + verify  │
  │  └─ Finished              │
  │<─────────────────────────│
  │                          │
  │  ── Encrypted data ────> │

TLS 1.3 removed:

  • Cipher suites with static RSA key exchange (all must use forward secrecy)
  • CBC mode ciphers (only AEAD ciphers: AES-GCM, ChaCha20-Poly1305)
  • Compression
  • Renegotiation

Cipher Suite Selection — What Each Part Means

A cipher suite defines the cryptographic algorithms used in a TLS session. It has four parts:

TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384

ComponentMeaningOptions
TLSProtocol prefixTLS
ECDHEKey exchange algorithmRSA, DH, DHE, ECDHE, PSK
RSAAuthentication / signature algorithmRSA, ECDSA, DSA
AES_256_GCMSymmetric encryption + modeAES_128_GCM, AES_256_GCM, CHACHA20_POLY1305
SHA384HMAC hash for message integritySHA256, SHA384

Detection implications:

  • C2 malware often requests unusual cipher suites — a tool that hardcodes the cipher suite list (rather than using the OS TLS library) will have a unique JA3 fingerprint
  • TLS 1.3 only allows 5 cipher suites — if you see TLS 1.3 sessions with non-standard cipher suites, the traffic is likely custom/abnormal
  • RSA key exchange (no PFS) is increasingly rare — most modern clients prefer ECDHE. Seeing RSA key exchange is a strong signal of legacy software or attacker tooling

Detection — Indicators in TLS Traffic

Without Decryption

You can spot suspicious TLS traffic by inspecting the handshake metadata — no certificate inspection, no decryption required.

IndicatorWhat It SuggestsWhat to Check
Unusual JA3 fingerprintNon-standard TLS stack — could be malwareCompare JA3 against known malware fingerprints. See if it appears on only one host.
TLS version mismatchClient offers only TLS 1.0 or 1.1Outdated software or intentional downgrade. TLS 1.0 should not appear anywhere.
Cipher suite inconsistencyClient requests TLS 1.3 ciphers then negotiates TLS 1.2Abnormal — may indicate a custom TLS stack with inconsistent capabilities
No ALPN negotiationClient sends HTTP/1.1, does not negotiate HTTP/2Normal for some apps (curl, custom clients). But seeing no ALPN across all connections from a host is suspicious.
Constant handshake timeBeaconing — malware connects to C2 at precisely regular intervalsTime between handshake completions is within ±100ms for all events
No SNIClient does not send the server nameC2 servers often do not check SNI. Legitimate browsers always send SNI. Missing SNI to a known domain is suspicious.

With Certificate Inspection

IndicatorWhat It Suggests
Self-signed certificateC2 infrastructure, dev/test, internal-only service exposed to internet
Expired certificateAbandoned infrastructure or C2 that does not rotate
Mismatched CNCertificate CN does not match the domain the client is connecting to
Subject = “localhost” or IPNot a legitimate public-facing service
Organizational unit = company nameDoes the certificate’s organization match who you expect runs the server?
Certificate issued by Let’s EncryptLegitimate and common — but also used by C2 infrastructure (free, automated, 90-day certs). Not suspicious by itself but worth noting.
Certificate chain too shortLeaf cert → Root CA with no intermediary. Unusual for legitimate services (normally chain through 2-3 intermediates).
Certificate freshly issued, domain oldDomain existed for years, suddenly gets new certificate after no changes for a long time — possible domain takeover

C2 Detection via TLS Fingerprinting

Attackers building C2 infrastructure often use default TLS configurations. These stand out against the background of legitimate traffic.

Common C2 TLS patterns:

PatternWhy It HappensDetection
No OCSP staplingMost C2 frameworks do not configure OCSP must-stapleCheck TLS handshake for OCSP response absence — not definitive alone, but with other indicators it adds weight
Self-signed or Let’s Encrypt certFree, easy to set up, no vettingCross-reference with JA3 and domain age
TLS 1.2 only (no 1.3)C2 frameworks based on older libraries (e.g., Go net/http default, older OpenSSL)TLS 1.2-only connections from a host that normally uses 1.3 is a signal
HTTP/1.1 only (no HTTP/2)C2 tools do not implement HTTP/2Compare with host’s typical HTTP versions
Single cipher suite (no negotiation)Hardcoded cipher in the malware, no fallback logicMost TLS libraries offer 10+ cipher suites. A single cipher is extremely unusual.
Session resumption disabledMalware does not care about performanceCheck if session tickets are issued — most servers issue them automatically

SPL query — detect C2 by JA3 + self-signed cert + domain age:

index=network sourcetype=tls_metadata
| search self_signed=true AND ja3_hash NOT IN (known_good_ja3_hashes) OR tls_version="TLSv1.2" only
| lookup domain_whois_lookup domain_name OUTPUT registration_date
| eval domain_age_days = (now() - registration_date) / 86400
| where domain_age_days < 90
| stats values(domain_name) as Domains, values(ja3_hash) as JA3, values(issuer) as Issuer by src_ip, dest_ip
| eval alert = "HIGH — possible C2: self-signed cert + unusual JA3 + young domain"

TLS Hardening for Defenders

ControlWhat It Prevents
Disable TLS 1.0 and 1.1Protocol downgrade attacks, POODLE, BEAST
Enable TLS 1.3Faster, more secure handshake, removes weak ciphers
Disable static RSA key exchangeEnsures forward secrecy
Enable HSTS preloadingPrevents SSL stripping by forcing browsers to always use HTTPS
Use OCSP must-stapleEnsures clients get OCSP status during handshake
Monitor JA3 fingerprintsDetects non-standard TLS clients
Deploy certificate transparency monitoringDetects rogue certificates issued for your domains
Short certificate lifetimes (90 days)Minimizes impact of key compromise

Sources