Critical Security Flaw: 'tls_domain' Parameter Exposed as Unsanitized Config Injection Vector
A critical security vulnerability has been identified where the user-supplied `tls_domain` parameter is directly placed into a `re.sub` replacement string without any sanitization. This creates a dangerous configuration injection vector, allowing a malicious `tls_domain` value to inject arbitrary regex replacement patterns or other configuration content directly into the system. The flaw is categorized as P1 (Critical) and stems directly from documented code patterns, posing an immediate and severe risk to system integrity.
The vulnerability manifests in code where the `tls_domain` value is used unsafely, such as within template strings or, more critically, as the replacement argument in Python's `re.sub` function. An attacker could craft a payload like `${1}\nMALICIOUS_CONFIG}` or `$'\n'` to inject newlines and additional configuration directives. This bypasses normal input validation, turning a simple domain parameter into a powerful attack tool capable of rewriting configuration logic on the fly.
The primary impact is configuration injection, where a malicious actor can inject arbitrary config directives, potentially leading to server compromise. The open status of this issue indicates the vulnerability is currently unpatched, placing any system utilizing this code pattern at direct risk. This flaw represents a fundamental failure in secure input handling, requiring immediate code review and remediation to prevent exploitation.