dns: harden any-port UDP detection - #3246
Conversation
|
I didn't look at the patch itself, but I really don't want to need 2 pkts for classification.
Can we harden the detection, keeping the current 1 pkt only logic? |
|
Idea is to BASE-011: Neither PR #3232 nor PR #3233 implements request/response candidate correlation, stricter arbitrary-port question-section geometry masks, Mahalanobis, SPID/Markov, per-device windows, or DNS tunneling detection. Other Unique value of this proposal: UNQ-001: Hardens the existing dns,custom_port,0 any-UDP-port mode rather than adding a second configuration mechanism. |
|
I will proceed as below if this approach is fine. @IvanNardi Please advice. BASE-011: UNQ-001: Hardens the existing dns,custom_port,0 any-UDP-port mode rather than adding a second configuration mechanism. UNQ-003: Preserves nDPI’s current 1-packet DNS classification behavior, including asymmetric traffic support, while applying stricter stateless structural validation only to dns,custom_port,0. UNQ-004: Keeps PR #3232 as the preferred simple path for deployments that know their custom DNS port. Net effect:
|
|
@mmanoj I agree that arbitrary-port DNS detection should remain one-packet and stateless |
|
Thank you. I agree with the central limitation: no stateless, one-packet heuristic can distinguish DNS from an arbitrary UDP payload that is deliberately or accidentally DNS-shaped. PR #3246 does not claim to provide the confidence of request/response correlation.
|
|
@mmanoj Thanks for clarifying. I agree that #3232 is the deterministic solution for known custom ports, while custom_port=0 is only an opt-in heuristic. However, stricter geometry reduces malformed-packet false positives; it does not make arbitrary-port detection deterministic, since unrelated UDP data can still be DNS-shaped. The result should therefore be documented as DNS-shaped traffic on an arbitrary UDP port, not equivalent to #3232. |
+1 |
|
@RajaMuhammadAwais Appreciate your advice and valuable feedback to make this PR better. @IvanNardi as advice, I will arrange the improvements asap. Thx for the support. |
…-port-hardening # Conflicts: # src/lib/protocols/dns.c
|
|
@IvanNardi please check the update commits Key updates:
Verification completed:
|



Please sign (check) the below before submitting the Pull Request:
Link to the related issue:
#1788
Describe changes:
Harden
dns.custom_port=0while preserving one-packet DNS classification.ndpi_flow_udp_struct.additional question-section traversal.
dns.custom_port=0.process_queries()path unchanged for DNS/53, mDNS,LLMNR, TCP DNS, and explicitly configured custom ports.
assigning a misleading DNS flow risk.
classification.
Validation:
make -j$(nproc)./tests/do-unit.shNDPI_FAIL_FAST=1 ./tests/do.shDPI packets: 1