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

Flag spoof events with varied value #2024

Merged
merged 3 commits into from
Oct 23, 2024
Merged

Conversation

iamacook
Copy link
Member

Summary

Resolves #2023

We flag imitation transactions (spoof events) based on certain criteria, of which a matching value being one of them. This comparison is becoming redundant as the values are beginning to vary compared to the transaction being imitated.

This adjusts the current check, adding a new tolerance. A transaction is now marked as an imitation if the value is +/- value + tolerance of the transaction being imitated.

Changes

  • Add new tolerance env. var. with default value.
  • Include tolerance in value check for flagging spoof events.
  • Add/update tests accordingly.

@iamacook iamacook self-assigned this Oct 15, 2024
@iamacook iamacook requested a review from a team as a code owner October 15, 2024 14:55
* @param {Erc20TransferTransactionInfo} prevTxInfo - previous transaction info
* @returns {boolean} - whether the transaction is an imitation
*/
isSpoofedEvent(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this to it's own method in preparation for a forthcoming PR that detects another attack vector.

@iamacook iamacook marked this pull request as draft October 15, 2024 16:48
}
const chain = chainBuilder().build();
const safe = safeBuilder().build();
describe('Event spoofing', () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest hiding whitespace to review this. The test content has not drastically changed for the existing tests, but newer value-tolerance-focused tests have been added.

@iamacook iamacook marked this pull request as ready for review October 16, 2024 08:45
Copy link
Member

@hectorgomezv hectorgomezv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏🏻👏🏻👏🏻

Copy link
Contributor

@PooyaRaki PooyaRaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with some suggestions.

@PooyaRaki
Copy link
Contributor

Question: Can we calculate the tolerance dynamically from the recent transactions of the sender?

@iamacook
Copy link
Member Author

Question: Can we calculate the tolerance dynamically from the recent transactions of the sender?

We only have the current page for comparison so it's not a sufficient sample size imo. If the page only had high value transactions, for example, there'd be a higher chance of false positives/

@PooyaRaki
Copy link
Contributor

Question: Can we calculate the tolerance dynamically from the recent transactions of the sender?

We only have the current page for comparison so it's not a sufficient sample size imo. If the page only had high value transactions, for example, there'd be a higher chance of false positives/

@iamacook Thanks for the explanation, I'll look into it more to see if there is anything else we can do to make it even stronger.

@iamacook iamacook merged commit a9825fb into main Oct 23, 2024
18 checks passed
@iamacook iamacook deleted the imitation-value-tolerance branch October 23, 2024 10:44
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.

Flag spoof events with a varied value
3 participants