-
Notifications
You must be signed in to change notification settings - Fork 487
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
AVM: Cleanly handle broken switch/match programs #5782
Conversation
Previously, AVM panic'd while checking a malformed switch/match that was missing the byte encoding the number of cases. This meant the check failed, which is correct, but we endeavor to avoid panics.
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.
Looks correct to me
Codecov Report
@@ Coverage Diff @@
## master #5782 +/- ##
==========================================
- Coverage 55.91% 55.47% -0.44%
==========================================
Files 477 473 -4
Lines 66739 66720 -19
==========================================
- Hits 37317 37014 -303
- Misses 26905 27192 +287
+ Partials 2517 2514 -3
... and 30 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
interesting, I submit this security bug, Cost a lot of my time to write the report. you just don't think this is a problem. why you fix this? Your approach is so disappointing to me. I spent a lot of time studying avm and several hours found the bug. I feel that my work have not been respected. |
There is no security issue in the existing code. The CheckContract and Eval functions properly return errors. They do so by catching the panic. I prefer not to panic, so I've fixed it, and I appreciate you bringing it to my attention. |
you know this can panic, .the panic will lead the algorand node crash, so this is a security vulnerability |
No, it will not crash.
and the same thing is done to protect eval(). So the panic is caught, and the Your PoC Test ended with:
That is, you didn't check to see whether CheckContract properly returns an error, you just returned no matter what. If you check that, you will see it does. There is no crash. |
OK, switchTarget has no boundary check. If a hacker bypasses all previous checks,exploit this bug, the pc can also be controlled through the out-of-bounds read of this switchTarget. |
No. When switchTarget reads past the program, Go panics. The panic is caught above. The function returns an error. The PC is never updated in a bad way. If I am wrong, just show me a crash, or a jump to an arbitrary program location. |
Previously, AVM panic'd while checking a malformed switch/match that was missing the byte encoding the number of cases. This meant the check failed, which is correct, but we endeavor to avoid panics.