Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-17545

Improve handling of DDoS/brute force attacks on login form

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Major Major
    • 4.0.0-a2, 3.3.16-RC1
    • 3.3.15
    • Sessions
    • None

      Ticket number for this PR: https://github.com/phpbb/phpbb/pull/6383

       

      rob006 wrote

      Background:

      I had a DDoS attack on login form. It quickly filled the sessions table with tens of thousands of sessions for the anonymous user. A lot of sessions for this user dramatically decreased the performance of SELECT COUNT(session_id) AS sessions FROM SESSIONS_TABLE ... query, since the efficiency of session_user_id index was almost non-existent (99% of sessions was for anonymous user, so the query needed to count almost all rows in table). I excluded this query for the anonymous user, since it was not needed anyway. This significantly improved performance of forum, but...

      ...sessions were still created and the sessions table was growing. I ignored this, but after a few days I realized that cron does not work correctly. It turns out that task for clearing old sessions tried to load hundreds of thousands of sessions in one query, which exceeded the memory limit, and the whole process failed (and this was repeated over and over since old sessions were never removed). I added a limit to this query, so sessions could be cleaned up in smaller batches (I'm still not sure if this limit is optimal, but it worked for me).

       

       

            Derky Derky
            Derky Derky
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: