Search code examples
phpsecuritydenial-of-service

Security implications of ignore_user_abort() function


Has PHP's ignore_user_abort() function any security implication?

I'm thinking in DoS. For example, when having the function exposed to anonymous traffic in some code that is resource expensive.


Solution

  • As addition to the previous answer I'd like to add that the risk is not bigger, but is being shifted a little.

    If the goal is to overload the server by calling an expensive script a lot of times, it is clear that calling ignore_user_abort(true); relieves the attacker from the need to keep the connection open. The script will continue to execute nevertheless of the connection status and consume resources.
    In contrast without ignore_user_abort(true); the script would end its execution on the first output (if there happens no output the script will be as consuming as the first variant [1]).

    In case of a DoS attack (and especially a DDoS attack) the attacker likely has absolutely no problem in opening (and holding open) a lot of connections. Therefore from this perspective ignore_user_abort makes no difference.

    I can't think of any further security related implications of using this functionality.

    I would even claim that most PHP developers do not really know that the execution of their scripts might stop somewhere in the middle just because the connection is lost. I think most would guess that their scripts will execute until the end in all cases although this is not the default setting.