- ndpi_kerberos_msg_type2str(), ndpi_kerberos_name_type2str(),
ndpi_kerberos_error2str() (RFC 4120, RFC 4556, RFC 6113 error codes),
ndpi_kerberos_s4u2str()
- ndpi_kerberos_reply_ok(): the KDC issued the ticket (AS-REP/TGS-REP)
- ndpi_kerberos_reply_error(): name of the error of a KRB-ERROR reply
- ndpi_kerberos_client_name(): "user@realm", or "host$@realm" for a
machine; an enterprise name ending with the realm is used as it is,
otherwise its '@' are escaped ("user\@upn.suffix@realm")
- ndpi_kerberos2json(): used by ndpi_dpi2json() (same output)
ndpiReader uses them, and prints the name of the error code.
Names and realm were copied byte by byte: any non-ASCII byte was replaced
by '?' (e.g. "josé" became "jos??") and a name longer than the buffer was
silently truncated, i.e. exported as a different, wrong, name.
Now:
- valid UTF-8 is kept as is (only ASCII is lowercased); control characters
and invalid bytes are still replaced by '?'
- a multi-byte character is never split
- the new flags hostname_truncated, domain_truncated and
username_truncated report a truncated name
- the buffers are larger (hostname 64, domain 64, username 96), to fit long
enterprise names and realms (still within the protos union)
With S4U (MS-SFU) a service requests a ticket on behalf of a user: the
client name of the reply is the user, but the client of the flow is the
service. Without knowing it, the users of the metadata bind the user to
the host of the service.
Export it in the new field "s4u", set for the first TGS-REQ with:
- PA-FOR-USER (129) or PA-S4U-X509-USER (130): S4U2Self
- the cname-in-addl-tkt KDC option: S4U2Proxy (constrained delegation);
additional tickets without this option are user-to-user
With a client name of two components, only "host/x" and "ldap/x" were
handled (the second component is the machine): for any other service
principal (e.g. "nfs/server.corp.local" or "HTTP/web.corp.local", used by
logins with a keytab) the service was exported as the username ("nfs",
"http"). Now neither the username nor the hostname are set.
Export also the name type of the client name (e.g. 1 principal, 2/3
service, 6 X.500, 10 enterprise, -128 MS principal), so that the users of
the metadata can tell what kind of name it is.
ndpiReader clears the unidirectional traffic risk when a packet comes
back after the detection (as nDPI asks the applications to do), but the
info of the risk, copied as a string when the detection was completed,
was still printed.
The flow now keeps a copy of the infos of its risks, by risk, instead of
the string: clearing a risk removes also its info, and the text is built
when required.
Replace the per-message heuristics with a single ASN.1 walk covering
AS-REQ, AS-REP, TGS-REQ, TGS-REP and KRB-ERROR, over both TCP and UDP.
AS-REP was never parsed and nothing was extracted from KRB-ERROR.
New metadata: request type, response type and (for KRB-ERROR) the error
code. They are printed by ndpiReader and exported via JSON as
"request_type", "response_type", "response_ok" (true for AS-REP and
TGS-REP) and "error_code". Only the first request and the first reply
of a flow are exported.
Client name and realm keep the existing conventions, so they are not
the literal Wireshark `kerberos.CNameString/kerberos.realm` values:
- the trailing '$' of machine accounts is stripped on purpose: a cname
ending with '$' (e.g. "jersey-shore-2c$") is exported in "hostname"
without the '$'; any other cname is exported in "username" unchanged
- names and realm are lowercased
The generic BER helpers (asn1_ber_decode_header/tlv/single_tlv/int) are
in ndpi_utils.c, next to asn1_ber_decode_length().
Close#3275Close#2117
* WIP
* Fix compilation of fuzzing
* Fix fuzzing compilation
* Cleaned up old quic contributed code (#3222)
Recode commits 713cdd0, 26df140
* QUIC: refactoring
* WIP
* WIP
* Revert "QUIC: refactoring"
This reverts commit 50afd07f28.
* QUIC: refactoring original Wireshark code (#3224)
* Added ability to specify in protocol definition, when a (partial) protocol
can change. This can be queries using a new APi call
named ndpi_can_partial_proto_classification_change()
* TLS: minor changes and remove same stale comments
* Fix out-of-bounds read of TLS certificate dates (#3225)
notBefore and notAfter are u_int32_t, but ndpi_tls2json() passed their
address to ndpi_gmtime_r() as a time_t *. Wherever time_t is 8 bytes this
reads 4 bytes past the field, picking up the adjacent member, so the value
handed to gmtime_r() is notBefore | (notAfter << 32) on little-endian.
gmtime_r() then fails on that out-of-range value and returns NULL, leaving
before/after NULL, so the "notbefore" and "notafter" fields are silently
dropped from the JSON output. On architectures that require aligned access
the 8-byte load traps instead of merely being wrong.
Convert to a real time_t instead of casting the address. The temporaries
are named not_before/not_after because notBefore/notAfter are already
char[32] buffers in the same function.
* WIP
* fuzz: fix compilation
---------
Co-authored-by: Luca Deri <lucaderi@users.noreply.github.com>
Co-authored-by: Luca Deri <deri@ntop.org>
Co-authored-by: shalseth <33956011+shalseth@users.noreply.github.com>
* Added --cfg "tls,max_num_blocks_to_analyze,X" where if X > 0 TLS blocks are analyzed
Example --cfg "tls,max_num_blocks_to_analyze,8"
* TLS blocks now include a time-delta (msec) with respect to the previous TLS block.
The format is @<msec delta>. Example:
"tls_blocks": [
"22:1=232@191",
"22:2=-122@5,20=-1@5,21=-23@5,21=-905@5,21=-281@5",
"21=-53@0",
"20=1@3,21=53@3",
"21=-218@119,21=-218@119",
]