Ethical › Module 20 › Lesson 2
TLS on the Wire During a Test
Padlock is not “site is safe.” Inspect certs on hosts in scope.
Visual · tls_padlock_not_safe
A padlock means an encrypted path to a name that matched a trusted chain. It is not a malware scan, not a honesty medal, and not a warrant to MITM anyone.
Opening
The padlock is a finished handshake to a name — not a medal that the shop is honest, and not a license to intercept.
Lesson 1 put hashing and encryption back in separate drawers. This lesson carries Topic 8 TLS into the authorized-tester frame. When a browser shows a padlock, the client and server already ran TLS: ClientHello, a certificate, key agreement, then HTTP inside ciphertext. HTTPS is that pairing. A café observer who is not supposed to read your password should see TLS records, not POST /login in ASCII. That is what encryption on the wire is for. It is not what “the site is safe” means. A phishing page can obtain a valid certificate for a look-alike hostname. TLS did its job — encrypted path to that name. The human still has to read the name. Testers who write “HTTPS so the host is trusted” in a finding have failed this lesson the same way “encrypted SHA-256” failed Lesson 1. During a test you inspect certificates on hosts that are in scope: subject, issuer, dates, SANs, name match, and whether HTTP still volunteers the letter. You do not install a fake CA on a family tablet to “see real TLS.” You do not run mitmproxy on café Wi-Fi. You do not sslstrip a roommate. example.com is the documentation host this course already named in Topic 8 — reading its public leaf is the same fetch a browser already does, not a pentest of IANA, not exploitation. This is original Cyberlium teaching mapped to the CEH v13 cryptography domain — not official EC-Council training, not a cert, not exam dumps. Next lesson is Keys You Must Not Paste in Reports: redact secrets; toy keys live in cyberlium-lab at chmod 600.
1. What the padlock actually proved: encrypted path to a matching name
Carry Topic 8 without rerunning the whole handshake lab. TLS 1.3 starts with ClientHello: versions, AEAD cipher suites (AES-GCM or ChaCha20-Poly1305), a key_share for ephemeral Diffie–Hellman, and almost always Server Name Indication — the hostname you asked for, so a server that hosts many sites can pick the right certificate. After ServerHello, the rest of the handshake is encrypted. The server sends a certificate chain and CertificateVerify (a signature over the transcript with the private key that matches the leaf). The client checks: is this certificate issued for the name I asked for (SAN match), is the chain trusted (a CA the client already has), are the dates valid, does the signature verify? Only then do application traffic keys wrap GET and POST. Forward secrecy is the operational sentence: ephemeral DH so a stolen long-term private key next year should not decrypt today’s recorded sessions. You do not implement the curve math. You do not craft a downgrade kit. You write what the padlock means in a report: confidentiality and authentication of the name, not a background check on the shop.
What often remains on the wire is metadata: IPs, ports, sizes, timing, and sometimes the hostname (DNS, SNI) unless those channels are encrypted too. Module 8 already said a VPN moves which clerk holds the envelope; it does not replace HTTPS to the website. Prefer HTTPS on everything you run. Leftover http:// on a service YOU control is a finding because you volunteered the letter. Decrypting other people’s HTTPS is not a finding you are assigned to cause. If you type a password into the wrong hostname, TLS will encrypt the mistake. The padlock will still light. That is why “padlock = safe site” is a sentence this lesson exists to kill.
Command guide
What the padlock proved — WHAT/WHY
═══ INSTALL ═══
Linux (Debian/Ubuntu):
Command — copy this
sudo apt install curl
macOS: Built-in
Windows: Built-in (PowerShell: Invoke-WebRequest)
═══ COMMANDS ═══
Command — copy this
curl -sS -m 8 -vI "https://example.com/" 2>&1 | grep -iE "subject:|issuer:|SSL connection|HTTP/" | head -n 20
2. What a tester inspects on hosts in scope: fields, not interception
On a host named in written RoE — or, for this course’s literacy drill, example.com or a domain YOU own — you read the public leaf the way Topic 8 taught: subject, issuer, notBefore, notAfter, subjectAltName, and whether the name you typed appears on that SAN list. openssl s_client completes a TLS client handshake and prints PEM. openssl x509 prints the fields. Python’s ssl module can show the same decoded dict a browser already used. curl -vI shows that HTTPS answered. None of those commands decrypts other people’s sessions. None of them plants a CA. -servername (SNI) is not optional on modern multi-site hosts: without it you may get a default cert that does not match the name you intended — a useful lesson, not a reason to skip SNI. Write the name you typed, then the SAN list, then yes/no match. Expired dates, a name mismatch, or HTTP on port 80 next to a TLS service are reportable conditions on systems you are allowed to test. They are not a warrant to break the handshake.
Scope is still Module 1. example.com is in this lesson’s contract as a public documentation host. A hostname whose DNS you control is in contract. A bank you do not operate, a school VPN appliance you saw on a sticker, and a neighbor’s router admin page are not “more realistic TLS labs.” Visiting a public website in a browser is ordinary. Silently intercepting that visit for someone else is not. A professional test that includes TLS review still does not include installing your own root on employees’ laptops unless the RoE explicitly names that method — and this Cyberlium path does not assign that method. Recognition and field literacy are the assignment. Empty ethics lines fail. Notes that include a classmate’s captured cookies fail ethics even if openssl ran.
Command guide
Inspect fields on in-scope hosts — WHAT/WHY (not interception)
═══ INSTALL ═══
Linux (Debian/Ubuntu):
Command — copy this
sudo apt install openssl sudo apt install python3
macOS:
Command — copy this
brew install python3
Windows:
Command — copy this
choco install openssl
Download https://python.org/downloads/
═══ COMMANDS ═══
Command — copy this
python3 - << 'PY'
import ssl, socket
ctx = ssl.create_default_context()
with ctx.wrap_socket(socket.socket(), server_hostname='example.com') as s:
s.settimeout(8); s.connect(('example.com', 443))
c = s.getpeercert()
print('subject', c.get('subject'))
print('notAfter', c.get('notAfter'))
print('ethics: public fields; no intercept kit; not exploiting example.com')
PY3. example.com public cert literacy: documentation host, not a target you exploit
example.com exists so documentation can show a hostname without aiming at a random company. Topic 8 already used it for certificate labs. Module 20 uses it the same way: you may complete a client handshake to port 443, read the leaf fields, and write them in your notes. You are not pentesting IANA. You are not looking for a CVE on example.com. You are not fuzzing it. You are not running a directory brute. You are not “validating the padlock by intercepting.” You are practicing the same read a browser performed. If openssl is missing on Windows, use Git Bash, WSL, or Python’s ssl module — not an app-store “HTTPS spy” VPN that installs a CA. If s_client waits after the PEM, end the client (Ctrl+C) or feed it closed stdin (echo |) as in the script. Save a PEM of the public leaf if you want; chmod 600 it because the folder will hold lab secrets in Lesson 3. Never save anyone’s private key. A public certificate is not a private key. Mixing those files is how people paste BEGIN PRIVATE KEY into a ticket (next lesson).
Optional challenge: repeat the same field read on a domain YOU own and compare issuer and validity with example.com. Still public certs. Still your notes. Still no MITM. Do not “borrow” a friend’s shop hostname to make the words feel real. Do not point openssl at an internal hostname you are not allowed to test because a scanner once printed it. Module 2 already forbade turning a DNS fact into a scan. This lesson forbids turning a DNS fact into an intercept.
Command guide
example.com public cert literacy — WHAT/WHY then lock
═══ INSTALL ═══
Linux (Debian/Ubuntu):
Command — copy this
sudo apt install openssl
macOS: Built-in
Windows:
Command — copy this
choco install openssl
═══ COMMANDS ═══
Command — copy this
cat >> "$NOTES" << 'EOF' host: example.com documentation not: a target I exploit EOF
4. What the padlock does not prove — and what you must never do to “see TLS”
A valid certificate does not mean the page is malware-free. It does not mean the business is legitimate. It does not mean the HTML is the bank you bookmarked. It does not mean cookies are HttpOnly (Module 11 named flags; TLS is a different control). It does not mean the application parameterized its SQL (Module 15). Testers who collapse every control into the padlock write useless reports. Write separate sentences: transport is TLS to this name; the name matched; dates were valid; the chain was trusted by this client. Then, if in scope, write application findings without pretending HTTPS erased them. Phishing literacy from Topic 5 and Module 9 still owns the lure: open the official app, do not authenticate through a surprise link that happens to have a padlock.
MITM, fake CAs, sslstrip, “install this profile to debug,” and café proxies are out of this course the way hashcat was out of Lesson 1. An active interceptor presents a certificate the victim’s client will accept only if the client trusts a CA the interceptor controls — which is why planting a CA on someone else’s device is the failure mode Topic 8 already named. Doing that to a family tablet, a classmate laptop, or a café guest is unauthorized access dressed as homework. verify=False in a script you then point at a bank turns TLS into encryption to whoever answered. Do not globally ignore hostname checks. Do not ship a client that skips verification “just for debugging” and then forget. Fix trust stores on machines you own, or fix the server certificate on a stack you run. This lesson’s hands stay on public fields and locked notes.
5. What you record: fields, name match, padlock-is-not-safe, refuse MITM
A TLS-on-the-wire note is boring on purpose. Date (UTC). Host typed (example.com or a domain YOU own, or an in-scope name if you actually have written RoE — this course’s default is example.com). Subject, issuer, notBefore, notAfter, SAN, name match yes/no. One sentence: padlock means encrypted path to a matching name, not “site is safe.” Ethics: NEVER MITM, NEVER fake CA, NEVER intercept others, NEVER sslstrip, NEVER café proxy, NEVER private keys in the notes. Legal line: original Cyberlium teaching mapped to the CEH v13 cryptography domain — not official EC-Council training, not a cert, not exam dumps. Path: $HOME/cyberlium-lab/tls-test-notes.txt, chmod 600. Empty placeholders fail. World-readable 777 fails. A pcap of the floor fails even if the fields were also written.
A useful feeling: the lesson is “too small” because you did not decrypt a stranger’s session. That feeling is how people graduate into unauthorized intercepts. The skill is stopping at fields. Lesson 4 will combine YOUR file hash with this same example.com read. Lesson 3 will stop you pasting the PEM’s cousin — a private key — into a PDF. Until then, filled fields and a refuse line are a complete Lesson 2.
6. Wrong vs right: café MITM / fake CA vs public fields on a host in scope
Worked failure — same openssl binary, opposite leftover files. Right is a public leaf and written fields, never an intercept.
Wrong
mitmproxy on café Wi-Fi. Fake CA on a family tablet or classmate laptop. sslstrip a roommate. openssl against an internal hostname you are not allowed to test. certutil -addstore the lab PEM. verify=False at a bank. Paste live cookies or a PRIVATE KEY into tls-test-notes.txt. Call the lab done because curl returned 200 with no fields written. Claim this path is official CEH training. It is not.
Right
Read subject, issuer, dates, and SAN on example.com or a domain YOU own (or a host named in written RoE). Write that the padlock is not “site is safe.” Fill $HOME/cyberlium-lab/tls-test-notes.txt, chmod 600. No fake CA. No interception. Next: Keys You Must Not Paste in Reports — redact secrets; lab keys in cyberlium-lab chmod 600.
7. Hands-on: public cert fields on example.com, then lock tls-test-notes.txt
Create the lab directory. Run the dump against example.com (or a domain YOU own). Fill every placeholder in tls-test-notes.txt in your own words — empty templates fail. chmod 600. If openssl is missing, use the Python block; do not substitute a TLS-intercepting VPN. Windows: Git Bash, WSL, or py. Do not add a second host that is not yours. Do not install the PEM as a CA.
Command guide
tls_test_fields.sh — example.com public cert literacy; never MITM / never fake CA
═══ INSTALL ═══
Linux (Debian/Ubuntu):
Command — copy this
sudo apt install openssl sudo apt install python3 sudo apt install dnsutils
macOS:
Command — copy this
brew install python3
Windows:
Command — copy this
choco install openssl
Download https://python.org/downloads/ Use nslookup (built-in)
═══ COMMANDS ═══
Command — copy this
cd "$HOME/cyberlium-lab" HOST="example.com" # documentation host, OR a domain YOU own. Not a random company.
Command — copy this
| openssl x509 -noout -subject -issuer -dates -ext subjectAltName
Command — copy this
| openssl x509 -outform PEM > "$HOME/cyberlium-lab/tls-test-leaf.pem"
Command — copy this
cat > "$HOME/cyberlium-lab/tls_test_fields.py" << 'PY'
"""Public cert fields for example.com (or a domain YOU own). Not MITM."""
import socket
import ssl
HOST = "example.com" # documentation host — not a target you exploit
ctx = ssl.create_default_context()
with socket.create_connection((HOST, 443), timeout=10) as sock:
with ctx.wrap_socket(sock, server_hostname=HOST) as ssock:
cert = ssock.getpeercert()
print("host:", HOST)
print("tls_version:", ssock.version())
print("subject:", cert.get("subject"))
print("issuer:", cert.get("issuer"))
print("notBefore:", cert.get("notBefore"))
print("notAfter:", cert.get("notAfter"))
print("SAN:", cert.get("subjectAltName"))
print("padlock_means: encrypted path to a matching name — NOT site is safe")
print("ethics: public cert only; NEVER MITM; NEVER fake CA; NEVER intercept others")
PYCommand — copy this
python3 "$HOME/cyberlium-lab/tls_test_fields.py" || python "$HOME/cyberlium-lab/tls_test_fields.py"
Command — copy this
{Command — copy this
"$HOME/cyberlium-lab/tls-test-leaf.pem" \
"$NOTES" || chmod 600 "$NOTES"Mission: tls-test-notes.txt — public fields, chmod 600
1) Read subject, issuer, dates, and SAN from example.com or a domain YOU own (openssl and/or Python ssl). Write name match yes/no. 2) Fill $HOME/cyberlium-lab/tls-test-notes.txt with the padlock-is-not-safe sentence, legal line, and ethics refuse line. chmod 600. 3) Ethics: no MITM, no fake CA, no sslstrip, no café proxy, no intercepting others, no private keys in the notes.
Stuck? Ask Cyberlium AI Mentor
If “I need a proxy to see a real cert” still feels true, ask for a hint — not mitmproxy. Try: "Hint only: how openssl s_client plus x509 or Python ssl prints subject/issuer/dates on example.com, why the padlock is not site-is-safe, and why installing the PEM as a CA is out of scope?" You still fill tls-test-notes.txt. No fake roots. No intercepting others. No live cookies.
You now inspect TLS the way an authorized tester should: fields on a host in scope, a padlock that does not mean “safe site,” and a hard stop on interception. example.com was documentation literacy, not a hunt. Notes are locked in cyberlium-lab. This is original Cyberlium teaching mapped to the CEH v13 cryptography domain — not official EC-Council training, not a cert, not exam dumps. Next — Keys You Must Not Paste in Reports — redact secrets. Store lab keys in cyberlium-lab at chmod 600. A PDF that travels is not a vault.
Knowledge Check
APPLY: A teammate sees a padlock, writes “site is safe,” and wants mitmproxy on café Wi-Fi “to inspect TLS for CEH.” What did the padlock prove, and what do you do?
Multiple choice
Knowledge Check
APPLY: True or False: example.com public cert literacy is exploitation, so the ethical homework is a fake CA against classmates to “see real TLS.”
True or False
Knowledge Check
APPLY: You are filling tls-test-notes.txt. Which pairing matches allowed surface and hygiene?
Multiple choice
Knowledge Check
APPLY: curl of http://192.168.0.1/ shows a home router login (TP-Link / Netgear / Huawei / "Router Admin"). Is that DEMO in scope as a hacking target?
Multiple choice