sherlock-audit / 2023-04-splits-judging

4 stars 1 forks source link

Cryptor - An adversary can cause the function _transfertobeneficiary to revert #92

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

Cryptor

false

An adversary can cause the function _transfertobeneficiary to revert

Summary

In SwapperImp.sol, The function transfertobeneficiary requires that the function payback is less than the parameter amountToBeneficiary. However a malicious actor can manipulate the payback function directly as it is public to cause this function to revert

Vulnerability Detail

The function transfertobeneficiary requires that the variable $payback is less than the parameter amountToBeneficiary shown here

However, the variable $payback can be manipulated in the payback function which is public and payable

Therefore a malicious actor could cause a griefing attack, by call the payback and sending ETH that is > amountToBeneficiary

Impact

The function _transfertobeneficiary will revert as well as the external function flash that also calls _transfertobeneficiary

Code Snippet

Tool used

Manual Review

Recommendation

A possible mitigation would be to not make the payback function public