-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #16
- Loading branch information
Showing
5 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# IS_CLUSTER_ADMIN | ||
|
||
### Overview | ||
|
||
This attack path aims to provide a route for nodes that are expected to grant cluster administrator access just due to the nature of the resource. | ||
|
||
### Description | ||
|
||
Compromise of certain resources within a cluster can be considered to grant cluster administrator due to the nature of the resource compromised. | ||
|
||
For example, compromise of a control plane node within a Kubernetes cluster that runs services such as the API server or etcd effectively grants cluster administrator access. | ||
|
||
### Defense | ||
|
||
Security of resources that are effectively cluster administrator should be reviewed and hardened. | ||
|
||
### Cypher Deep-Dive | ||
|
||
```cypher | ||
MATCH (src:Node), (dest:ClusterRoleBinding)-[:GRANTS_PERMISSION]->(:ClusterRole {name: "cluster-admin"}) WHERE any(x in ["master", "control-plane"] WHERE x in src.node_roles) | ||
``` | ||
|
||
The above query finds nodes `src` that have the `master` or `control-plane` role. The destination is set to a cluster role binding that binds to `cluster-admin`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,26 @@ | ||
from __future__ import annotations | ||
|
||
from typing import List | ||
from typing import Any, Dict, List | ||
|
||
from icekube.models.base import Resource | ||
from pydantic import computed_field | ||
|
||
|
||
class Node(Resource): | ||
supported_api_groups: List[str] = [""] | ||
|
||
@computed_field # type: ignore | ||
@property | ||
def node_roles(self) -> List[str]: | ||
return [ | ||
x.split("/", 1)[1] | ||
for x in self.labels.keys() | ||
if x.startswith("node-role.kubernetes.io/") | ||
] | ||
|
||
@property | ||
def db_labels(self) -> Dict[str, Any]: | ||
return { | ||
**super().db_labels, | ||
"node_roles": self.node_roles, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters