Skip to content
  • Colin Walters's avatar
    CVE-2015-4625: Use unpredictable cookie values, keep them secret · ea544ffc
    Colin Walters authored and Colin Walters's avatar Colin Walters committed
    Tavis noted that it'd be possible with a 32 bit counter for someone to
    cause the cookie to wrap by creating Authentication requests in a
    loop.
    
    Something important to note here is that wrapping of signed integers
    is undefined behavior in C, so we definitely want to fix that.  All
    counter integers used in this patch are unsigned.
    
    See the comment above `authentication_agent_generate_cookie` for
    details, but basically we're now using a cookie of the form:
    
    ```
            <agent serial> - <agent random id> - <session serial> - <session
    random id>
    ```
    
    Which has multiple 64 bit counters, plus unpredictable random 128 bit
    integer ids (effectively UUIDs, but we're not calling them that
    because we don't need to be globally unique.
    
    We further ensure that the cookies are not visible to other processes
    by changing the setuid helper to accept them over standard input.  This
    means that an attacker would have to guess both ids.
    
    In any case, the security hole here is better fixed with the other
    change to bind user id (uid) of the agent with cookie lookups, making
    cookie guessing worthless.
    
    Nevertheless, I think it's worth doing this change too, for defense in
    depth.
    
    Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90832
    
    
    CVE: CVE-2015-4625
    Reported-by: default avatarTavis Ormandy <taviso@google.com>
    Reviewed-by: default avatarMiloslav Trmač <mitr@redhat.com>
    Signed-off-by: default avatarColin Walters <walters@redhat.com>
    ea544ffc