Closed c4-bot-5 closed 6 months ago
141345 marked the issue as primary issue
141345 marked the issue as sufficient quality report
set the wrong const value, 64KiB * 16 as 16
125 const MB: u32 = 16; <<<--- the uint is pages
128 schedule.limits.memory_pages = 4 * MB; <<<--- assigned to memory_pages
A wasm page is of 64KiB.
kvinwang (sponsor) disputed
OpenCoreCH marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-03-phala-network/blob/a01ffbe992560d8d0f17deadfb9b9a2bed38377e/phala-blockchain/crates/pink/runtime/src/runtime.rs#L125
Vulnerability details
Impact
In runtime.rs#L125, the
MB
should be 64KiB * 16, but it's defined as 16. Which causesschedule.limits.memory_pages
much smaller than expected.Proof of Concept
As shown in runtime.rs#L125 and runtime.rs#L128:
Tools Used
Recommended Mitigation Steps
Assessed type
Other