Bug 1982526

Summary: containers/storage: creation of very deep directories in containers causes high memory usage triggering OOM killer
Product: [Other] Security Response Reporter: Sam Fowler <sfowler>
Component: vulnerabilityAssignee: Nobody <nobody>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: agk, aos-bugs, aviro, blaise, bmontgom, ebakerupw, eparis, esandeen, extras-orphan, ikent, jburrell, mitr, mpatel, nalin, nstielau, rphillips, santiago, sfowler, sponnaga, swhiteho, vgoyal
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1982531    
Bug Blocks: 1982529    

Description Sam Fowler 2021-07-15 06:13:19 UTC
Creation of a very deep, nested directory structures inside a container leads to high inode usage, exhausting available system memory and triggering OOM killer. A malicious process inside a container can exploit this to cause a denial of service on the host system.

Comment 3 Sam Fowler 2021-07-15 07:35:09 UTC
Additionally, CRI-O will fail to cleanup the malicious container as it's unable to remove the created deep directory. Both Go's stdlib and coreutils `rm` traverse the created directory structure during removal, increasing inode usage and causing system memory to spike, subsequently triggering OOM killer again.

Comment 6 Steve Whitehouse 2021-07-15 12:13:04 UTC
Do we know exactly which filesystem(s) are affected? Or is this a VFS issue that will affect all of them?

Comment 36 Sam Fowler 2021-07-26 08:05:12 UTC
Upstream issues (for container removal):

https://github.com/golang/go/issues/47390
https://github.com/cri-o/cri-o/issues/5126


Upstream PR (for inode quotas):

https://github.com/containers/storage/pull/970