bsdci / libioc

A Python library to manage jails with ioc{age,ell}
https://bsd.ci/libioc
Other
38 stars 11 forks source link

Symlink race condition #737

Open gronke opened 5 years ago

gronke commented 5 years ago

Symlinks in jails are resolved before opening files or creating directories. When an attacker awaits the check, but changes the symlink target right after the check, a race condition can lead to file read/write on the host system from within an unsafe jail.

This issue can be mitigated by opening and holding the file descriptor before the check is applied, so that the same path is not resolved twice.

/me tips hat to @fabiabfreyer