Cluster Phishing Messages Into Campaigns By Shared Indicators
Last updated: November 29, 2026
Quick Overview
Given a batch of malicious messages, each with a sending IP, a list of URLs and a list of attachment hashes, group messages into campaigns where two messages belong together if they share any indicator directly or transitively. Ignore indicators so common that they would merge unrelated mail.
Abnormal Security
November 29, 20260
0
0 solved
Given a batch of malicious messages, each with a sending IP, a list of URLs and a list of attachment hashes, group messages into campaigns where two messages belong together if they share any indicator directly or transitively. Ignore indicators so common that they would merge unrelated mail.
When one attack is confirmed, Abnormal wants to find and pull every sibling message across mailboxes and tenants, so grouping by shared indicators is a core primitive. The interviewer is checking whether you see the connected-components structure, reach for union-find, and notice that shared infrastructure like a large mail provider's IP would collapse everything into one giant cluster.
What the Interviewer Expects
- Recognizes transitive grouping as connected components
- Uses union-find with path compression and union by size
- Maps indicator to first message seen instead of building all pairwise edges
- Adds a fanout cap so high-frequency indicators do not glue clusters together
- Returns only clusters of size greater than one
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 run this incrementally as new messages stream in all day?
- How would you choose the fanout cap per indicator type?
- How would you add fuzzy similarity, such as near-duplicate subject lines, without O(n^2) comparisons?
- How do you split a cluster later if an indicator turns out to be benign?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Each message has an id, sender_ip, urls, attachment_hashes. Two messages are in the same campaign if they share an indicator, or are linked through a chain of shared indicators. Indicators that ...
High-Level Design
Treat messages as nodes. Instead of adding an edge between every pair sharing an indicator (quadratic for a hot URL), remember the first message that carried each indicator and union every later carri...
Submit Your Answer
Abnormal Security Software Engineer Interview Guide
Interview process, tips, and preparation timeline