Actions
Bug #9082
closed
VJ
VJ
lua/dns: recursion_desired() is always false (wrong flag/mask)
Bug #9082:
lua/dns: recursion_desired() is always false (wrong flag/mask)
Affected Versions:
Effort:
Difficulty:
Label:
Description
- Status: present in
main(9b7938aec); code-confirmed (long-standing, since the 2017 Rust port) - Class: functional bug (always-false field) -> silent detection evasion
- Component:
src/util-lua-dns.c:99-110+rust/src/dns/dns.rs:1210-1214
Description¶
recursion_desired() is documented as the DNS RD flag but is always false:
- the FFI getter
SCDnsTxGetResponseFlags()returnstx.rcode(), i.e.response.header.flags & 0x000f; - the Lua side then tests
flags & 0x0080, which is the RA bit and can never be set in an rcode-masked value.
Even with full flags the mask would need 0x0100 (RD), and RD lives in the request header, not the response.
Trigger: any DNS transaction; a rule or output script gating on recursion_desired() never matches, contradicting doc/userguide/lua/libs/dns.rst.
Fix direction¶
Expose the request header's RD bit (or the full flags) through the FFI and test the correct mask.
Test¶
lua-dns-recursion-desired: pcap with RD=1 and RD=0 queries; assert true/false and that a rule matching only RD=1 fires.
Actions