Projects tigase _server server-core Issues #435
send a query to a random destination (#435)
Behnam Hatami opened 10 years ago
Due Date
2015-03-03

hi,

I tried to send this request to my server and it results the server stock in a loop and try to connect to "marlowe.shakespeare.lit" and this makes server use about 15/20 pecent usage in idle state.

I think this is a vulnerability.

<iq to='marlowe.shakespeare.lit' type='get'>
  <query xmlns='jabber:iq:register'/>
</iq>

log.sample

Artur Hefczyc commented 10 years ago

On which Tigase server version did you experience the problem?

Behnam Hatami commented 10 years ago

I use Tigase Version 7.1.0-Snapshot, I compiled from the git repository.

Artur Hefczyc commented 10 years ago

Wojciech, please take a look at it.

wojciech.kapcia@tigase.net commented 10 years ago

In case of hostnames outside of the available VHost (local domains) lists Tigase attempts DNS domain name lookup and if it fails (as in this case), it returns to the client IQ response of type error with additional information S2S - destination host not found. Have you, by any chance, made any customizations to Tigase and/or operating system that would render this mechanism broken?

Can you share more details about:

the server stock in a loop and try to connect to "marlowe.shakespeare.lit"

  • do you have any log entries or something?
Behnam Hatami commented 10 years ago

No I didn't modified the server code, and this request is independent of my additional components.

I add some lines of the log, from when the tigase recieved the request.

wojciech.kapcia@tigase.net commented 10 years ago

A few points:

  • from the log excerpt it looks like the destination is not so random, at least not at your end - you seem to send packet:
<iq id="reg1" type="get" xmlns="jabber:client" to="shakespeare.lit">
  <query xmlns="jabber:iq:register"/>
</iq>
2015-03-03 10:06:41.804 [pool-13-thread-1]  CIDConnections.openOutgoingConnections()  FINEST: Checking DNS for host: shakespeare.lit for: divarbe.divar.ir@shakespeare.lit
2015-03-03 10:06:42.859 [pool-13-thread-1]  CIDConnections.initNewConnection()  FINEST: STARTING new connection: divarbe.divar.ir@shakespeare.lit
2015-03-03 10:06:42.859 [pool-13-thread-1]  CIDConnections.initNewConnection()  FINEST: divarbe.divar.ir@shakespeare.lit connection params: {cert-required-domain=shakespeare.lit, cid=divarbe.divar.ir@shakespeare.lit, ifc=[Ljava.lang.String;@140d3f09, local-hostname=divarbe.divar.ir, port-no=5269, remote-hostname=shakespeare.lit, remote-ip=79.175.191.253, s2s-connection-key=S2S: null, socket=plain, srv-type=_xmpp-server._tcp, type=connect}
2015-03-03 10:06:44.876 [ConnectionOpenThread]  ConnectionManager$ConnectionListenerImpl.accept()  FINEST: Problem reconnecting the service: CID: divarbe.divar.ir@shakespeare.lit, null, type: connect, Socket: null, jid: null, port_props: {cert-required-domain=shakespeare.lit, cid=divarbe.divar.ir@shakespeare.lit, ifc=[Ljava.lang.String;@140d3f09, local-hostname=divarbe.divar.ir, port-no=5269, remote-hostname=shakespeare.lit, remote-ip=79.175.191.253, s2s-connection-key=S2S: null, socket=plain, srv-type=_xmpp-server._tcp, type=connect}, exception: java.net.ConnectException: Connection refused

In case of server to server connections (s2s) Tigase tries to establish the connection to the remote host every 2 seconds for about 15-20 minutes (in case there was some temporary glitch) before giving up and returning with the error to the user. This is quite normal and it happens in your case (reconnect attempt every 2 seconds, not an infinite loop) and it should hardly generate 15-20% cpu usage.

As Tigase behaves correctly I'm marking this issue as rejected.

Behnam Hatami commented 10 years ago

Thanks for your response.

So I need to use domain filter plugin for preventing this scenario.

Artur Hefczyc commented 10 years ago

Behnam: you do not need to do anything in Tigase. Tigase already handles it correctly. The increased CPU usage might be related to the s2s connection Tigase attempts to establish with IP - 79.175.191.253. If the other side behaves badly or sends garbage it may cause Tigase to use more CPU for some time. However, after a while Tigase discovers that the connection is in bad state and kills it. This will not affect, however, normal server functioning or other users connected to the server.

If you want to improve things and avoid Tigase connecting to non-existen domains, make sure such domains do not resolve to a valid IP address. You may need to update your DNS settings, or DNS server or make sure not to use OpenDNS as it always returns an IP address if you query them for a domain that does not exist to server you more ads.

Behnam Hatami commented 10 years ago

Thanks for your complete answer.

Referenced from commit 1 year ago
issue 1 of 1
Type
Bug
Priority
Normal
Assignee
RedmineID
2785
Version
tigase-server-7.0.1
Spent time
16h 30m
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#435
Please wait...
Page is in error, reload to recover