-
Notifications
You must be signed in to change notification settings - Fork 0
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
RIPEMD-160 fails when (input length & 63) is greater or equal to 55 #22
Comments
Severity: Medium Comment: Ok but asset are not directly at risks considering that the tx will revert. |
dmvt marked the issue as unsatisfactory: |
Hi @dmvt, I'm not entirely sure why this was invalidated. The report contains a correct Root Cause analysis outlining exactly when, why and where this is issue is rising as well as Tests to reproduce it and mitigation steps to fix it. Can you please clarify what's missing ? Thank you |
My apologies. Most of your comments were collapsed and for some reason I didn't see that. May have been a formatting issue with the extension. |
dmvt changed the severity to 2 (Med Risk) |
Hi @dmvt, My bad, will expand the code sections by default in future reports. Thank you |
dmvt removed the grade |
dmvt marked the issue as duplicate of #120 |
dmvt marked the issue as satisfactory |
Lines of code
https://github.com/kkrt-labs/kakarot/blob/7411a5520e8a00be6f5243a50c160e66ad285563/src/kakarot/precompiles/ripemd160.cairo#L42-L83
https://github.com/kkrt-labs/kakarot/blob/7411a5520e8a00be6f5243a50c160e66ad285563/src/kakarot/precompiles/ripemd160.cairo#L427-L480
Vulnerability details
Impact
This leads to the Starknet transaction reverting and can DoS contracts relying on
RIPEMD-160
.Additionally, right now, it can be used to drain Kakarot Relayers by sending multiple transactions and making them pay the Starknet fees without any counterpart cost.
Proof of Concept
Root Cause
RIPEMD-160
When
input_length & 63 >= 55
(.e.g 57, 125), RIPEMD-160 fails while finalizing the dictionary in (3) due to thestart
(1) andx
(2) pointers being on different memory segments.Unit Test
Modify the
test_ripemd160
unit test :Bytecode
Add an entry for the following bytecode in E2E tests
600060006038600060035afa
Test Results / Transaction Results
Recommended Mitigation Steps
Reassign the
start
pointer.Assessed type
Error
The text was updated successfully, but these errors were encountered: