Match DNS Lookups Against Wildcard Indicator Domain Rules
Last updated: November 29, 2026
Quick Overview
Threat intelligence ships domain indicators that are either exact (login.evil.com) or wildcard suffixes (*.evil.com, matching any strict subdomain). For each DNS query seen on endpoints, return the ID of the most specific matching rule, preferring an exact match over any wildcard and a deeper wildcard over a shallower one.
CrowdStrike
November 29, 20260
0
0 solved
Threat intelligence ships domain indicators that are either exact (login.evil.com) or wildcard suffixes (*.evil.com, matching any strict subdomain). For each DNS query seen on endpoints, return the ID of the most specific matching rule, preferring an exact match over any wildcard and a deeper wildcard over a shallower one.
Falcon sensors report DNS requests and CrowdStrike intelligence publishes domain IOCs, so matching millions of lookups against a large indicator set is a realistic cloud detection task. The interviewer looks for a reversed-label trie instead of scanning every rule, plus careful precedence and normalization.
What the Interviewer Expects
- Normalize case and trailing dots before matching
- Build a trie keyed on reversed domain labels
- Store exact and wildcard rule IDs separately on each node
- Implement precedence: exact over wildcard, deeper wildcard over shallower
- Make sure *.evil.com does not match evil.com itself
- Give build and query complexity in terms of label count
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you ship this rule set to a memory-constrained sensor?
- How would you support updates to the indicator set without pausing queries?
- How would you handle internationalized domains and punycode?
- Could a Bloom filter in front of the trie help, and what does it cost you?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Rules: list of (rule_id, pattern). A pattern without a star matches only that exact domain. *.suffix matches any domain with at least one extra label in front of suffix. Matching is case-insensi...
High-Level Design
Domains are hierarchical from the right, so insert each pattern into a trie by reversed labels (com -> evil -> login). Each node holds an optional exact rule and an optional wild rule. For a que...