-
Notifications
You must be signed in to change notification settings - Fork 455
Unsafe arithmetic in transfer handling #2396
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
Comments
Hi there @kevin-valerio, thanks for reporting this! The issue you encountered is currently only present in @davidsemakula Are you interested in looking into removing the annotations? Are you using ink! |
Thanks for reporting this @kevin-valerio
@cmichi the lint/diagnostic suppression is only present in master, but the unchecked operations are present in other branches |
@kevin-valerio Michi will confirm but I believe the unchecked operations in question only affect the off-chain testing environment, see here |
Indeed that's also what I think, do you also confirm @cmichi ? |
Yup, agree with both of you! We certainly have to fix it. |
While performing a
transfer
, I encountered unsafe arithmetic in ext.rs, which can be triggered using the following PoCPoC:
Output:
thread 'poc::tests::it_works' panicked at .cargo/registry/src/index.crates.io-6f17d22bba15001f/ink_engine-5.1.1/src/ext.rs:118:37: attempt to subtract with overflow
I haven't been further on the exploitation phase, but I suspect that might be abused by an attacker if the contract is built in release mode, where it will overflow. In debug mode, it just panics like shown above.
Is that known from the team ? Any feedback or help to see if this is actually an issue is appreciated
The text was updated successfully, but these errors were encountered: