Any user can delete another user's relationships if they know (or guess) the rid. The callback for removing relationships doesn't check to make sure the user is authorized.

Here are steps to reproduce. Let's call our friendly users Alice and Bob, and our attacker Eve.

  1. Log in as Alice, and request a relationship with Bob
  2. Log in as Bob, and approve that relationship
  3. View Bob's relationships page, and copy the Remove link URL onto the clipboard. It will be something like:
    https://example.com/site/user/2/relationships/remove/128?destination=relationships; in this example, the 2 is Bob's UID, and the 128 is the rid
  4. Now log in as Eve, and note Eve's UID.
  5. Paste the URL from step 3 into your browser URL bar, and change the UID (the part between user and relationships) to Eve's. Visit that page.
  6. Eve will see a page saying Are you sure you no longer wish to be a friend of Alice?
  7. Click on the Yes button
  8. Eve will see a message that she is no longer a friend of Alice, but actually she has removed the friendship between Alice and Bob!
  9. Log in as Alice, and note that your friendship with Bob has been deleted.
  10. Log in as Bob, and note that your friendship with Alice has been deleted.

I have not tested it, but I suspect a similar problem exists when disapproving relationships, and cancelling pending relationships.

Is there some configuration option I'm missing to prevent this? Otherwise I'll see if I can put together a patch.

Comments

alex.k’s picture

Assigned: Unassigned » alex.k
scottgifford’s picture

The same issue exists with approving relationships. That's pretty severe actually; Eve can request a relationship with Alice, then approve it herself by going to the approve url.

alex.k’s picture

Status: Active » Fixed

Fixed, and created a 5.x-2.9 release: http://drupal.org/node/456782

You should not have created this issue without contacting me first. While it's not a security vulnerability, i would have wanted more time to look at it and put out a fix.

scottgifford’s picture

Yeah, sorry, after posting it I realized I should have handled it as a security issue, but I didn't see a way to change it after the fact. Thanks for the quick fix!

scottgifford’s picture

With the fix in 2.9, in step 6 above the user still gets a page asking them if they want to delete the relationship, although when they press the button it won't work. Probably it would be better to show the error when they first visit the page.

greggles’s picture

This was handled quite quickly, which is great, but you can always contact the security team and we can unpublish the node http://drupal.org/security-team#report-issue

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.