Mitigate Baron SameEdit (CVE-2021-3156) vulnerability

fedora 23
shell weakness #13

4

Weakness Breakdown


Definition:

A shell weakness occurs when a program enables an attacker to execute unexpected commands on the operating system.

Warning code(s):

This causes a new program to execute and is difficult to use safely.

File Name:

oiio-Release-1.5.24/src/libutil/filesystem.cpp

Context:

The highlighted line of code below is the trigger point of this particular Fedora 23 shell weakness.

 #if BOOST_FILESYSTEM_VERSION >= 3
    boost::system::error_code ec;
    bool ok = boost::filesystem::remove (path.str(), ec);
    if (ok)
        err.clear();
    else
        err = ec.message();
    return ok;
#else
    bool ok = boost::filesystem::remove (path.str());
    if (ok)
        err.clear();
    else
        err = "Could not remove file";
    return ok;
#endif
}



unsigned long long
Filesystem::remove_all (string_view path, std::string &err)
{
#if BOOST_FILESYSTEM_VERSION >= 3
    boost::system::error_code ec;
    unsigned long long n = boost::filesystem::remove_all (path.str(), ec);
    if (!ec)
        err.clear();
    else
        err = ec.message();
    return n;
#else
    unsigned long long n = boost::filesystem::remove_all (path.str());
    err.clear();
    return n;
#endif
}



std::string
Filesystem::temp_directory_path()
{
#if BOOST_FILESYSTEM_VERSION >= 3
    boost::system::error_code ec;
    boost::filesystem::path p = boost::filesystem::temp_directory_path (ec);
    return ec ? std::string() : p.string();
#else
    const char *tmpdir = getenv("TMPDIR");
    if (! tmpdir) 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.