Submitted by DadeKuma, also found by Koolex and zhaojie
Any user can intentionally crash a worker by sending a maliciously crafted request with a huge timeout.
This attack has no costs for the attacker, and it can result in a DoS of the worker/cluster system.
A user can specify a timeout when doing a batch_http_request:
https://github.com/code-423n4/2024-03-phala-network/blob/a01ffbe992560d8d0f17deadfb9b9a2bed38377e/phala-blockchain/crates/pink/chain-extension/src/lib.rs#L56
The issue is that in Rust, the + operator can overflow when numerics bound are exceeded; this will result in a panic error.
When a malicious user sends a request with a timeout greater than u64::MAX - 200, they will crash the worker. As this action will cost nothing to the attacker, they can simply send multiple requests to crash all the workers, which will result in a DoS of the cluster system.
Copy-paste the following test in phala-blockchain/crates/pink/chain-extension/src/mock_ext.rs:
Output:
Consider using saturating_add instead:
Invalid Validation
kvinwang (Phala) confirmed, but disagreed with severity and commented:
Lambda (judge) commented:
kvinwang (Phala) commented:
Lambda (judge) decreased severity to Medium and commented:
For this audit, 7 reports were submitted by wardens detailing low risk and non-critical issues. The report highlighted below by Cryptor received the top score from the judge.
The following wardens also submitted reports: ihtishamsudo, XDZIBECX, 0xTheC0der, zhaojie, Bauchibred, and Daniel526.
