Page MenuHomeFreeBSD

ktls_ocf: Reject encrypted TLS records using AEAD that are too small.
ClosedPublic

Authored by jhb on Nov 12 2022, 12:02 AM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 26 2024, 8:02 PM
Unknown Object (File)
Oct 4 2024, 1:26 PM
Unknown Object (File)
Oct 4 2024, 11:35 AM
Unknown Object (File)
Oct 1 2024, 5:28 AM
Unknown Object (File)
Sep 27 2024, 7:20 PM
Unknown Object (File)
Sep 10 2024, 11:19 AM
Unknown Object (File)
Sep 6 2024, 3:23 AM
Unknown Object (File)
Sep 5 2024, 9:41 PM
Subscribers

Details

Summary

If a TLS record is too small to contain the required explicit IV,
record_type (TLS 1.3), and MAC, reject attempts to decrypt it with
EMSGSIZE without submitting it to OCF. OCF drivers may not properly
detect that regions in the crypto request are outside the bounds of
the mbuf chain. The caller isn't supposed to submit such requests.

Sponsored by: Chelsio Communications

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Nov 12 2022, 12:02 AM

A sample panic for TLS 1.2 I got when running the tests in the next commit without this fix:

panic: payload outside input buffer
cpuid = 7
time = 1668209857
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0115cd2b20
vpanic() at vpanic+0x151/frame 0xfffffe0115cd2b70
panic() at panic+0x43/frame 0xfffffe0115cd2bd0
crp_sanity() at crp_sanity+0x44c/frame 0xfffffe0115cd2c00
crypto_dispatch_one() at crypto_dispatch_one+0x12/frame 0xfffffe0115cd2c20
ktls_ocf_dispatch() at ktls_ocf_dispatch+0x5d/frame 0xfffffe0115cd2c70
ktls_ocf_tls12_aead_decrypt() at ktls_ocf_tls12_aead_decrypt+0x184/frame 0xfffffe0115cd2df0
ktls_work_thread() at ktls_work_thread+0x85c/frame 0xfffffe0115cd2ef0
fork_exit() at fork_exit+0x80/frame 0xfffffe0115cd2f30
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe0115cd2f30
--- trap 0xc, rip = 0x174f5bbf7ada, rsp = 0x174f57a84d98, rbp = 0x174f57a84db0 ---
This revision is now accepted and ready to land.Nov 14 2022, 3:14 PM