59298 sc low function periodattimestamp ignores the input timestamp returning the current period instead

Submitted on Nov 10th 2025 at 22:11:16 UTC by @Paludo0x for Audit Comp | Firelight

  • Report ID: #59298

  • 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

The function periodAtTimestamp(uint48 timestamp) is intended to return the period index corresponding to the provided timestamp timestamp.

However, the implementation computes the elapsed time using the current block timestamp rather than the function argument.

This causes incorrect period indices for historical/future timestamps and can even revert on future timestamps when a future PeriodConfiguration is selected.

Vulnerability Details

In FirelightVault.sol, the function currently reads:

But _sinceEpoch always uses the current block time:

The code subtracts epoch from Time.timestamp() (the current block time), ignoring the timestamp argument. As a result, periodAtTimestamp(t) returns the current period rather than the period for t.

If a future configuration is selected by periodConfigurationAtTimestamp(timestamp), the expression Time.timestamp() - periodConfiguration.epoch underflows and reverts in Solidity ≥0.8, causing a DoS for callers querying certain future timestamps.

Impact Details

While there is no direct vector impacting funds right now, this is a bug that can break offchain queries or any integration relying on accurate period indexing.

Proof of Concept

Proof of Concept

This is the log I get from the following PoC:

Proof of Concept which uses project test suite:

Was this helpful?