Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  2. ZBX-9639

Negative chart width causes 100% CPU + DoS in frontend


    • Icon: Incident report Incident report
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • 2.4.5
    • Frontend (F)
    • Debian and Gentoo, different versions of apache and PHP, different version of Zabbix, but still in 2.4.5

      I have an old Linux-machine with Opera 12, which is the only browser with which I have observed this problem and actively tried to reproduce it. Sometimes when restoring an old browsing session in which graphs are opened, the graphs will not be displayed and the webserver will start to consume 100% CPU instead. Since the graph is re-requested every 30 seconds and Zabbix requires max_execution_time of 300, this will quickly cause problems on any server, when the user does not promptly notice that this issue is going on (for example when the tab with the graph was not in the foreground). I have found out that this is caused by the graph width calculation failing in certain circumstances and system loads, so the graph is requested with a negative graph.

      A while ago, I traced the issue back to some piece of code, the frontend kept looping over the same loop indefinitely, trying to increase $y (or something like that) with no apparent progress, but at that moment I could not reproduce the exact input that caused it, so I forgot where I found this code. In any case, the input variable needs to be validated correctly but it might also be useful to modify the relevant loops such that this cannot happen again, even when some input variable was not properly validated.

      Steps to reproduce:
      Open a graph
      Open the graph image itself
      In the URL, change width=xxx to width=-1 (or any other negative value)

      Expected result:
      An image with "Error: Page received incorrect data. Incorrect value "-1" for "width" field", just like for width=0

      Actual result:
      No image is shown, page keeps on loading "indefinitely", while an apache process on the server is using 100% CPU.

            Unassigned Unassigned
            DataGhostNL Vincent Huisman
            1 Vote for this issue
            5 Start watching this issue