-
Notifications
You must be signed in to change notification settings - Fork 4
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
Audit fixes #167
Audit fixes #167
Conversation
uint256 extensionValue; | ||
if (msg.value != valueRequired(tokenAddress, amount, nativeFee)) { | ||
revert InvalidValue(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was mostly thinking about just checking in the original initTransferExtension that extensionValue = 0. But overall, I think this works too.
Although this results in an extra call to Wormhole, even though that check is already performed internally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, what about regular fee
? I thought that we need to check it as well, but valueRequired
doesn't consider it. Also, for Sepolia chains messageFee
is 0
, but for other chains user might pay for it and then msg.value
would be greater than a value calculated by valueRequired
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fee refers to tokens, never Ether. valueRequired is a virtual function, and it’s calculated correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah so for wormhole it is already checked when sending a message? Then I'd probably just check for Ethereum version like you say
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep this perhaps in order not to rely on wormhole
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding checks for value == 0
in the default initTransferExtension
should be enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint256 extensionValue; | ||
if (msg.value != valueRequired(tokenAddress, amount, nativeFee)) { | ||
revert InvalidValue(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding checks for value == 0
in the default initTransferExtension
should be enough
https://github.com/AuditOneAuditReviews/Omnibridge2-audit-review/issues/3
https://github.com/AuditOneAuditReviews/Omnibridge2-audit-review/issues/24
https://github.com/AuditOneAuditReviews/Omnibridge2-audit-review/issues/10
https://github.com/AuditOneAuditReviews/Omnibridge2-audit-review/issues/19
Plus, validating
msg.value
on the EVM side