You Can't Secure a Network with a Spreadsheet
Security is about relationships, not rows. Learn why relational databases are mathematically blind to attack paths, and why Graph Theory is the way to measure Blast Radius.
In my previous articles, we established that security is an economic problem: you must balance Revenue, Resources, and Risk. We learned that the goal isn’t to eliminate risk, but to optimize it.
But you cannot optimize what you cannot measure.
If you want to calculate the “Blast Radius” of a compromised server (Risk) or the “Chokepoint” that blocks the most attacks for the least money (Resources), you need a mathematical model that reflects reality.
Most organizations are trying to calculate these complex variables using spreadsheets, static diagrams, and relational databases. They are trying to measure a network using tools built for lists.
To fix the economics, we must first fix the physics. We must accept that security architecture is fundamentally a graph problem.
The Design-Time Gap
Every architecture review starts with a diagram and ends with the same question: “Is this secure?”
The answer is usually a list of operational promises: “We’ll patch,” “We’ll monitor,” “We’ll use MFA.”
What is missing is a quantitative evaluation of the architecture itself:
But we have a gap: We have tools for operations, design, and compliance, but we lack tools for structural risk.
The problem with the third category is the output. The “analysis” is usually just a spreadsheet of independent findings (perhaps with applied controls). It leaves the architect alone to perform the actual contextual analysis — mentally tracing how a vulnerability in Component A might allow traversal to Component B.
None of these tools answer the system-level question: “If we connect these boxes this way, does an attack path emerge?”
Operational tools are too late (runtime). Design tools are too static (pictures). Traditional threat modeling is too isolated (lists).
You cannot validate architecture decisions until after you’ve made them, built them, and deployed them — when fixing them is most expensive (high Resource cost).
Security Questions Are Graph Questions
If you strip away the buzzwords, the core questions security teams ask are literal graph theory problems.
These aren’t metaphors. These are well-defined mathematical problems. But because we store our data in lists (Excel) and tables (CMDBs), we can’t run the algorithms. We are forced to guess.
Why Relational Databases (SQL) Fail at Security
When organizations try to answer these questions using standard databases (like SQL), they hit a wall.
Relational databases are optimized for Rows (Lists of things). Security is about Relationships (Connections between things).
To traverse a path in SQL, you have to use a JOIN.
The “Friends of Friends” Problem: In a relational database, finding everything connected to a node 6 hops away requires exponential computing power. It is a recursive nightmare. In a Graph Database, it is a simple pointer traversal.
Practical Application: Finding an “Effective” Attack Path
Let’s look at a realistic security question: “Can an attacker reach the Crown Jewels Database, avoiding firewalls and infinite loops?”
This isn’t just about syntax. It is about computational survival. Sure, Cypher queries can become complex when logic gets heavy. But a complex Cypher query is solving a problem that is often computationally impossible or practically unwriteable in standard SQL.
The SQL Approach (The Procedural Nightmare)
In a relational database, “walking” a path requires you to write the logic for the engine. You have to manually manage recursion, manually detect cycles (so the query doesn’t crash the server), and manually filter ACLs at every hop.
-- THE REALITY: 25+ lines to simulate a graph traversal
WITH RECURSIVE attack_path (source_id, target_id, depth, path, cycle) AS (
-- 1. Base Case: Start at the Internet
SELECT e.source_id, e.target_id, 1,
ARRAY[e.source_id, e.target_id],
false
FROM network_edges e
WHERE e.source_id = 'INTERNET' AND e.state = 'OPEN'
UNION ALL
-- 2. Recursive Step: The "Join Bomb"
SELECT e.source_id, e.target_id, ap.depth + 1,
ap.path || e.target_id,
e.target_id = ANY(ap.path) -- 3. Manual Cycle Detection (Critical)
FROM network_edges e
JOIN attack_path ap ON e.source_id = ap.target_id
-- 4. Complexity: Check Firewalls at every hop
WHERE NOT ap.cycle -- If you miss this, the query loops until memory exhaustion
AND ap.depth < 10
AND NOT EXISTS (
SELECT 1 FROM firewall_rules f
WHERE f.src = e.source_id AND f.dst = e.target_id AND f.action = 'DENY'
)
)
SELECT path FROM attack_path
WHERE target_id = 'CROWN_JEWELS_DB';
Result: You are writing software, not a query. If you mess up the cycle detection line, you trigger an infinite loop that exhausts server memory.
Recommended by LinkedIn
The Graph Approach (The Declarative Pattern)
In a Graph Database (with Cypher), the engine already knows how to traverse. You simply draw the pattern you want to see.
// THE GRAPH WAY: 4 lines of ASCII art
MATCH path = (:Asset {id: 'INTERNET'})-[:CAN_REACH*1..10]->(:Asset {id: 'CROWN_JEWELS_DB'})
WHERE ALL(r IN relationshsips(path) WHERE r.state = 'OPEN')
RETURN path
Result: It reads like English. *1..10 finds any path up to 10 hops. It executes in milliseconds.
The difference is that the SQL query is not only longer, but also more fragile. If you increase the depth to 15 hops in a dense network, the relational database will likely time out or choke trying to join the exploding number of intermediate rows. The graph database will simply follow the pointers.
Ask Complexity, Get Simplicity
Once your data is in a graph, answering complex architectural questions becomes trivial. You stop writing “algorithms” and start writing “questions.”
1. Calculate Blast Radius (Risk Measurement)
If we don’t patch ‘WebServer-01’, exactly what downstream systems are at risk?
// Question: If 'WebServer-01' is compromised, what can it reach?
MATCH (compromised:Asset {name: 'WebServer-01'})
-[:CAN_REACH*]->
(target:Asset)
RETURN target.name, target.criticality
2. Find Strategic Chokepoints (Resource Optimization)
Which single node appears in the most attack paths? Fixing this one node secures the most assets.
MATCH path = (:Asset {internet_facing: true})
-[:CAN_REACH*]->
(:Asset {type: 'Database'})
UNWIND nodes(path) AS node
RETURN node.name, count(*) as path_frequency
ORDER BY path_frequency DESC LIMIT 1
3. Prioritize by Proximity (Shortest Path)
We have 1,000 vulnerabilities. Which one allows an attacker to reach PII data in the fewest steps?
MATCH (src:Asset {internet_facing: true}), (dst:Asset {data: 'PII'})
RETURN shortestPath((src)-[:CAN_REACH*]->(dst))
Graph Theory Fundamentals for Security
“Graph theory” might sound academic, but for security architects, it creates a powerful vocabulary for risk.
1. Nodes are Assets: (Servers), (API Endpoints), (Identity Roles), (Datastores)
2. Edges are Risk Vectors:
3. Direction Matters: A firewall usually allows traffic A → B but blocks B → A. Graph databases enforce this directionality natively.
4. Cycles are Dangerous: If System A trusts System B, and System B trusts System A, you have a cycle. If an attacker compromises either, they own both. Graph algorithms spot these loops instantly.
The Bottom Line
The shift from “List-based Security” to “Graph-based Security” isn’t just about better tools. It’s about better questions.
Organizations that recognize this shift stop trying to equally “secure everything” (which is expensive and impossible). Instead, they identify the Chokepoints and Critical Paths in the graph and focus their Resources there.
The question isn’t whether security is a graph problem. It always has been. The question is whether your tools acknowledge this reality.
Check out the graph-native threat modeling platform vision at dether.net or connect with me on LinkedIn to discuss.
This article originally published on Medium.
#GraphTheory #SecurityArchitecture #CISO #RiskManagement #Dethernety
Welcome to my world. All your statements are valid for Enterprise Architecture. We all need a real, up-to-date digital twin of the entreprise. Of course, a flexible graph based solution with simplified, dedicated views for those whose world is only lists and tables as they are the source of data, without their engagement the whole idea collapses (same situation as with CMDBs, what is the success rate and over a year data quality of CMDB projects...? By far the worst of all IT projects. Okay, AI projects are promising challengers). So I agree, this would be the Holy Grail of EA/Security systems, but the big question is: practically how? For simple small companies it's trivial but unnecessary, big complex companies are starving for that but nobody volunteers to put the needed amount of work into the implementation AND continuous improvement during operation.