Skip to content

Commit 8cbbe81

Browse files
committed
TLS: Updated Recognition of Server Hello stage
1 parent 6863357 commit 8cbbe81

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

process/tls.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ int TLSPlugin::pre_update(Flow &rec, Packet &pkt)
8383
RecordExtTLS *ext = static_cast<RecordExtTLS *>(rec.get_extension(RecordExtTLS::REGISTERED_ID));
8484

8585
if (ext != nullptr) {
86-
if (ext->alpn[0] == 0) {
86+
if (ext->server_hello_parsed == false) {
8787
// Add ALPN from server packet
8888
parse_tls(pkt.payload, pkt.payload_len, ext);
8989
}
@@ -119,6 +119,7 @@ bool TLSPlugin::obtain_tls_data(TLSData &payload, RecordExtTLS *rec, std::string
119119
ec_point_formats = tls_parser.tls_get_ja3_ec_point_formats(payload);
120120
}
121121
} else if (hs_type == TLS_HANDSHAKE_SERVER_HELLO) {
122+
rec->server_hello_parsed = true;
122123
if (type == TLS_EXT_ALPN) {
123124
tls_parser.tls_get_alpn(payload, rec->alpn, BUFF_SIZE);
124125
// not sure, but probably don`t return yet, as

process/tls.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ struct RecordExtTLS : public RecordExt {
5858
char ja3_hash[33] = { 0 };
5959
uint8_t ja3_hash_bin[16] = { 0 };
6060
std::string ja3;
61+
bool server_hello_parsed;
6162

6263
/**
6364
* \brief Constructor.
@@ -67,6 +68,7 @@ struct RecordExtTLS : public RecordExt {
6768
alpn[0] = 0;
6869
sni[0] = 0;
6970
ja3_hash[0] = 0;
71+
server_hello_parsed = false;
7072
}
7173

7274
#ifdef WITH_NEMEA

0 commit comments

Comments
 (0)