59740 [SC-Low] periodattimestamp provides period of current timestamp even for different timestamps
Submitted on Nov 15th 2025 at 12:03:27 UTC by @redbeans for Audit Comp | Firelight
Report ID: #59740
Report Type: Smart Contract
Report severity: Low
Target: https://github.com/firelight-protocol/firelight-core/blob/main/contracts/FirelightVault.sol
Impacts:
Contract fails to deliver promised returns, but doesn't lose value
Description
Brief/Intro
function periodAtTimestamp is expected to
@notice Returns the period number for the timestamp given.
but it returns the period of current timestamp in different timestamps.
Vulnerability Details
This function uses the _sinceEpoch and its expected to get how much time has passed since epoch from supplied timestamp.
but _sinceEpoch uses current timestamp so it will return the current period instead of the supplied timestamp which is wrong.
Moreover, this periodAtTimestamp is used only in currentPeriod function which uses the Time.timestamp() so this is works correctly as the issue in periodAtTimestamp always return the period of the current timestamp.
Impact Details
The only function that use it is currentPeriod() which is fine. If the periodAtTimestamp() used by external party then it will return incorrect periods.
References
https://github.com/firelight-protocol/firelight-core/blob/main/contracts/FirelightVault.sol#L246
Link to Proof of Concept
https://gist.github.com/redbeans9/305c6ca7db24665f2d6993fcf641d636
Proof of Concept
Proof of Concept
Was this helpful?