public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104161] New: Potential Security Vulnerability: remove_all and symbolic link
@ 2022-01-21 11:47 adrien.devresse at metamorphe dot engineering
  2022-01-21 13:02 ` [Bug libstdc++/104161] " redi at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: adrien.devresse at metamorphe dot engineering @ 2022-01-21 11:47 UTC (permalink / raw)
  To: gcc-bugs

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%2B8aRJKY4CIWGRLDFxAbaY9vkMQgRMxAQZPn7ldpgOabX1BIUR0bHZCnUNTVmtwz2hfSUDAQCUtqhexMjsHOYAzKHI3lgA1CYbbk5DxJish9gmGgCCm9u7mAdHNPQ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trxk07FU6WyiqAYfTjPM6zyDs5z3MS%2B5Usi7LRtaIrpCqepmlq6r%2Bla1TeumbYhvy3nIdmBXvD67nymkHlxApM4khAA


Consequently, GCC seems logicially vulnerable to this attack.

Regards,

A.D

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-10-04 11:33 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-21 11:47 [Bug c++/104161] New: Potential Security Vulnerability: remove_all and symbolic link adrien.devresse at metamorphe dot engineering
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

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).