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

Bounce internal signed messages to protect relayer against abuse #14

Merged
merged 2 commits into from
Feb 20, 2024

Conversation

oleganza
Copy link
Contributor

@oleganza oleganza commented Feb 20, 2024

This is proposal made by @mr-tron after analysis of risks for Tonkeeper Battery service coupled with signed internal messages in W5 wallet.

In principle, the wallet should not bounce incoming messages as to avoid returning deposits back to the sender due to opcode misinterpretation. However, specifically for "gasless" transactions (signed messages relayed by a 3rd party), there is a risk for the relaying party to be abused: their coins should be bounced back in case of a race condition or delays.

We resolve this dilemma by silently failing during signature check (therefore ordinary deposits with arbitrary opcodes never bounce), but failing with an exception (therefore bouncing) after the signature check.

Verification step Behavior
Opcode check Fail silently
Signature check Fail silently
Seqno check Exception & bounce
Subwallet check Exception & bounce
TTL check Exception & bounce

The downside of this solution is that wallet may emit bounced messages produced on purpose by trolls who reuse old signatures and send malformed, but well-signed messages to trigger bouncing. These bounced messages may clutter history and "recent" addresses in the wallets that do not check the "bounce" flag. Mitigation is simple: such operations should be filtered out as spam, just like the "0 ton" incoming transactions.

@oleganza oleganza merged commit 55a383d into main Feb 20, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant