JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.2p0 | CONFIDENTIAL | CodeSecure Inc |
A system-generated time is compared to a value that is not a system-generated time (and thus may be tainted or otherwise suspicious). Such comparisons can potentially lead to time bombs: behavior that is intended to execute only at a specific relative or absolute time.
| Class Name | Potential Timebomb | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Significance | style | ||||||||||||||||||||||||||||||
| Mnemonic | MISC.TIMEBOMB | ||||||||||||||||||||||||||||||
| Categories |
|
||||||||||||||||||||||||||||||
| Availability | Available for C and C++. |
||||||||||||||||||||||||||||||
| Enabling | Checks for this warning class are
disabled by default, and it tracks 'time' taint which
is also disabled by default. To enable the checks,
make the following changes to the project configuration file.
|
#include <time.h>
void misc_timebomb(void){
time_t deadline = 1893456000;
time_t now = time(NULL);
if (now > time(NULL)){ /* ok: time value compared against another time value */
return;
}
if (now < deadline){ /* 'Potential Timebomb' warning issued: time value compared against non-time value */
return;
}
/* An inside attacker could put malicious code here:
* it would only be executed once the deadline was past. */
}
CodeSonar ships with library models that allow it to recognize a functions such as libc mktime() and Win32 GetTickCount() that produce system time values by returning such values, writing them through an argument pointer, or both.
If you have created a custom library model for some function f() in terms of one of these existing models, calls to f() will also be treated as producing system time values under the same circumstances.
The following configuration file parameters affect checks for this warning class.
To report problems with this documentation, please visit https://support.codesecure.com/.