• Oran Agra's avatar
    Fix issue of listen before chmod on Unix sockets (CVE-2023-45145) (#12671) · 03345ddc
    Oran Agra 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 1119ecae
    
    )
    Co-authored-by: default avatarYossi Gottlieb <yossigo@gmail.com>
    03345ddc
anet.c 22.2 KB