Skip to content

Add threat model and oss-scanner Dockerfile - #5566

Merged
kolyshkin merged 3 commits into
opencontainers:mainfrom
kolyshkin:threat-model
Nov 13, 2026
Merged

kolyshkin merged 3 commits into
opencontainers:mainfrom
kolyshkin:threat-model

Conversation

@kolyshkin

@kolyshkin kolyshkin commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

This adds a threat model and a Dockerfile for oss-scanner,
in preparation for enrolling runc there.

  1. THREAT_MODEL.md describes 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 security
    researchers 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.

  2. .oss-scanner/Dockerfile builds runc and test binaries, and fetches all
    dependencies and test images, since the scan runs without network access.
    It is a slimmed-down version of the main Dockerfile (native arch only, no
    cross toolchains). Tested by building it from a clean clone and running
    integration tests with --network=none.

Closes: #5361

Comment thread THREAT_MODEL.md Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, /sys or /dev, the container gets what it asked for.
    Masked and read-only paths are applied after all mounts.

Comment thread .oss-scanner/Dockerfile
# 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@kolyshkin
kolyshkin force-pushed the threat-model branch 2 times, most recently from ce58e3a to 142607c Compare October 23, 2026 07:53
@kolyshkin
kolyshkin requested a review from lifubang October 23, 2026 07:54
@kolyshkin

Copy link
Copy Markdown
Contributor Author

@lifubang thank you for review; comments addressed.

@rata rata left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Comment thread THREAT_MODEL.md Resolved
Comment thread THREAT_MODEL.md Resolved
Comment thread THREAT_MODEL.md Resolved
Comment thread THREAT_MODEL.md Resolved
Comment thread THREAT_MODEL.md Resolved
Comment thread THREAT_MODEL.md Resolved
@kolyshkin

Copy link
Copy Markdown
Contributor Author

@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.

@kolyshkin
kolyshkin requested a review from rata October 27, 2026 00:30
@kolyshkin
kolyshkin force-pushed the threat-model branch 2 times, most recently from 8d456df to 21665df Compare October 27, 2026 06:39

@rata rata left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kolyshkin thanks a lot for driving this forward. LGTM! :)

@kolyshkin

Copy link
Copy Markdown
Contributor Author

@lifubang @AkihiroSuda @cyphar PTAL

1 similar comment
@kolyshkin

Copy link
Copy Markdown
Contributor Author

@lifubang @AkihiroSuda @cyphar PTAL

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The scanner image omits gawk and required cgroup-v2 setup, causing cgroup-dependent integration tests to fail.

6 open issues
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

Comment thread .oss-scanner/Dockerfile Resolved
Comment thread .oss-scanner/Dockerfile Resolved
Comment thread THREAT_MODEL.md Resolved
Comment thread THREAT_MODEL.md Resolved
Comment thread THREAT_MODEL.md Resolved
Comment thread THREAT_MODEL.md Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread THREAT_MODEL.md Outdated

| 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. |
Comment thread THREAT_MODEL.md Outdated
Comment on lines +222 to +225
- 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`.
kolyshkin and others added 2 commits November 12, 2026 15:55
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>
@kolyshkin

Copy link
Copy Markdown
Contributor Author

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 lifubang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Let's push this forward first and refine the details later.

@kolyshkin
kolyshkin added this pull request to the merge queue Nov 13, 2026
Merged via the queue into opencontainers:main with commit fa31637 Nov 13, 2026
95 checks passed
@kolyshkin
kolyshkin deleted the threat-model branch November 13, 2026 08:35
@kolyshkin kolyshkin mentioned this pull request Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants