• Yossi Gottlieb's avatar
    Fix issue of listen before chmod on Unix sockets (CVE-2023-45145) · 7f486ea6
    Yossi Gottlieb authored
    Before this commit, Unix socket setup performed chmod(2) on the socket
    file after calling listen(2). Depending on what umask is used, this
    could leave the file with the wrong permissions for a short period of
    time. As a result, another process could exploit this race condition and
    establish a connection that would otherwise not be possible.
    
    We now make sure the socket permissions are set up prior to calling
    listen(2).
    
    (cherry picked from commit a11b3bc34a054818f2ac70e50adfc542ca1cba42)
    7f486ea6
anet.c 22.6 KB