59280 sc low periodattimestamp uint48 timestamp ignores timestamp and return incorrect values when it is not time timestamp
Submitted on Nov 10th 2025 at 16:21:08 UTC by @axolot for Audit Comp | Firelight
Report ID: #59280
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
periodAtTimestamp(timestamp) computes the period using the current time instead of the timestamp argument. Internal logic for deposits/withdrawals is not affected, but the viewer is broken as external callers will get incorrect historical or future period indice.
Vulnerability Details
This is the function. The issue is that it uses _sinceEpoch which does not take into account timestamp
function periodAtTimestamp(uint48 timestamp) public view returns (uint256) {
PeriodConfiguration memory periodConfiguration = periodConfigurationAtTimestamp(timestamp);
// solhint-disable-next-line max-line-length
return periodConfiguration.startingPeriod + _sinceEpoch(periodConfiguration.epoch) / periodConfiguration.duration;
}So periodAtTimestamp(T) will always equal the current active period currentPeriod(), not the period corresponding to timestamp T.
This is what the function should be
Impact Details
Broken viewer for timestamp != Time.timestamp(). This falls into the Contract fails to deliver promised returns, but doesn't lose value category
Proof of Concept
Proof of Concept
1- set up Foundry in the repo
2- Install the OpenZeppelin libraries
3- Create the remapping file remappings.txt in the root directory and paste this
4- Paste the following file in test/FirelightVault.t.sol (you can temporarily rename the hardhat test folder in test-hardhat to separate them)
Run with forge test. It shows how the function does not return the correct value when using an argument different than the current timestamp.
Was this helpful?