#37985 [SC-Low] Incorrectly Eliminate Code With Side Effect In Slice Args
Description
Brief/Intro
Vulnerability Details
class Slice(BuiltinFunctionT):
...
def fetch_call_return(self, node):
...
arg = node.args[0]
...
length_expr = node.args[2].reduced()
# CMC 2022-03-22 NOTE slight code duplication with semantics/analysis/local
is_adhoc_slice = arg.get("attr") == "code" or (
arg.get("value.id") == "msg" and arg.get("attr") == "data"
)
start_literal = start_expr.value if isinstance(start_expr, vy_ast.Int) else None
length_literal = length_expr.value if isinstance(length_expr, vy_ast.Int) else None
if not is_adhoc_slice:
if length_literal is not None:
if length_literal < 1:
raise ArgumentException("Length cannot be less than 1", length_expr)
if length_literal > arg_type.length:
raise ArgumentException(f"slice out of bounds for {arg_type}", length_expr)
if start_literal is not None:
if start_literal > arg_type.length:
raise ArgumentException(f"slice out of bounds for {arg_type}", start_expr)
if length_literal is not None and start_literal + length_literal > arg_type.length:
raise ArgumentException(f"slice out of bounds for {arg_type}", node)
...Impact Details
References
Proof of Concept
Proof of Concept
Previous#38598 [BC-Insight] GetReceiptsMsg abuse leads to the DoS and/or crash of every EL client in the Ethereum networkNext#38686 [BC-Low] Nodes with trusted peers vulnerable to pending peer flooding and DoS
Was this helpful?