Skip to content
DoS Audit finding Intermediate

fillQuote uses transfer instead of call which can break with future updates to gas costs

The contract uses transfer to send ETH, which forwards a fixed 2300 gas stipend. If gas costs change, integrations with smart contracts could break because the recipient may not have enough gas to execute its fallback function.

0x52 Follow with 0xAgro, Bauer and 5 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-03-sense-judging/issues/33

Found by

0x52, 0xAgro, Bauer, Breeje, Saeedalipoor01988, martin, sayan_, tsvetanovv

Summary

Transfer will always send ETH with a 2300 gas. This can be problematic for interacting smart contracts if gas cost change because their interaction may abruptly break.

Vulnerability Detail

See summary.

Impact

Changing gas costs may break integrations in the future

Code Snippet

https://github.com/sherlock-audit/2023-03-sense/blob/main/sense-v1/pkg/core/src/Periphery.sol#L902-L932

Tool used

Manual Review

Recommendation

Use call instead of transfer. Reentrancy isn't a concern since the contract should only ever contain the callers funds.

Discussion

jparklev

Accepted: we should use .call instead of transfer when transferring ETH, specifically if the receiver is a contract that is integrating Sense.

jparklev

Fixed here: https://github.com/sense-finance/sense-v1/pull/348

We ended up removing the protocol fees entirely, which obviated the need for the suggested fix here

IAm0x52

Fix looks good, transfer has ben changed to call but the occurrence is rollerPeriphery appears to have been missed:

https://github.com/sherlock-audit/2023-03-sense/blob/52049213bdff31138c43a28f061fea493b3d7e14/auto-roller/src/RollerPeriphery.sol#L111

IAm0x52

Additional missed transfers:

https://github.com/sense-finance/sense-v1/pull/346/files#r1167351042 https://github.com/sense-finance/auto-roller/pull/32#discussion_r1167351433

fedealconada

Fix looks good, transfer has ben changed to call but the occurrence is rollerPeriphery appears to have been missed:

https://github.com/sherlock-audit/2023-03-sense/blob/52049213bdff31138c43a28f061fea493b3d7e14/auto-roller/src/RollerPeriphery.sol#L111

fixed here

fedealconada

Additional missed transfers:

https://github.com/sense-finance/sense-v1/pull/346/files#r1167351042 [sense-finance/auto-roller#32 (comment)]

fixed here

(https://github.com/sense-finance/auto-roller/pull/32#discussion_r1167351433)

fixed here

IAm0x52

Fixes look good. All three occurrences have been address. 2 occurrences in RollerPeriphery addressed in PR#32 and the other in Periphery addressed in PR#346

The original report as published on Sherlock, by 0x52. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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

Likely the use of transfer instead of call, which hardcodes a 2300 gas stipend that may become insufficient if gas costs change.

Impact

Changing gas costs may break integrations in the future.

What the attacker needed

None

The fix

The issue was fixed by replacing transfer with call, and the protocol fees were removed entirely, obviating the need for the fix.

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.

When a smart contract sends Ether using transfer, it only gives the recipient a small fixed amount of gas (2300) to run any code. If the recipient is a contract that needs more gas to process the payment, the transfer will fail. This report says that if gas costs go up in the future, even simple recipients might need more than 2300 gas, so the transfer could break.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by 0x52

View all

211 more disclosed reports, best first.

More from Sense Update #1

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.