Skip to content

nfsd symlink vulnerability patch

Christopher Bii linux-nfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2Exportfs changes - When a export rootdir is present, nfsd_realpath() wrapper is used to avoid symlink exploits. - Removed canonicalization of rootdir paths. Export rootdir must now be an absolute path. - Implemented nfsd_path.hsupport/export/export.c support/include/exportfs.h support/include/nfsd_path.h +3 more+101 -1051 reply
2/2Temporary fix for build issue for mount util.support/include/exportfs.h support/nfs/exports.c+6 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] nfsd symlink vulnerability patch

It is hinted in the configuration files that an attacker could gain access to arbitrary folders by guessing symlink paths that match exported dirs, but this is not the case. They can get access to the root export with certainty by simply symlinking to "../../../../../../../", which will nearly* always return "/".

This is due to realpath() being called in the main thread which isn't chrooted, concatenating the result with the export root to create the export entry's final absolute path which the kernel then exports.

Also, a linker issue arose so I have added another small hack just to get it compiled correctly.

Christopher Bii (2):
Exportfs changes - When a export rootdir is present, nfsd_realpath()
wrapper is used to avoid symlink exploits. - Removed
canonicalization of rootdir paths. Export rootdir must now be an
absolute path. - Implemented nfsd_path.h
Temporary fix for build issue for mount util.

 support/export/export.c     |  24 +--
 support/include/nfsd_path.h |   9 +-
 support/misc/nfsd_path.c    | 362 ++++++++++++------------------------
 support/nfs/exports.c       |  59 +++---
 utils/exportfs/exportfs.c   |   8 +-
 5 files changed, 170 insertions(+), 292 deletions(-)
Signature · 1 line
2.47.1