T09 · Insecure Skill Coding Practices
- Location
scripts/doe_generator.py:39- Finding
Unbounded DOE Dimensions Allow Memory and CPU Exhaustion
- Content
View full analysis
Vulnerability Details
File Location:
scripts/doe_generator.py, lines 39 and 126-140
Vulnerability Type: Uncontrolled resource consumption
Risk Level: MediumVulnerable Code
python combinations = list(itertools.product(levels, repeat=num_factors))python if resolution == 3: # Resolution III: 2^(k-2) p = 2 num_runs = 2 ** (num_factors - 2) elif resolution == 4: # Resolution IV: 2^(k-1) p = 1 num_runs = 2 ** (num_factors - 1) else: # Resolution V+: requires a larger design p = 0 num_runs = 2 ** num_factors # Ensure a minimum number of runs num_runs = max(num_runs, 4)Technical Analysis
The command-line validation enforces only minimum values and does not impose upper limits on the number of factors, levels, generated runs, or estimated output size.
Full-factorial generation materializes the entire Cartesian product in a Python list. Its memory and processing requirements grow as
num_levels ** num_factors. Fractional generation similarly calculates exponentially growing run counts and subsequently constructs all runs in memory. A sufficiently large input can therefore exhaust available memory, saturate CPU resources, or produce an extremely large output file.Attack Path
- An attacker or untrusted caller invokes the Skill with an excessive dimension, such as a very large
--factors,--levels, or--num-factorsvalue. - The script accepts the value because it only validates the minimum boundary.
- The full-factorial path materializes an exponential Cartesian product, or the fractional path calculates and iterates over an exponential number of runs.
- The Python process consumes excessive memory and CPU time.
- The process may be terminated by the operating system, and other workloads on the same host may become unavailable or degraded.
Impact Assessment
Exploitation can cause a local denial of ser ...[truncated 269 chars]
- An attacker or untrusted caller invokes the Skill with an excessive dimension, such as a very large
- Remediation
View remediation
Remediation Suggestions
- Define conservative maximum values for factors, levels, generated runs, and estimated output bytes.
- Calculate the expected run count before allocating the design and reject requests exceeding the configured limit.
- Apply checked arithmetic and reject values that exceed practical integer or storage limits.
- Stream full-factorial rows directly to CSV instead of converting the complete Cartesian product into a list.
- Consider operating-system resource limits, execution timeouts, and disk quotas when this script can be invoked by untrusted users.
- Return a clear error describing the calculated run count and the configured safety limit.
