Skip to content

iq 'from' attributes are not checked #300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xnyhps opened this issue Feb 3, 2014 · 2 comments
Closed

iq 'from' attributes are not checked #300

xnyhps opened this issue Feb 3, 2014 · 2 comments

Comments

@xnyhps
Copy link

xnyhps commented Feb 3, 2014

I've been looking into XMPP implementations and whether they verify the source of iq replies. See http://mail.jabber.org/pipermail/jdev/2014-January/089824.html and http://mail.jabber.org/pipermail/jdev/2014-January/089838.html for more discussion.

https://github.com/robbiehanson/XMPPFramework/blob/783f62533885e027e8189f8dc133c72a17e9dea0/Utilities/XMPPIDTracker.m appears to contain no code that checks whether the received iq's from attribute matches the expected to attribute. This can lead to spoofing of iq replies (spoofing rosters, vcards, intercepting file transfers, etc.). The use of UUIDs makes this a lot harder, but not impossible.

More importantly,

- (BOOL)xmppStream:(XMPPStream *)sender didReceiveIQ:(XMPPIQ *)iq
does not check for roster pushes whether they come from the server or not. Any incoming iq with an <query xmlns='jabber:iq:roster'> child is handled as if it were a push from the server. I have verified (using Flamingo) that it is possible to send additional, fake roster replies from other accounts and the received roster items get added to the contact list. This is a very serious security issue. These replies should come from your own bare JID, but some other servers out there send it from the bare domain or from your own full JID.

@ObjColumnist
Copy link
Collaborator

Hi,

I was at the XSF summit and heard about the issues.

The roster one is easy enough to fix, but servers replying from non conforming jids makes it a problem.

@xnyhps
Copy link
Author

xnyhps commented Feb 4, 2014

For libpurple we decided on the following change:
Replies that are expected to come from your own bare JID (i.e. the "server acting on behalf of your own account" as it is described in the RFC), will be accepted if they have:

  • No from.
  • from = the bare account JID.
  • from = the full account JID (legal in 3920, but not 6120).
  • from = the server's domain.

That seems to cover all servers that people reported problems with.

ObjColumnist added a commit that referenced this issue Feb 11, 2014
davidchiles pushed a commit to davidchiles/XMPPFramework that referenced this issue Jan 26, 2016
davidchiles pushed a commit to davidchiles/XMPPFramework that referenced this issue Jan 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants