Dria

Swan
NFTHardhat
21,000 USDC
View results
Submission Details
Severity: high
Invalid

Arbitrary `from` passed to `transferFrom` in `Swan.sol`

Summary

Passing an arbitrary from address to transferFrom can lead to loss of funds, because anyone can transfer tokens from the from address if an approval is made.

Vulnerability Details

3 Found Instances

```javascript
function purchase(address _asset) external {
//////////////////////////////////////////
/////////////////////////////////////////
=> SwanAsset(_asset).transferFrom(listing.seller, address(this), 1);
=> SwanAsset(_asset).transferFrom(address(this), listing.buyer, 1);
=> token.transferFrom(listing.buyer, address(this), listing.price);
}
```
```javascript
function transferRoyalties(AssetListing storage asset) internal {
//////////////////////////////////////////////
=> token.transferFrom(asset.seller, address(this), buyerFee);
}
```

Impact

loss of assets from the contract to .

Tools Used

manual review

Recommendations

  1. use (msg.sender) in the from field while calling transferFrom

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.