Skip to content

Commit

Permalink
Add Admin implication
Browse files Browse the repository at this point in the history
  • Loading branch information
beatro0t committed Aug 24, 2021
1 parent df6e6ab commit 2a38886
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
7 changes: 6 additions & 1 deletion lib/aws/attacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,7 @@ def compute(self, max_iterations=5):
self.console.task("Removing all existing attacks",
db.run, args=["MATCH (p) WHERE p:Pattern "
" OR p.Arn = 'arn:aws:iam::{Account}:policy/Admin' "
"OPTIONAL MATCH (p)-[a:ATTACK]->() "
"OPTIONAL MATCH (p)-[a:ATTACK|ADMIN]->() "
"DETACH DELETE p "
"RETURN COUNT(a) AS deleted"
],
Expand All @@ -1248,6 +1248,11 @@ def compute(self, max_iterations=5):
'"Statement": [{"Effect": "Allow", "Action": "*", "Resource": "*"'
'}]}}]\''
'}) '
"WITH admin MATCH (r:Resource) "
" MERGE (admin)-[access:ADMIN]->(r) "
" ON CREATE SET "
" access.Name = 'Admin Access', "
" access.Description = 'Implies all related actions and attacks' "
],
done="Created pseudo Admin")

Expand Down
12 changes: 8 additions & 4 deletions www/src/components/Graph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ export default {
"WITH source, target " +
"CALL apoc.algo.dijkstraWithDefaultWeight(source, target, 'TRANSITIVE>|ATTACK>', '', 0) " +
"YIELD path " +
"RETURN path"
"OPTIONAL MATCH admin=(:Admin)-->(target)" +
"RETURN path, admin"
);
},
Expand All @@ -276,7 +277,8 @@ export default {
"OPTIONAL MATCH path=shortestPath((source)-[:TRANSITIVE|ATTACK*0..]->(target)) " +
"WHERE (target:Resource OR target:Admin) " +
"AND source <> target " +
"RETURN source, path"
"OPTIONAL MATCH admin=(source:Admin)-->()" +
"RETURN source, path, admin"
);
},
Expand All @@ -290,7 +292,8 @@ export default {
`MATCH (target) WHERE ID(target) = ${id} ` +
"OPTIONAL MATCH actions=(_)-[:ACTION]->(target) " +
"WHERE (_:Resource OR _:External) " +
"RETURN target, actions"
"OPTIONAL MATCH admin=(:Admin)-->(target)" +
"RETURN target, admin, actions"
);
},
Expand All @@ -304,7 +307,8 @@ export default {
`MATCH (source) WHERE ID(source) = ${id} ` +
"OPTIONAL MATCH actions=(source)-[:ACTION]->(target) " +
"WHERE target:Resource OR target:CatchAll " +
"RETURN source, actions"
"OPTIONAL MATCH admin=(source:Admin)-->()" +
"RETURN source, actions, admin"
);
},
Expand Down
12 changes: 12 additions & 0 deletions www/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,18 @@ export default {
'text-rotation': 'autorotate'
}
},
{
selector: 'edge.ADMIN',
style: {
'opacity': '0.4',
'overlay-color': 'white',
'overlay-padding': '1px',
'overlay-opacity': '1px',
'target-arrow-shape': 'chevron',
'target-arrow-fill': 'filled',
'color': 'black',
}
},
{
selector: 'node.selected',
style: {
Expand Down

0 comments on commit 2a38886

Please sign in to comment.