How does the rsync symlink exploit work?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












2
















munge symlinks



[...]



The way rsync disables the use of symlinks is to prefix each one with the string "/rsyncd-munged/". This prevents the links from
being used as long as that directory does not exist. When this parameter is enabled, rsync will refuse to run if that path is a
directory or a symlink to a directory.



[...]



When this parameter is disabled on a writable module and "use chroot" is off (or the inside-chroot path is not "/"), incoming sym‐
links will be modified to drop a leading slash and to remove ".." path elements that rsync believes will allow a symlink to escape
the module’s hierarchy. There are tricky ways to work around this, though, so you had better trust your users if you choose this
combination of parameters.




When munge symlinks = no, what is the tricky way to work around the protection described here? I.e to escape the module path, and read/write files outside of it?



EDIT: The vulnerability fixed by "munge symlinks" is CVE-2007-6199. "rsync before 3.0.0pre6, when running a writable rsync daemon that is not using chroot, allows remote attackers to access restricted files via unknown vectors that cause rsync to create a symlink that points outside of the module's hierarchy."










share|improve this question
























  • I haven't tested it, but I assume it would be possible to upload a symbolic link to e.g. /etc/passwd or some other arbitrary file on the system, and then get rsync to retrieve that file.

    – Kusalananda
    Mar 5 at 20:05












  • @Kusalananda right. But rsync has a best-effort protection against it. "incoming sym‐ links will be modified to drop a leading slash and to remove ".." path elements that rsync believes will allow a symlink to escape the module’s hierarchy". So what's the specific trick to confuse rsync, so that it allows enough ".." to escape?

    – sourcejedi
    Mar 5 at 21:25












  • I see what you're getting at now. I misread the second paragraph.

    – Kusalananda
    Mar 5 at 21:33















2
















munge symlinks



[...]



The way rsync disables the use of symlinks is to prefix each one with the string "/rsyncd-munged/". This prevents the links from
being used as long as that directory does not exist. When this parameter is enabled, rsync will refuse to run if that path is a
directory or a symlink to a directory.



[...]



When this parameter is disabled on a writable module and "use chroot" is off (or the inside-chroot path is not "/"), incoming sym‐
links will be modified to drop a leading slash and to remove ".." path elements that rsync believes will allow a symlink to escape
the module’s hierarchy. There are tricky ways to work around this, though, so you had better trust your users if you choose this
combination of parameters.




When munge symlinks = no, what is the tricky way to work around the protection described here? I.e to escape the module path, and read/write files outside of it?



EDIT: The vulnerability fixed by "munge symlinks" is CVE-2007-6199. "rsync before 3.0.0pre6, when running a writable rsync daemon that is not using chroot, allows remote attackers to access restricted files via unknown vectors that cause rsync to create a symlink that points outside of the module's hierarchy."










share|improve this question
























  • I haven't tested it, but I assume it would be possible to upload a symbolic link to e.g. /etc/passwd or some other arbitrary file on the system, and then get rsync to retrieve that file.

    – Kusalananda
    Mar 5 at 20:05












  • @Kusalananda right. But rsync has a best-effort protection against it. "incoming sym‐ links will be modified to drop a leading slash and to remove ".." path elements that rsync believes will allow a symlink to escape the module’s hierarchy". So what's the specific trick to confuse rsync, so that it allows enough ".." to escape?

    – sourcejedi
    Mar 5 at 21:25












  • I see what you're getting at now. I misread the second paragraph.

    – Kusalananda
    Mar 5 at 21:33













2












2








2









munge symlinks



[...]



The way rsync disables the use of symlinks is to prefix each one with the string "/rsyncd-munged/". This prevents the links from
being used as long as that directory does not exist. When this parameter is enabled, rsync will refuse to run if that path is a
directory or a symlink to a directory.



[...]



When this parameter is disabled on a writable module and "use chroot" is off (or the inside-chroot path is not "/"), incoming sym‐
links will be modified to drop a leading slash and to remove ".." path elements that rsync believes will allow a symlink to escape
the module’s hierarchy. There are tricky ways to work around this, though, so you had better trust your users if you choose this
combination of parameters.




When munge symlinks = no, what is the tricky way to work around the protection described here? I.e to escape the module path, and read/write files outside of it?



EDIT: The vulnerability fixed by "munge symlinks" is CVE-2007-6199. "rsync before 3.0.0pre6, when running a writable rsync daemon that is not using chroot, allows remote attackers to access restricted files via unknown vectors that cause rsync to create a symlink that points outside of the module's hierarchy."










share|improve this question

















munge symlinks



[...]



The way rsync disables the use of symlinks is to prefix each one with the string "/rsyncd-munged/". This prevents the links from
being used as long as that directory does not exist. When this parameter is enabled, rsync will refuse to run if that path is a
directory or a symlink to a directory.



[...]



When this parameter is disabled on a writable module and "use chroot" is off (or the inside-chroot path is not "/"), incoming sym‐
links will be modified to drop a leading slash and to remove ".." path elements that rsync believes will allow a symlink to escape
the module’s hierarchy. There are tricky ways to work around this, though, so you had better trust your users if you choose this
combination of parameters.




When munge symlinks = no, what is the tricky way to work around the protection described here? I.e to escape the module path, and read/write files outside of it?



EDIT: The vulnerability fixed by "munge symlinks" is CVE-2007-6199. "rsync before 3.0.0pre6, when running a writable rsync daemon that is not using chroot, allows remote attackers to access restricted files via unknown vectors that cause rsync to create a symlink that points outside of the module's hierarchy."







security rsync






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 8 at 16:39







sourcejedi

















asked Mar 5 at 19:42









sourcejedisourcejedi

25.6k445112




25.6k445112












  • I haven't tested it, but I assume it would be possible to upload a symbolic link to e.g. /etc/passwd or some other arbitrary file on the system, and then get rsync to retrieve that file.

    – Kusalananda
    Mar 5 at 20:05












  • @Kusalananda right. But rsync has a best-effort protection against it. "incoming sym‐ links will be modified to drop a leading slash and to remove ".." path elements that rsync believes will allow a symlink to escape the module’s hierarchy". So what's the specific trick to confuse rsync, so that it allows enough ".." to escape?

    – sourcejedi
    Mar 5 at 21:25












  • I see what you're getting at now. I misread the second paragraph.

    – Kusalananda
    Mar 5 at 21:33

















  • I haven't tested it, but I assume it would be possible to upload a symbolic link to e.g. /etc/passwd or some other arbitrary file on the system, and then get rsync to retrieve that file.

    – Kusalananda
    Mar 5 at 20:05












  • @Kusalananda right. But rsync has a best-effort protection against it. "incoming sym‐ links will be modified to drop a leading slash and to remove ".." path elements that rsync believes will allow a symlink to escape the module’s hierarchy". So what's the specific trick to confuse rsync, so that it allows enough ".." to escape?

    – sourcejedi
    Mar 5 at 21:25












  • I see what you're getting at now. I misread the second paragraph.

    – Kusalananda
    Mar 5 at 21:33
















I haven't tested it, but I assume it would be possible to upload a symbolic link to e.g. /etc/passwd or some other arbitrary file on the system, and then get rsync to retrieve that file.

– Kusalananda
Mar 5 at 20:05






I haven't tested it, but I assume it would be possible to upload a symbolic link to e.g. /etc/passwd or some other arbitrary file on the system, and then get rsync to retrieve that file.

– Kusalananda
Mar 5 at 20:05














@Kusalananda right. But rsync has a best-effort protection against it. "incoming sym‐ links will be modified to drop a leading slash and to remove ".." path elements that rsync believes will allow a symlink to escape the module’s hierarchy". So what's the specific trick to confuse rsync, so that it allows enough ".." to escape?

– sourcejedi
Mar 5 at 21:25






@Kusalananda right. But rsync has a best-effort protection against it. "incoming sym‐ links will be modified to drop a leading slash and to remove ".." path elements that rsync believes will allow a symlink to escape the module’s hierarchy". So what's the specific trick to confuse rsync, so that it allows enough ".." to escape?

– sourcejedi
Mar 5 at 21:25














I see what you're getting at now. I misread the second paragraph.

– Kusalananda
Mar 5 at 21:33





I see what you're getting at now. I misread the second paragraph.

– Kusalananda
Mar 5 at 21:33










0






active

oldest

votes












Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f504567%2fhow-does-the-rsync-symlink-exploit-work%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f504567%2fhow-does-the-rsync-symlink-exploit-work%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown






Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay