Skip to content
  • Simon McVittie's avatar
    Change _dbus_create_directory to fail for existing directories · be51bfe9
    Simon McVittie authored
    If we don't trap EEXIST and its Windows equivalent, we are unable to
    detect the situation where we create an ostensibly unique
    subdirectory in a shared /tmp, but an attacker has already created it.
    This affects dbus-nonce (the nonce-tcp transport) and the activation
    reload test.
    
    Add a new _dbus_ensure_directory() for the one case where we want it to
    succeed even on EEXIST: the DBUS_COOKIE_SHA1 keyring, which we know
    we are creating in our own trusted "official" $HOME. In the new
    transient service support on Bug #99825, ensure_owned_directory()
    would need the same treatment.
    
    We are not treating this as a serious security problem, because the
    nonce-tcp transport is rarely enabled on Unix and there are multiple
    mitigations.
    
    The nonce-tcp transport creates a new unique file with O_EXCL and 0600
    (private to user) permissions, then overwrites the requested filename
    via atomic-overwrite, so the worst that could happen there is that an
    attacker cou...
    be51bfe9