Skip to content

tls: check the server Finished in TLS client - #5301

Merged
gpotter2 merged 1 commit into
secdev:masterfrom
musthaf-bughunter:tls-client-check-server-finished
Nov 25, 2026
Merged

gpotter2 merged 1 commit into
secdev:masterfrom
musthaf-bughunter:tls-client-check-server-finished

Conversation

@musthaf-bughunter

@musthaf-bughunter musthaf-bughunter commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Description

TLSFinished.post_dissection stores the verify_data check in finished_valid, but TLSClientAutomaton never reads it: HANDLED_SERVERFINISHED (TLS <= 1.2) and TLS13_HANDLED_FINISHED (TLS 1.3, also reached on the PSK path without CertificateVerify) continue after an invalid server Finished. The server already rejects an invalid client Finished; RFC 5246 sect 7.4.9 and RFC 8446 sect 4.4.4 require the check on both sides.

Against a server sending TLSFinished(vdata=b"\x00" * 12), the client logs TLS: invalid Finished received, then TLS handshake completed! and exchanges application data. The client now sends a decrypt_error alert and stops, as for the ServerKeyExchange signature and TLS 1.3 CertificateVerify.

@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 36.36364% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.67%. Comparing base (0e2f6ba) to head (c993b83).
⚠️ Report is 15 commits behind head on master.

Files with missing lines Patch % Lines
scapy/layers/tls/automaton_cli.py 36.36% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5301      +/-   ##
==========================================
+ Coverage   80.06%   80.67%   +0.61%     
==========================================
  Files         375      375              
  Lines       98775    98879     +104     
==========================================
+ Hits        79083    79772     +689     
+ Misses      19692    19107     -585     
Files with missing lines Coverage Δ
scapy/layers/tls/automaton_cli.py 85.72% <36.36%> (-0.57%) ⬇️

... and 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gpotter2

Copy link
Copy Markdown
Member

Thanks for the PR, exceptionally I think the tests are not really useful.

@gpotter2 gpotter2 self-assigned this Nov 22, 2026
TLSFinished.post_dissection stores the verify_data check in
finished_valid, but TLSClientAutomaton never read it and completed the
handshake after an invalid server Finished. Abort with a decrypt_error
alert, as TLSServerAutomaton already does for the client Finished.

AI-Assisted: yes (Claude Opus 5.5)
@musthaf-bughunter
musthaf-bughunter force-pushed the tls-client-check-server-finished branch from f2867cf to c993b83 Compare November 25, 2026 07:05
@musthaf-bughunter

Copy link
Copy Markdown
Contributor Author

Fair enough, dropped them. Only the automaton_cli change is left now.

@gpotter2
gpotter2 merged commit 62568e4 into secdev:master Nov 25, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants