Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transfer to Oneself Possible #55

Closed
MaksymZavershynskyi opened this issue Jun 3, 2020 · 0 comments · Fixed by near/near-sdk-rs#176
Closed

Transfer to Oneself Possible #55

MaksymZavershynskyi opened this issue Jun 3, 2020 · 0 comments · Fixed by near/near-sdk-rs#176

Comments

@MaksymZavershynskyi
Copy link
Contributor

Informational
Reported by a third party.

Description
The functions transfer() and transfer_from() send an amount of tokens from one account to another. In both cases it is valid to transfer the tokens to and from the same account.

In transfer_from() this can be done by setting owner_id to be the same as new_owner_id .

In transfer() this can be done by setting new_owner_id to be the same as predecessor_account_id.

The net change in the accounts balance will be zero and thus there is no known attack vector using this approach.

Recommendations
It is recommended to ensure that owner_id and new_owner_id represent different accounts.

@evgenykuzyakov evgenykuzyakov self-assigned this Jun 4, 2020
evgenykuzyakov pushed a commit to near/near-sdk-rs that referenced this issue Jun 5, 2020
evgenykuzyakov pushed a commit to near/NEPs that referenced this issue Jun 5, 2020
Fixes: near/core-contracts#47
Fixes: near/core-contracts#49

### Changelog `0.2.0`

- Introduce storage deposits. Make every method payable. Require caller to attach enough deposit to cover potential storage increase. See [core-contracts/#47](near/core-contracts#47)
- Replace `set_allowance` with `inc_allowance` and `dec_allowance` to address the issue of allowance front-running. See [core-contracts/#49](near/core-contracts#49)
- Validate `owner_id` account ID. See [core-contracts/#54](near/core-contracts#54)
- Enforce that the `new_owner_id` is different from the current `owner_id` for transfer. See [core-contracts/#55](near/core-contracts#55)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants