-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
Brief description
bytes(TLS_Ext_CSR) returns one additional byte when with TLS_Ext_CSR.len=0
The reason should be that:
- raw_packet_cache is not considered in
_GenericTLSSessionInheritance.__bytes__() <Field (TLS_Ext_CSR).stype>.i2m()method returns 0 even if val is None.
Environment
- Scapy version: 2.4.0.dev601
- Python: 3.6.5
- Operating System: Ubuntu
How to reproduce
ext_csr = TLS_Ext_CSR(b'\x00\x05\x00\x00')
>>> ext_csr.show()
###[ TLS Extension - Certificate Status Request ]###
type = status_request
len = 0
stype = None
\req \
Actual result
>>> bytes(ext_csr)
b'\x00\x05\x00\x00\x00'
Expected result
>>> ext_csr.raw_packet_cache
b'\x00\x05\x00\x00'
As a consequence, the length (and bytes) of the TCP payload is also wrong, e.g. in the example in the picture, instead of length=1360:
>>> len(pkt[TCP].payload)
1361
Related resources
traces / sample pcaps (stripped to the relevant frames), related standards, RFCs or other resources
