Skip to content

reject oversized readlink targets - #408

Merged
abhinavagarwal07 merged 1 commit into
libfuse:masterfrom
acts-1631:reject-truncated-readlink-targets
Nov 14, 2026
Merged

abhinavagarwal07 merged 1 commit into
libfuse:masterfrom
acts-1631:reject-truncated-readlink-targets

Conversation

@acts-1631

Copy link
Copy Markdown
Contributor

sshfs_readlink() checks symlink containment against the complete target returned by SFTP, then currently truncates it to the FUSE output buffer. A malicious server can place the byte that distinguishes a safe component such as ..x from .. just beyond that boundary. On Linux systems whose FUSE readlink capacity accepts the truncated result, including 64 KiB page kernels, following the link can escape the mount after the original string passed containment.

Measure the transformed target before copying. Targets blocked by containment still return EPERM. Otherwise-safe targets that do not fit return ENAMETOOLONG, and fitting targets are copied exactly with their terminator.

Symlink containment checked the complete server target, but readlink
silently truncated it to the FUSE output buffer. A target ending in
"..x" beyond the boundary could therefore be exposed as ".." after it
had passed containment.

Preserve containment error behavior, reject otherwise-safe targets that
do not fit, and copy only the exact validated target.
@abhinavagarwal07
abhinavagarwal07 merged commit 4b05701 into libfuse:master Nov 14, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants