Repository navigation
Add threat model and oss-scanner Dockerfile - #5566
Conversation
1872e1b to
2eb1ca4
Compare
| container can access them. | ||
| - Mounts are performed in the order they are listed, and a later mount | ||
| shadows an earlier one. If the configuration lists a mount on top of | ||
| `/proc`, `/sys`, `/dev` or a masked path, the container gets what it asked |
There was a problem hiding this comment.
The masked path case looks wrong to me. If a config mount is placed on top of a masked path, it gets overmounted by the /dev/null mask, so the mask wins instead of what it asked for.
There was a problem hiding this comment.
you're right; changed to
- Mounts are performed in the order they are listed, and a later mount
shadows an earlier one. If the configuration lists a mount on top of
/proc,/sysor/dev, the container gets what it asked for.
Masked and read-only paths are applied after all mounts.
| # Build runc (with debug info) and the helper binaries used by the tests, | ||
| # and download the container images used by the integration tests. | ||
| RUN make runc test-binaries \ | ||
| && tests/integration/get-images.sh >/dev/null |
There was a problem hiding this comment.
Do we need to consider "spec validator" test in spec.bats? We need to run git clone https://github.com/opencontainers/runtime-spec.git in this test, but the scan itself runs without network access.
There was a problem hiding this comment.
I noted that spec validator test requires network and is to be skipped. It's not important for security I guess (otherwise we could have added pre-cloning of runtime-spec it to this file)
ce58e3a to
142607c
Compare
|
@lifubang thank you for review; comments addressed. |
rata
left a comment
There was a problem hiding this comment.
@kolyshkin thanks for the PR!
With @cyphar we were talking about this in January and here are some notes. Let me know what you think:
- For bind-mounts, the source path is trusted.
- The rootfs needs to be in a directory only the container user or root can access. This is true in containerd, umoci, etc.
- Devices and cgroups are trusted
- Capabilities, seccomp and similar are trusted
- Paths for namespaces are trusted
- syscls used should be safe
- Maybe mention what about new additions to the spec if they can't be attacker controlled by default?
I think is very much in-line with this. I think we were thinking what kind of thingsof the config.json can "a user" have control of. So everything that is trusted is something that can't be exposed to an untrusted user.
I wanted to put this somewhere. I'll think if something from that makes sense to add here.
So, not all of config.json is trusted. Added "Configuration" section which discusses what is and what is not trusted; not sure I got it entirely right; PTAL. I guess new fields are trusted by default, unless the spec says otherwise. |
8d456df to
21665df
Compare
rata
left a comment
There was a problem hiding this comment.
@kolyshkin thanks a lot for driving this forward. LGTM! :)
|
@lifubang @AkihiroSuda @cyphar PTAL |
1 similar comment
|
@lifubang @AkihiroSuda @cyphar PTAL |
There was a problem hiding this comment.
🟡 Changes recommended
The scanner image omits gawk and required cgroup-v2 setup, causing cgroup-dependent integration tests to fail.
6 open issues
Restore gawk dependency for cgroup-v1 and hybrid hosts · New Move cgroup processes and enable controllers before resource-limit tests · New Clarify enforced safety checks for mounts over and below /proc · New Do not exclude findings affecting the default rootful configuration · New Document required privileges and safe setup for local test commands · New Include all attacker-controlled configuration fields in the input list · New
What changed in this PR
Prepares runc for oss-scanner enrollment by documenting its security boundaries and providing a build environment for offline analysis.
Changes:
- Defines the threat model, vulnerability scope, testing guidance, severity criteria, and reporting requirements.
- Links the threat model from the security reporting documentation.
- Adds a native-architecture scanner image that builds runc and test helpers and downloads integration-test images.
| File | Description |
|---|---|
THREAT_MODEL.md |
Documents assets, trust boundaries, attacker capabilities, and security research guidance. |
SECURITY.md |
Directs vulnerability reporters to the threat model. |
.oss-scanner/Dockerfile |
Builds the scanner environment and preloads build and test dependencies. |
Review effort: Max
21665df to
bbdf386
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The documentation misstates OCI hook execution boundaries and describes cgroup setup that can fail with EBUSY while leaving subsequent tests outside the child cgroup.
2 open issues
6 resolved since last review
Move cgroup processes and enable controllers before resource-limit tests Restore gawk dependency for cgroup-v1 and hybrid hosts Include all attacker-controlled configuration fields in the input list Document required privileges and safe setup for local test commands Do not exclude findings affecting the default rootful configuration Clarify enforced safety checks for mounts over and below /proc
Review effort: Balanced
|
|
||
| | Input | Trust level | Notes | | ||
| |-------|-------------|-------| | ||
| | OCI runtime configuration (`config.json`) | **Trusted**, with exceptions (see "Configuration" below) | Provided by the container engine, which is responsible for validating user input. This includes hooks, which run on the host. | |
| - On cgroup v2, when running the tests in a container, run | ||
| `script/prepare-cgroup-v2.sh` once beforehand: it moves the container's | ||
| processes into a child cgroup and enables all controllers, so that the | ||
| tests can use them. The main `Dockerfile` uses it as the `ENTRYPOINT`. |
The script only moved itself to a sub-cgroup, which works when it is the container's ENTRYPOINT (and thus the only process), but fails with EBUSY when enabling controllers if run as a separate command in a running container, since the other processes (PID 1, the calling shell) are left in the parent cgroup. Move all processes instead, and use mkdir -p so the script can be run more than once. Assisted-by: Claude Opus 5.5 Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Document what runc considers a security vulnerability: assets, trust boundaries (including which parts of the configuration must be trusted), attacker model, what is in and out of scope, how to exercise runc, how to rate severity, and what a report should contain. Link it from SECURITY.md. This is based on the threat model proposed for runc by lifubang (PR 5361) and on crun's THREAT_MODEL.md by Giuseppe Scrivano, see containers/crun@3de5e0b Co-authored-by: lifubang <lifubang@acmcoder.com> Co-authored-by: Giuseppe Scrivano <giuseppe@scrivano.org> Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Add a Dockerfile for https://github.com/anthropics/oss-scanner. It builds runc and its test binaries, and fetches all dependencies and test images needed to run unit and integration tests, since the scan itself runs without network access. It is a slimmed-down version of the main Dockerfile, without the cross toolchains and libraries needed for release builds. Unlike the main Dockerfile, it registers the libpathrs directory with ldconfig, since runc init does not inherit LD_LIBRARY_PATH. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
bbdf386 to
1d45a91
Compare
|
I really would like to enroll runc to oss-scanner. We keep getting small LLM-generated issues and PRs, I think that applying oss-scanner results/suggestions will help to reduce the incoming load PTAL @opencontainers/runc-maintainers 🙏🏻 |
lifubang
left a comment
There was a problem hiding this comment.
LGTM
Let's push this forward first and refine the details later.


This adds a threat model and a Dockerfile for oss-scanner,
in preparation for enrolling runc there.
THREAT_MODEL.mddescribes what runc considers a security vulnerability:assets, trust boundaries, attacker model, what is in and out of scope,
existing mitigations, the most security-relevant components, how to
exercise runc, how to rate severity, and what a report should contain.
It is linked from
SECURITY.md, and is meant both for human securityresearchers and for the scanner, which reads it before scanning.
It is based on @lifubang's doc: clarify the runc's threat model #5361
(with review comments addressed) and on crun's THREAT_MODEL.md
by @giuseppe, adapted to runc.
.oss-scanner/Dockerfilebuilds runc and test binaries, and fetches alldependencies and test images, since the scan runs without network access.
It is a slimmed-down version of the main
Dockerfile(native arch only, nocross toolchains). Tested by building it from a clean clone and running
integration tests with
--network=none.Closes: #5361