I have been given a security specification document that contains some rules about the product I currently work on (docker containers). One states that:

All broken symlinks must be removed.

My question is, why do broken symlinks pose a security threat?

Please note that the docker containers I am dealing with are linux based.

UPDATE: The symlinks must be removed from the images/containers not from the host.

  • 6
    Well: What would happen if unauthorized data is placed at the location that the broken symlink points to?
    – user
    Mar 21, 2017 at 16:32
  • 1
    do you have a link to the security documentation in question, it could be helpful to see the statement in context . Mar 21, 2017 at 17:10
  • @RоryMcCune Unfortunately it is propriety so I cannot post it online. But the statement is isolated. Mar 21, 2017 at 17:38
  • hmm, ok, so in terms of context was it symlinks on the host, in the image/container or both that they were referring to? Mar 22, 2017 at 10:53
  • 2
    hmm well I'm struggling to think of a security justification for this. I guess if you mounted a volume into a container with a symlinked file in it, you could get an unxpected result as it would point to the location relative to the container rather than relative to the host, but that doesn't seem likely to be hugely relevant to the security of the environment... Mar 22, 2017 at 19:03

1 Answer 1


The risk really depends on where the symlink is and where it points to. In most cases these are harmless - especially in a docker style setup. An example risk -

In many cases webservers are set only to serve files from a given directory but are allowed to follow symlinks. That directory may have locked down permissions - so its safe to assume the content has not been modified by a compromised process (unless privilege escalation has occurred - and in that case its end game anyway).

Now imagine instead you have a symlink pointing to another file in another location. That file has also been set to the same permission setup - but its parent directory hasn't.

If the file is been deleted and the symlink remains there is a risk. A malicious party may hold permissions to create a file at that location. If they can then now your webserver will happily serve the file completely oblivious to the fact it is malicious.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.