Lack of deadline check in forwarded request
The Forwarder contract's signed requests lack a deadline, so a signed request remains valid indefinitely as long as its nonce is unused. An attacker could execute a signed request much later than intended, when market conditions or contract state have changed.
Submitted by LeoGold, also found by 0x0107, 0xvd, Abysser, air_0x, Bauchibred, Bryan_Conquer, d3e4, francoHacker, Hueber, hyuunn, Infect3d, Kaysoft, KodoSec, komane007, Lamsy, LhoussainePh, MSK, ok567, owanemi, oxchsyston, patitonar, phoenixV110, pindarev, santipu_, SBSecurity, Sherlock__VARM, tourist, unnamed, and vangrim
Finding description and impact
Without a deadline parameter, each ForwardRequest is potentially valid indefinitely. This means that once a request is signed, it can be executed at any point in the future, provided that the nonce has not yet been used. If a request remains valid forever without a deadline, allowing it to be executed much later than the signer might have intended. This can lead to situations where the execution context (e.g., market conditions, contract states) has drastically changed from when the request was originally signed. Signers have no mechanism to limit the time window during which their request is valid, reducing their control over their own transactions.
Proof of Concept
it('should forward transfer in long future time', async function () {
// Increase the time by 6 months (15552000 seconds)
await ethers.provider.send("evm_increaseTime", [15552000]);
var data = interface.encodeFunctionData('transfer', [alice.address, 50]);
var result = await signForward(provider, eurftoken.target, forwarder.target, bob, 1000000000000, data);
expect(
await forwarder.connect(forwardOperator).execute(
result.request,
result.domainSeparator,
result.TypeHash,
result.suffixData,
result.signature,
)
).to.emit(eurftoken, 'Transfer').withArgs(bob.address, alice.address, 50);
expect(await eurftoken.balanceOf(bob.address)).to.equal(950);
expect(await eurftoken.balanceOf(alice.address)).to.equal(1050);
});
In Token.js add the above it block to the TRANSFER describe block in the FORWARDER describe and run the test.
LOGS:
FORWARDER
TRANSFER
✔ should forward transfer in long future time
Recommended mitigation steps
Adjust the ForwardRequest struct to include a deadline parameter. Consider implementing logic within the contract’s execution function to check the current block timestamp against the request’s deadline; rejecting any requests that are past their expiration. You can check the standard that was followed in implementing the forwarder in openGSN codebase here.
The submission and its duplicates outline that signed payloads for the
Forwarderlack an expiry and can thus remain dormant indefinitely.Coupled with the fact that no mechanism exists to invalidate a nonce directly, I believe this to be a valid medium risk issue in the code. The system should either introduce a deadline parameter to signed payloads and/or permit nonces to be invalidated directly, ensuring that conflicting permits that would result in an on-chain race condition can be avoided.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The ForwardRequest struct and execution logic omit a deadline field, so there is no timestamp check to reject stale requests.
Impact
A signed request could be executed much later than the signer intended, when market conditions or contract states have changed, reducing the signer's control over their transactions.
What the attacker needed
A signed forward request; the nonce remains unused
The fix
The ForwardRequest struct should include a deadline parameter, and the execution function should reject requests whose deadline has passed.
How it was found
- Advance the blockchain time by six months in a test environment.
- Encode a token transfer call and sign a forward request for it.
- Execute the signed request through the forwarder.
- Observe that the transfer still succeeds despite the long delay.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A forwarder lets someone sign a message off-chain and have another party submit it on-chain later. Because the signed message has no expiry date, it can be used at any time in the future, even months later, which may surprise the person who signed it.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.