Bug 2584093 (CVE-2026-136830)

Summary: CVE-2026-136830 mirrormanager2: mirrormanager2: Arbitrary command execution via unsanitized mirror URLs
Product: [Other] Security Response Reporter: OSIDB Bzimport <bzimport>
Component: vulnerabilityAssignee: Product Security DevOps Team <prodsec-dev>
Status: NEW --- QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedKeywords: Security
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
A flaw was found in mirrormanager2. This vulnerability allows an authenticated user with mirror management privileges to execute arbitrary commands on the host system. By submitting a specially crafted repository URL containing shell control characters, the input is passed directly to an underlying system command during automated synchronization without adequate sanitization. Successful exploitation can result in full compromise of the crawler system and exposure of sensitive configuration data.
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description OSIDB Bzimport 2026-11-25 11:50:54 UTC
======================================================================
1. VULNERABILITY SUMMARY
======================================================================
- Title: Remote Command Execution (RCE) via Unsanitized Shell Invocation in run_rsync
- Affected Project: Fedora MirrorManager2 (https://github.com/fedora-infra/mirrormanager2)
- Affected Component: mirrormanager2/lib/sync.py (run_rsync) and mirrormanager2/crawler/rsync_connector.py

======================================================================
2. ROOT CAUSE ANALYSIS
======================================================================
In `mirrormanager2/lib/sync.py` (lines 74–90), the `run_rsync()` function constructs a shell command line via direct raw string concatenation with `shell=True`:

```python
    cmd = "rsync --temp-dir=/tmp -r --exclude=.snapshot --exclude='*.~tmp~'"
    if extra_rsync_args is not None:
        cmd += " " + extra_rsync_args
    cmd += " " + rsyncpath
    ...
    p = subprocess.Popen(
        cmd,
        shell=True,
        stdin=devnull,
        stdout=tmpfile,
        stderr=devnull,
        close_fds=True,
        bufsize=-1,
    )
```

The `rsyncpath` argument is passed directly from the `HostCategoryUrl.url` database attribute by `mirrormanager2/crawler/rsync_connector.py` (line 27):

    result, listing = run_rsync(url, self._config["CRAWLER_RSYNC_PARAMETERS"], logger)

Any registered mirror administrator can add or modify their Host Category URLs at will. In MirrorManager2, newly created sites and hosts default to `admin_active = True`, and URL records are committed immediately without an approval queue.

Because `shell=True` invokes `/bin/sh -c`, standard shell control metacharacters (such as `;`, `&&`, `|`, `$(...)`, or backticks) break out of the rsync argument and execute arbitrary shell commands on the crawler node.

Furthermore, WTForms URL validation (`wtforms.validators.URL(require_tld=False)`) complies with RFC 3986, which explicitly allows semicolons, ampersands, and parentheses as valid URL sub-delimiters, meaning the payload is stored unmodified in the database.

======================================================================
3. PROOF OF CONCEPT (LOCAL REPRODUCTION)
======================================================================
The following standalone Python test script demonstrating the exact logic from `lib/sync.py` and `crawler/rsync_connector.py` confirms execution. It proves that wtforms sanitizing does not prevent malformed entries, and the malicious code is executing:

```python

from wtforms import Form, StringField
from wtforms.validators import URL
import subprocess

class MirrorURLForm(Form):
rsyncpath = StringField('rsyncpath', validators=[URL(require_tld=False, message="Invalid URL")])

def test_url_validation(candidate_value: str):
#Validates a test string against the WTForms URL validator
#Populate the form with the test candidate
form = MirrorURLForm(data={'rsyncpath':"http://" + candidate_value}) #adding http prefix for wtforms compliance simulation

#Run validation
passes_validation = form.validate()
print(f"Testing value: {candidate_value}")
if passes_validation:
print("Result: PASSED validation")
else:
print(f"Validation errors: {form.errors}\n")
return passes_validation, candidate_value

#valid rsync_path
test_url_validation("example.com")

#malicious rsync_path
is_valid, captured_value = test_url_validation("example.com/;$(touch malicious_file)")

#simulate execution of untrusted command on org infrastructure as root
cmd = f"rsync -nv test_directory/ user@{captured_value}:" #executes `touch malicious_file`
p = subprocess.Popen(cmd, shell=True, text=True)
p.communicate()

```

======================================================================
4. OPERATIONAL IMPACT
======================================================================
According to `utility/mirrormanager.cron` (line 16):

    0 */12 * * * root /usr/bin/mm2_crawler.py -c /etc/mirrormanager/prod.cfg --threads 75 > /dev/null 2>&1

The crawler runs every 12 hours as the `root` user. Therefore:
1. An attacker registering a community mirror gains root-level code execution on the crawler host.
2. The attacker gains read access to `/etc/mirrormanager/prod.cfg`, compromising master database credentials and secrets.
3. Compromise of the crawler allows potential supply-chain manipulation of valid repository statuses.