<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->
---
name: detecting-protocol-downgrade-attacks
description: >-
  Detect and prevent protocol downgrade attacks against TLS, SSH, and
  authentication protocols. Covers POODLE, DROWN, Logjam, FREAK detection,
  version rollback testing, cipher suite negotiation analysis, and
  downgrade-resistant configuration hardening.
domain: cybersecurity
subdomain: cryptography
tags:
  - downgrade-attack
  - poodle
  - drown
  - logjam
  - freak
  - tls-fallback
  - cipher-negotiation
version: "1.0"
author: defconxt
license: AGPL-3.0
metadata:
  mitre-attack: ["T1557"]
---

# Detecting Protocol Downgrade Attacks

## Overview

Protocol downgrade attacks force endpoints to negotiate weaker protocol
versions or cipher suites. Attacks like POODLE, DROWN, Logjam, and FREAK
exploit legacy protocol support to break otherwise secure connections. This
skill covers detection of downgrade vulnerabilities, version rollback testing,
and configuring downgrade-resistant systems.

## Prerequisites

| Requirement | Install |
|---|---|
| OpenSSL 3.x | `apt install openssl` |
| nmap + ssl scripts | `apt install nmap` |
| testssl.sh | `git clone https://github.com/drwetter/testssl.sh` |
| Python 3.10+ | For agent tooling |

## Key Concepts

### TLS Version Downgrade Testing

```bash
# Test for SSLv3 support (POODLE)
openssl s_client -connect target:443 -ssl3 < /dev/null 2>&1 | grep Protocol

# Test for TLS 1.0/1.1 support
openssl s_client -connect target:443 -tls1 < /dev/null 2>&1 | grep Protocol
openssl s_client -connect target:443 -tls1_1 < /dev/null 2>&1 | grep Protocol

# Check TLS_FALLBACK_SCSV (RFC 7507)
openssl s_client -connect target:443 -fallback_scsv -tls1_1 < /dev/null 2>&1

# Enumerate all supported versions
for proto in ssl3 tls1 tls1_1 tls1_2 tls1_3; do
  result=$(openssl s_client -connect target:443 -"$proto" < /dev/null 2>&1)
  echo "$proto: $(echo "$result" | grep Protocol)"
done
```

### Cipher Suite Analysis

```bash
# Enumerate with nmap
nmap --script ssl-enum-ciphers -p 443 target.example.com

# Check EXPORT ciphers (FREAK)
openssl s_client -connect target:443 -cipher EXPORT < /dev/null 2>&1

# Check weak DH (Logjam)
openssl s_client -connect target:443 < /dev/null 2>/dev/null | \
  grep "Server Temp Key"

# Check RC4 and NULL
openssl s_client -connect target:443 -cipher RC4 < /dev/null 2>&1
openssl s_client -connect target:443 -cipher NULL < /dev/null 2>&1
```

### Vulnerability Scanning

```bash
# Comprehensive scan with testssl.sh
./testssl.sh --vulnerable target.example.com:443

# Specific checks
./testssl.sh --poodle target.example.com:443
./testssl.sh --drown target.example.com:443
./testssl.sh --logjam target.example.com:443
./testssl.sh --freak target.example.com:443
```

### SSH Downgrade Detection

```bash
# Check supported SSH algorithms
nmap --script ssh2-enum-algos -p 22 target.example.com

# Test weak key exchange
ssh -o KexAlgorithms=diffie-hellman-group1-sha1 target 2>&1
```

## Known Vulnerabilities

| Name | CVE | Condition |
|---|---|---|
| POODLE | CVE-2014-3566 | SSLv3 CBC padding oracle |
| DROWN | CVE-2016-0800 | SSLv2 cross-protocol |
| Logjam | CVE-2015-4000 | DH group < 1024 bits |
| FREAK | CVE-2015-0204 | EXPORT cipher downgrade |

## Workflow

1. **Enumerate** — Test supported protocol versions and ciphers
2. **Detect** — Identify known downgrade vulnerabilities
3. **Analyze** — Assess cipher ordering and key exchange strength
4. **Test** — Attempt version rollback with fallback signaling
5. **Report** — Document vulnerable endpoints with CVEs
6. **Harden** — Disable weak protocols, enforce TLS 1.2+

## Verification

| Check | Method |
|---|---|
| No SSLv2/SSLv3 | Connection refused on both |
| No EXPORT ciphers | Negotiation fails |
| Strong DH params | Server temp key ≥ 2048 bits |
| FALLBACK_SCSV | Downgrade triggers `inappropriate_fallback` |

## References

- [RFC 7507 — TLS Fallback SCSV](https://datatracker.ietf.org/doc/html/rfc7507)
- [testssl.sh](https://testssl.sh/)
- [CVE-2014-3566 — POODLE](https://nvd.nist.gov/vuln/detail/CVE-2014-3566)
- [CVE-2016-0800 — DROWN](https://drownattack.com/)
