Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@idsulik
Copy link
Collaborator

@idsulik idsulik commented Oct 30, 2025

What I did
This PR fixes a path traversal vulnerability in the Git remote loader where subdirectory components containing .. sequences could escape the cached repository directory and load arbitrary files from the host filesystem (e.g., https://github.com/docker/compose.git#main:../../../../../../../tmp/pwned). The fix adds a validateGitSubDir function that validates subdirectory paths before joining them with the cache directory, using multiple defense-in-depth checks: rejecting absolute paths, detecting .. traversal patterns after path normalization, and verifying the final resolved path remains within the base directory

Related issue

(not mandatory) A picture of a cute animal, if possible in relation to what you did
image

@idsulik idsulik requested a review from a team as a code owner October 30, 2025 06:16
@idsulik idsulik requested review from glours and ndeloof October 30, 2025 06:16
@idsulik idsulik changed the title fix(git): Add validation for Git subdirectory paths to prevent traversal fix(git): Fix path traversal vulnerability in git remote loader Oct 30, 2025
Signed-off-by: Suleiman Dibirov <[email protected]>
Copy link
Contributor

@glours glours left a comment

Choose a reason for hiding this comment

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

Sounds good, thanks for the quick fix @idsulik

@glours
Copy link
Contributor

glours commented Oct 30, 2025

@idsulik can you create a dedicated PR for the e2e flaky test fix please? I need to merge this one

@glours glours merged commit c416ea7 into docker:main Oct 30, 2025
87 of 93 checks passed
@idsulik
Copy link
Collaborator Author

idsulik commented Oct 30, 2025

@idsulik can you create a dedicated PR for the e2e flaky test fix please? I need to merge this one

Yes, working on it, can't find why it fails on GitHub while locally it works stably

@0pepsi
Copy link

0pepsi commented Oct 30, 2025

Great work guys, can i assign it as a cve ?

@glours
Copy link
Contributor

glours commented Oct 30, 2025

@0pepsi No, please, you should have followed the recommendations in our security policy
to avoid disclosing the vulnerability before a fix was available.

I’m currently checking with our internal security team to determine the best process to follow.
We’ll get back to you shortly.

@0pepsi
Copy link

0pepsi commented Oct 30, 2025

Sounds good, mb i thought the whole thing was over (: (👍

@temenuzhka-thede
Copy link
Contributor

@0pepsi because this vulnerability was disclosed publicly, via a github issue, we had to urgently patch and release a new version, and bypass the proper workflow via a private Github Security Advisory and a CVE publication. Hence, no CVE will be issued for this.

Our security policy asks that researchers disclose secuity issues privately via [email protected] and follow a responsible disclosure policy which allows us to privately review a submission within 72 hours, and work on a patch before it is disclosed publicly (we ask for up to 90 days of keeping an issue confidential to allow us to properly patch depending on complexity).

We will now proceed to delete this issue. Please reach out directly to [email protected] with any follow-up questions or additional findings.

Thank you

tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Nov 3, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [docker/compose](https://github.com/docker/compose) | patch | `v2.40.2` -> `v2.40.3` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>docker/compose (docker/compose)</summary>

### [`v2.40.3`](https://github.com/docker/compose/releases/tag/v2.40.3)

[Compare Source](docker/compose@v2.40.2...v2.40.3)

#### What's Changed

##### 🐛 Fixes

- Fix OCI compose override support by [@&#8203;ndeloof](https://github.com/ndeloof) [#&#8203;13311](docker/compose#13311)
- Fix help output for "exec --no-tty" option by [@&#8203;tonyo](https://github.com/tonyo) [#&#8203;13314](docker/compose#13314)
- Prompt default implementation to prevent a panic by [@&#8203;ndeloof](https://github.com/ndeloof) [#&#8203;13317](docker/compose#13317)
- Run hooks on restart by [@&#8203;ndeloof](https://github.com/ndeloof) [#&#8203;13321](docker/compose#13321)
- Fix(run): Ensure images exist only for the target service in run command by [@&#8203;idsulik](https://github.com/idsulik) [#&#8203;13325](docker/compose#13325)
- Fix(git): Fix path traversal vulnerability in git remote loader  by [@&#8203;idsulik](https://github.com/idsulik) [#&#8203;13331](docker/compose#13331)

##### 🔧  Internal

- Test to check writeComposeFile detects invalid OCI artifact by [@&#8203;ndeloof](https://github.com/ndeloof) [#&#8203;13309](docker/compose#13309)
- Code Cleanup by [@&#8203;ndeloof](https://github.com/ndeloof) [#&#8203;13315](docker/compose#13315)

##### ⚙️ Dependencies

- Bump compose-go to version v2.9.1 by [@&#8203;glours](https://github.com/glours) [#&#8203;13332](docker/compose#13332)

**Full Changelog**: <docker/compose@v2.40.2...v2.40.3>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNjkuMSIsInVwZGF0ZWRJblZlciI6IjQxLjE2OS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
@j-baines
Copy link

j-baines commented Nov 3, 2025

Hence, no CVE will be issued for this.

So you aren't going to tell the world about the vulnerability because you didn't like the way it was disclosed?

@temenuzhka-thede
Copy link
Contributor

We've taken a closer look at this issue and appreciated the feedback from community members. While our earlier statement about the CVE disclosure process was inaccurate, we want to clarify that, after further analysis, this is not a vulnerability in Docker Compose and does not warrant a CVE ID. We apologize for the confusion and are sharing the following technical details to provide more context.

Understanding the Reported Behavior
In order to trigger this specific issue and load a chosen file from the host via the git loader a potential attacker would need to manipulate the -f argument of the Compose command line. Using the Docker Compose CLI requires the same permissions as running any arbitrary workload on Docker Compose and also requires that the chosen file is accessible by the user, therefore there would be no confidentiality, integrity or availability impact. Other places where the git loader can be used are the "include" top level element or "extends" attribute in compose files but those also allow to specify any file the user has access to and setting them requires write access to the Compose file.

Considering a hypothetical scenario in which a third party application allows untrusted and unsanitized input to be injected into a part of the -f CLI option or in a part of an include or extends field of an otherwise trusted Compose file, that would be a vulnerability of the hypothetical third party application. That said, this PR fixes an actual bug which is the fact that the git loader used to accept an invalid input.

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.

5 participants