Find All Attack Paths in a Security Graph

Last updated: December 9, 2025

Quick Overview

Given a directed graph representing cloud resources and their relationships, find all paths from any internet-exposed resource to any resource containing sensitive data. Optimize for large graphs with millions of nodes.

Wiz
Coding & Algorithms
Software Engineer
Wiz
December 9, 2025
Software Engineer
Live Technical Session
Coding & Algorithms
Hard

15

12

2,981 solved


Given a directed graph representing cloud resources and their relationships, find all paths from any internet-exposed resource to any resource containing sensitive data. Optimize for large graphs with millions of nodes.

Graph traversal problems are central to Wiz's interview because the Security Graph is their core product. This problem mirrors the real challenge of identifying attack paths: given a graph of cloud resources with typed edges, find all viable paths from entry points (internet-exposed) to targets (sensitive data). The interviewer evaluates your graph algorithm knowledge and ability to optimize for scale.

What the Interviewer Expects
  • Model the problem correctly as a graph traversal from source set to target set
  • Implement an efficient BFS/DFS solution with cycle detection
  • Optimize for large graphs: pruning, memoization, bounded depth
  • Handle edge cases: disconnected components, self-loops, no valid paths
  • Analyze time and space complexity
Key Topics to Cover
Graph traversal (BFS/DFS)
Cycle detection in directed graphs
Path enumeration with pruning
Graph optimization techniques
Multi-source multi-target shortest paths
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you modify your solution to find only the shortest attack paths?
  • Can you parallelize the path finding across multiple workers?
  • How would you handle weighted edges where some attack steps are easier than others?
  • What if the graph has millions of nodes but paths are typically under 10 hops?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Problem Analysis

The problem involves finding all paths in a directed graph from any internet-exposed resource (sources) to any resource containing sensitive data (targets). The key patterns applicable here are:

  1. **...
Approach

We will implement a DFS approach to explore all paths from sources to targets. The steps are as follows:

  1. Graph Representation: Represent the graph using an adjacency list for efficient traversa...

Submit Your Answer
Markdown supported

Related Questions