Skip to content

Insecure use of global timeout

Description

Setting a global timeout can cause an exception to be raised anywhere in the passed block of code, precluding any possible clean up action typically associated with rescuing from exceptions. This can lead to denial-of-service, data integrity failure, and general availability concerns.

Examples

Insecure Code

ruby
Timeout::timeout(5) { # code that may raise an exception }

Secure Code

ruby
begin # code that may raise an exception; rescue Exception => e; # clean up action; end

Remediation

Prefer to use the library's built-in timeout functionality, if it has any, to ensure processing happens as expected. If it does not have built-in timeout functionality, then consider implementing it.

Rule Details

FieldValue
IDCODE-0003
CategoryGeneric
SeverityMEDIUM
CWECWE-460
ConfidenceHIGH
ImpactLOW
LikelihoodHIGH
ExploitabilityMODERATE
Tagstimeout, exception handling
OWASPN/A

References