You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Dependency confusion attack from looking for manifest in docker.io first #811
This block of code assumes that any image name with only one slash in it cannot possibly be a fully qualified image name, and therefore prepends docker.io/ to the name.
Thus, if I specify a Dockerfile with
FROM artefact.example.com/my_image:1.2.3
then this CLI first looks for a manifest at docker.io/artefact.example.com/my_image:1.2.3.
This concerns me. It feels like an invitation to a dependency confusion attack. Someone could create an "artefact.example.com" organization on docker.io, publish a malicious image named "my_image:1.2.3", and this CLI would pull that instead of what I specified.
joshspicer Do you know if there is a specific way to detect if the first segment is a hostname?
We recently used the heuristic of checking if the first segment has a dot or is 'localhost' to detect this. That might be better than the code referred to here:
Activity
chrmarti commentedon May 8, 2024
joshspicer Do you know if there is a specific way to detect if the first segment is a hostname?
We recently used the heuristic of checking if the first segment has a dot or is 'localhost' to detect this. That might be better than the code referred to here:
cli/src/spec-node/containerFeatures.ts
Line 449 in be1f203
joshspicer commentedon May 8, 2024
I did a quick scan of the moby repo and found this, which seems to also be using the segment and dot trick:
https://github.com/moby/moby/blob/4554d871d70bd055a0faa3ed595419ec4dc50406/registry/search.go#L145-L155
FabianSchurig commentedon Sep 23, 2026
Christof Marti (@chrmarti) Would be great if we could get this into the next release. Thanks in advance! PR #1310