Skip to content
This repository has been archived by the owner on Jan 12, 2025. It is now read-only.

HugoDowsers - Reverting safeTransferFrom functions make the protocol not EIP 721 compliant #398

Closed
sherlock-admin3 opened this issue Jul 15, 2024 · 0 comments
Labels
Excluded Excluded by the judge without consulting the protocol or the senior Non-Reward This issue will not receive a payout

Comments

@sherlock-admin3
Copy link
Contributor

sherlock-admin3 commented Jul 15, 2024

HugoDowsers

Medium

Reverting safeTransferFrom functions make the protocol not EIP 721 compliant

Summary

The functions safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) and safeTransferFrom(address from, address to, uint256 tokenId) are reverting in normal conditions.

These functions are not EIP 721 compliant :
https://eips.ethereum.org/EIPS/eip-721

"The transfer and accept functions’ documentation only specify conditions when the transaction MUST throw. Your implementation MAY also throw in other situations. This allows implementations to achieve interesting results:"

Vulnerability Detail

Add the following test to the MlumStaking.t.sol file

function testTransferPosition() public {
    _rewardToken.mint(address(_pool), 100_000_000);
    _stakingToken.mint(ALICE, 2 ether);

    vm.startPrank(ALICE);
    _stakingToken.approve(address(_pool), 1 ether);
    _pool.createPosition(1 ether, 1 days);
	
    vm.stopPrank();

    assertEq(ERC721(address(_pool)).ownerOf(1), ALICE);

	vm.prank(ALICE);
	_pool.safeTransferFrom(ALICE,BOB,1);
	vm.stopPrank();
}(

The result will the following :
Encountered 1 failing test in test/MlumStaking.t.sol:MlumStakingTest
[FAIL. Reason: ReentrancyGuardReentrantCall()] testTransferPosition() (gas: 559377)

Impact

Medium as VII.2 from :
https://docs.sherlock.xyz/audits/judging/judging#ii.-criteria-for-issue-severity

Code Snippet

https://github.com/sherlock-audit/2024-06-magicsea/blob/42e799446595c542eff9519353d3becc50cdba63/magicsea-staking/src/MlumStaking.sol#L336

Tool used

Foundry coverage.

Recommendation

Delete modifier

Duplicate #489

@github-actions github-actions bot added the Excluded Excluded by the judge without consulting the protocol or the senior label Jul 21, 2024
@sherlock-admin4 sherlock-admin4 changed the title Polished Coal Guppy - Reverting safeTransferFrom functions make the protocol not EIP 721 compliant HugoDowsers - Reverting safeTransferFrom functions make the protocol not EIP 721 compliant Jul 29, 2024
@sherlock-admin4 sherlock-admin4 added the Non-Reward This issue will not receive a payout label Jul 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Excluded Excluded by the judge without consulting the protocol or the senior Non-Reward This issue will not receive a payout
Projects
None yet
Development

No branches or pull requests

2 participants