Closed t3chn0m4g3 closed 4 years ago
Thanks @t3chn0m4g3! I will investigate this behavior in the next few days.
Problem in KEEP_ALIVE_TIME = 75 in (tanner/tanner/session.py string 13) and subsequent removal of old sessions from redis (async def delete_old_sessions(self, redis_client) in tanner/tanner/session_manager.py string 67). The temporary mitigation may be to increase the KEEP_ALIVE_TIME, but need to understand why there is a conflict in Redis. I can't understand because I'm not a programmer and i have paws 😊
Checked the redis, is ok. Problem in tanner/tanner/session_manager.py in sting 71 (is_deleted = await self.delete_session(sess, redis_client)). "await" does not work correctly. if rewrite the function (async def delete_old_sessions(self, redis_client) )this way:
the problem will be fixed.
@AndreyMironenkoGit great! are you willing to make a pull request?
I'm sorry, but no. I don't have a fork. And I don't plan on doing it.
Best Regards.
@afeena I've made the PR with the changes suggested by @AndreyMironenkoGit
@mzfr I recompiled a docker image with your fix and it still crashes after using Nikto against the page Snare serves.
OK I am now diving deep into the problem. Unfortunately I don't think changing specified Exception to general one make a trick. The more import is to understand why it is happening and fix the cause
@Fosocles try it exactly as I wrote it. I was testing from 3 computers running 2 Acunetix (full scan) and 1 dirb in parallel. The service was working fine(but not quite). The test lasted 20 hours.
But I have that stdout:
Traceback (most recent call last):
File "/usr/lib/python3.7/logging/init.py", line 1028, in emit
stream.write(msg + self.terminator)
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcf3' in position 74: surrogates not allowed
Call stack:
File "/usr/bin/tanner", line 4, in
@AndreyMironenkoGit am I correct, that you delete completely this line from your code?
is_deleted = await self.delete_session(sess, redis_client)
?
@afeena Yep. And did print exception in stdout, and run dirb.
@Fosocles if you are using pull request #353 it only changes exception type @AndreyMironenkoGit deleted the function of session deletion and analysis completely (actually, it's not how tanner supposed to work :) )
I found the problem. dirb creates thousands of sessions so tanner tries to analyse everything and put into redis, so it's a problem of efficiency and scalability
@afeena in the PR #357 @mzfr function has been removed too.
@AndreyMironenkoGit sorry, my bad :D you are right
@Fosocles there is no "fast" solution for the problem.
If we are talking about freezing error with dirb, it happens because dirb requests creates thousands of sessions in TANNER (although it supposed to be one sessions with multiple paths), so now imagine at some point all of them are expired and now TANNER want to analyse them and put into redis --> Yes, it freezes. So the whole process of moving sessions from memory to redis/other storage should be re-written. Because now TANNER just goes through the whole list of sessions at once
Please test https://github.com/mushorg/tanner/pull/362
Now doesn't crash for me with dirb
For any other problems please create new issue
This issue was originally posted in the Snare repository (https://github.com/mushorg/snare/issues/233), however I could break it down to tanner (ver. 0.6.0, tcp/8090).
At some point while running
dirb http://1.2.3.4
Snare looses contact to Tanner and throws an errorThe reason for the error lies within the fact that Tanner crashes without any error or warning message.
Setup follows
docker-compose.yml
of this repo (https://github.com/mushorg/tanner/blob/master/docker/docker-compose.yml).