Nettacker icon indicating copy to clipboard operation
Nettacker copied to clipboard

Arbitrary code execution via exec() in response_conditions_matched

Open Gauravsharma2040 opened this issue 8 months ago • 0 comments

Summary response_conditions_matched() in nettacker/core/lib/http.py evaluates the responsetime condition using exec() with an operator taken directly from module YAML.

This allows arbitrary Python execution if a crafted module provides a malicious condition string.

Location: nettacker/core/lib/http.py ~line 95 Vulnerable pattern exec( f"matched = response['responsetime'] " f"{conditions['responsetime'].split()[0]} " f"{conditions['responsetime'].split()[1]}" )

Since the operator comes from YAML, a condition like:

conditions: responsetime: ">= 0 or import('os').system('id')"

would execute arbitrary code during scan.

Fix

Replace exec() with explicit operator dispatch:

ops = { '==': float.eq, '!=': float.ne, '>=': float.ge, '<=': float.le, '>': float.gt, '<': float.lt, }

Gauravsharma2040 avatar Mar 15 '26 12:03 Gauravsharma2040