Skip to content

Commit

Permalink
Remove setuid,setgid bits on all files in Docker image
Browse files Browse the repository at this point in the history
This is to mitigate "stackclash" attacks. This is a a very small partial
backport from elastic#50277.
  • Loading branch information
pugnascotia committed Feb 4, 2020
1 parent 5d5f3ce commit 29e6dfe
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions distribution/docker/src/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ ENV PATH /usr/share/elasticsearch/bin:\$PATH

COPY --chown=1000:0 bin/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh

# Ensure that there are no files with setuid or setgid, in order to mitigate "stackclash" attacks.
RUN find / -xdev -perm -4000 -exec chmod ug-s {} +

# Openshift overrides USER and uses ones with randomly uid>1024 and gid=0
# Allow ENTRYPOINT (and ES) to run even with a different user
RUN chgrp 0 /usr/local/bin/docker-entrypoint.sh && \
Expand Down

0 comments on commit 29e6dfe

Please sign in to comment.