public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "adrien.devresse at metamorphe dot engineering" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/104161] New: Potential Security Vulnerability: remove_all and symbolic link Date: Fri, 21 Jan 2022 11:47:16 +0000 [thread overview] Message-ID: <bug-104161-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104161 Bug ID: 104161 Summary: Potential Security Vulnerability: remove_all and symbolic link Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: adrien.devresse at metamorphe dot engineering Target Milestone: --- Dear all, The Rust compiler recently reported a CVE about a vulnerability about the recursive deletion on the filesystem and the use of symlink. https://blog.rust-lang.org/2022/01/20/cve-2022-21658.html Ater a quick check, I do believe the implementation of std::filesystem::remove_all presents the same vulnerability https://en.cppreference.com/w/cpp/filesystem/remove The logic rely on directory_iterator NOT opening symbolic link liked mandated by the standard https://en.cppreference.com/w/cpp/filesystem/directory_iterator https://github.com/playbar/cpplearn/blob/master/gcc/libstdc%2B%2B-v3/src/c%2B%2B17/fs_ops.cc#L1300 However, it seems GCC implementation of directory_iterator does open and follow symbolic links when used on it https://godbolt.org/#z:OYLghAFBqd5QCxAYwPYBMCmBRdBLAF1QCcAaPECAMzwBtMA7AQwFtMQByARg9KtQYEAysib0QXACx8BBAKoBnTAAUAHpwAMvAFYTStJg1DIApACYAQuYukl9ZATwDKjdAGFUtAK4sGIM9KuADJ4DJgAcj4ARpjE/tIADqgKhE4MHt6%2B8aRJKY4CIWGRLDFxAbaY9vkMQgRMxAQZPn7ldpgOabX1BIUR0bHZCnUNTVmtwz2hfSUDAQCUtqhexMjsHOYAzKHI3lgA1CYbbk5DxJish9gmGgCCm9u7mAdHNPQKAJ5DmCyX13dmWwYOy8%2B0Obi8DDwQ3QADoEL9bn9QgQ9iwmKEIMi9vVgMhSHtkAh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IdmBXvD67nymkHlxApM4khAA Consequently, GCC seems logicially vulnerable to this attack. Regards, A.D
next reply other threads:[~2022-01-21 11:47 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-01-21 11:47 adrien.devresse at metamorphe dot engineering [this message] 2022-01-21 13:02 ` [Bug libstdc++/104161] " redi at gcc dot gnu.org 2022-01-21 14:27 ` adrien.devresse at metamorphe dot engineering 2022-01-25 21:09 ` cvs-commit at gcc dot gnu.org 2022-01-26 0:30 ` redi at gcc dot gnu.org 2022-01-27 1:51 ` jistone at redhat dot com 2022-01-27 8:29 ` redi at gcc dot gnu.org 2022-02-04 23:50 ` cvs-commit at gcc dot gnu.org 2022-02-08 13:40 ` cvs-commit at gcc dot gnu.org 2023-10-04 11:28 ` cvs-commit at gcc dot gnu.org 2023-10-04 11:28 ` cvs-commit at gcc dot gnu.org 2023-10-04 11:28 ` cvs-commit at gcc dot gnu.org 2023-10-04 11:33 ` redi at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-104161-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).