nfqws: handle QUIC decrypt failed case during desync

This commit is contained in:
bol-van
2022-03-25 22:34:37 +03:00
parent 7df1be9d3e
commit f7c0c35670
12 changed files with 26 additions and 5 deletions

View File

@@ -664,18 +664,32 @@ packet_process_result dpi_desync_udp_packet(uint8_t *data_pkt, size_t len_pkt, s
fake = params.fake_quic;
fake_size = params.fake_quic_size;
bool bIsCryptoHello;
bHaveHost=QUICExtractHostFromInitial(data_payload,len_payload,host,sizeof(host),&bIsCryptoHello);
bool bIsCryptoHello, bDecryptOK;
bHaveHost=QUICExtractHostFromInitial(data_payload,len_payload,host,sizeof(host), &bDecryptOK,&bIsCryptoHello);
if (bIsCryptoHello)
{
// decrypted and payload is ClientHello
if (params.desync_skip_nosni && !bHaveHost)
{
DLOG("not applying tampering to QUIC ClientHello without hostname in the SNI\n")
return res;
}
}
else if (!bDecryptOK)
{
// could not decrypt
if (params.desync_skip_nosni)
{
DLOG("not applying tampering to QUIC initial that could not be decrypted\n")
return res;
}
else
// consider this case the same way as absence of the SNI. DPI also might not be able to decrypt this and get SNI
DLOG("QUIC initial decryption failed. still applying tampering because desync_skip_nosni is not set\n")
}
else
{
// decrypted and payload is not ClientHello
if (params.desync_any_proto)
{
DLOG("QUIC initial without CRYPTO frame. applying tampering because desync_any_proto is set\n")