TaintedSleep
This is a security issue, reported by security analysis: it flags a potential vulnerability.
Emitted when user-controlled input can be passed into a sleep call or similar.
Risk
A user-controlled delay lets an attacker keep workers busy for as long as they ask, which is a cheap denial of service.
Example
<?php
sleep($_GET["seconds"]);
The options making curl throttle a transfer (CURLOPT_MAX_RECV_SPEED_LARGE, ...) or wait longer for it (CURLOPT_TIMEOUT, ...) are reported too: a client choosing them can keep the request busy as long as it wants.
Mitigations
- Cap the value (
min($seconds, 5)) before it reachessleep. - Validate it against the range your feature needs.