Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upTOB-K8S-023: kubelet crash due to improperly handled errors #81135
Comments
|
The referenced code seems to come from certain vendor. |
|
/sig node |
|
/area cadvisor |
|
/cc @dashpole |
|
This is no longer relevant since we now walk the filesystem directly: https://github.com/google/cadvisor/blob/master/fs/fs.go#L552 |
|
We should make sure this same problem doesn't exist with the kubelet's empty-dir monitoring code, which still uses du: https://github.com/kubernetes/kubernetes/blob/master/pkg/volume/util/fs/fs.go#L59 |
|
@dashpole thanks |
|
/assign @dashpole |
|
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
|
/remove-lifecycle stale |
|
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
|
@dashpole |
|
After obtaining the bytes using code from https://github.com/google/cadvisor/blob/master/fs/fs.go#L552 , I convert the bytes with following code:
Is the above correct ? |
|
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
|
/lifecycle frozen |
This issue was reported in the Kubernetes Security Audit Report
Description
The kubelet will periodically poll a directory for its disk usage with the GetDirDiskUsage function. To do this, it parses the STDOUT of the ionice command. If there is an error when reading from STDOUT, the error is logged, but execution continues (Figure 2). Due to this continuation, STDOUT is parsed as an empty string, then indexed (Figure 3), resulting in an out-of-bounds (OOB) panic (Figure 1).
Figure 25.1: Stacktrace of a kubelet crash resulting from a bad file descriptor.
Figure 25.2: Only the error is logged, execution flow is not affected by the error.
Figure 25.3: stdout is indexed, even if it is empty.
Additionally, if the command produces no output for any reason, the command will also fail due to an empty string being indexed.
Exploit Scenario
The ionice command fails to execute as expected, resulting in a kubelet crash.
Recommendation
Short term, ensure stdout is validated before attempting to parse the output.
Long term, improve unit testing to cover failures of dependent tooling.
Anything else we need to know?:
See #81146 for current status of all issues created from these findings.
The vendor gave this issue an ID of TOB-K8S-023 and it was finding 27 of the report.
The vendor considers this issue Low Severity.
To view the original finding, begin on page 70 of the Kubernetes Security Review Report
Environment: