As part of the OpenID protocol a relying party often establishes shared secrets (called ‘associations’) with identity providers that are used to verify identity assertions. It occurred to me that an OpenID relying party might easily introduce a major security hole in the process of establishing an association that could allow identity spoofing.
Each association is assigned a handle, which is a name by which the relying party and the provider will refer to the shared secret in later transactions. The potential security hole is possible because the Provider alone determines the association handle. If the relying party is not careful in saving associations it creates, a rogue Provider could hijack another Provider’s association with the relying party and thereby gain the ability to assert the identity of any user from the other Provider. Here’s a scenario:
- Victim hosts his identity with GoodOP, and has logged into a vulnerable RP and saved some private data.
- Hacker hosts EvilOP, which is a carefully contrived Provider rigged to hack into RPs.
- Hacker attempts to log into RP as any account hosted by GoodOP and can thereby discover the handle CompromisedHandle of the shared association between RP and GoodOP.
- Hacker instructs EvilOP to assign CompromisedHandle as the handle for the next association it creates with an RP.
- Hacker starts a login at RP with a Claimed Identifier that points at EvilOP. The RP then establishes an association with EvilOP as a preliminary step to the login process.
- EvilOP tells the RP of the new association and says the handle for it is CompromisedHandle.
- RP is vulnerable and overwrites the shared secret it has with GoodOP with the new one it established with EvilOP. Yet CompromisedHandle is still associated with GoodOP in the RP’s associations table.
- Denial of Service: The RP can no longer log in users from GoodOP, because the shared secret between them is wrong and the RP will reject identity assertions from GoodOP due to invalid signatures.
- Identity Spoofing: EvilOP now can write identity assertions on behalf of GoodOP such that RP thinks they are from GoodOP. Hacker can use EvilOP to write assertions and log in as anyone who has an account with GoodOP.
The good news is that having come up with this possible security hole, I did a check of DotNetOpenId and Janrain’s OpenID Ruby library. Neither one was vulnerable to this. Since all of Janrain’s libraries are similar to each other, I ended my investigation because it was likely that all the other Janrain libraries were also secure in this regard.
Still, this is another argument for web sites to use standard libraries for their OpenID support rather than trying to implement OpenID themselves. There are just too many potential security holes for a webmaster to avoid them all unless authentication is truly his focus and passion.
0 comments:
Post a Comment