Skip to content

Commit

Permalink
Merge pull request #5416 from TomSweeneyRedHat/dev/tsweeney/cve-1.35
Browse files Browse the repository at this point in the history
[release-1.35] CVE-2024-1753 fix, bump to v1.35.1, then v1.35.2-dev
  • Loading branch information
openshift-merge-bot[bot] committed Mar 18, 2024
2 parents fedbd79 + 30da354 commit a10eed0
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,10 @@

# Changelog

## v1.35.1 (2024-03-18)

[release-1.35] CVE-2024-1753 container escape fix

## v1.35.0 (2024-03-06)

fix(deps): update module github.com/stretchr/testify to v1.9.0
Expand Down
3 changes: 3 additions & 0 deletions changelog.txt
@@ -1,3 +1,6 @@
- Changelog for v1.35.1 (2024-03-18)
* [release-1.35] CVE-2024-1753 container escape fix

- Changelog for v1.35.0 (2024-03-06)
* fix(deps): update module github.com/stretchr/testify to v1.9.0
* cgroups: reuse version check from c/common
Expand Down
2 changes: 1 addition & 1 deletion define/types.go
Expand Up @@ -29,7 +29,7 @@ const (
// identify working containers.
Package = "buildah"
// Version for the Package. Also used by .packit.sh for Packit builds.
Version = "1.35.0"
Version = "1.35.2-dev"

// DefaultRuntime if containers.conf fails.
DefaultRuntime = "runc"
Expand Down
7 changes: 6 additions & 1 deletion internal/volumes/volumes.go
Expand Up @@ -11,6 +11,7 @@ import (

"errors"

"github.com/containers/buildah/copier"
"github.com/containers/buildah/define"
"github.com/containers/buildah/internal"
internalParse "github.com/containers/buildah/internal/parse"
Expand Down Expand Up @@ -189,7 +190,11 @@ func GetBindMount(ctx *types.SystemContext, args []string, contextDir string, st
// buildkit parity: support absolute path for sources from current build context
if contextDir != "" {
// path should be /contextDir/specified path
newMount.Source = filepath.Join(contextDir, filepath.Clean(string(filepath.Separator)+newMount.Source))
evaluated, err := copier.Eval(contextDir, newMount.Source, copier.EvalOptions{})
if err != nil {
return newMount, "", err
}
newMount.Source = evaluated
} else {
// looks like its coming from `build run --mount=type=bind` allow using absolute path
// error out if no source is set
Expand Down
23 changes: 23 additions & 0 deletions tests/bud.bats
Expand Up @@ -6628,3 +6628,26 @@ _EOF
expect_output --substring "$podman_files"
expect_output --substring "$podman_processes"
}

@test "build no write file on host - CVE-2024-1753" {
_prefetch alpine
cat > ${TEST_SCRATCH_DIR}/Containerfile << _EOF
FROM alpine as base
RUN ln -s / /rootdir
FROM alpine
# With exploit show host root, not the container's root, and create /BIND_BREAKOUT in / on the host
RUN --mount=type=bind,from=base,source=/rootdir,destination=/exploit,rw ls -l /exploit; touch /exploit/BIND_BREAKOUT; ls -l /exploit
_EOF

run_buildah build $WITH_POLICY_JSON ${TEST_SCRATCH_DIR}
expect_output --substring "/BIND_BREAKOUT"

run ls /BIND_BREAKOUT
rm -f /BIND_BREAKOUT
assert "$status" -eq 2 "exit code from ls"
expect_output --substring "No such file or directory"
}

0 comments on commit a10eed0

Please sign in to comment.