What is CloudPanel?
-------------------
#### This Was Explained In The Previous Blog Post.
Named: [Professionally Gain r00t – CVE-2023-33747 (CloudPanel.io)](https://www.datack.my/professionally-gain-r00t-cve-2023-33747-cloudpanel-io/)
### _**Speaking Overalls Here – Overview**_
In this vulnerability we have here, the Root-Cause-Analysis(RCA) have confirmed that it originated from the usage of default secret keys and default user as “**_clp_**“. It begins in the file manager in CloudPanel that have no session authentication resulted in a [broken access control](https://owasp.org/Top10/A01_2021-Broken_Access_Control/) when the cookie clp-fm encrypted value is inserted with the default secret key. The decrypted cookie value is in a form of a serialize string which attacker could change the user value into default clp user. With the added [PHP Object Injection](https://owasp.org/www-community/vulnerabilities/PHP_Object_Injection) this becomes a heavier matter in terms of impact.
The successful bypass into file-manager leads to a higher degree of impact whereby attacker can insert and upload a malicious file into CloudPanel main directory. By default, user “_**clp**_” have sudo nopasswd to all, so the privilege escalation involve in this vulnerability.
### _**Ride The Waves With Me – Technical Flow**_
_**Note : This is section shows some snippets from component named /home/clp/htdocs/app/files/public/file-manager/backend.php**_

As the picture above, it shows the flow of how the component receives the encrypted clp-fm cookie value.

Then, we see the value are then will be deserialize. **\*Note\*** here, the successfully decrypted cookie also leads to another vulnerability which attacker could abuse the serialization string in order to gain further post-exploitation opportunities (more hejes thingies). This includes and not limited to Remote Code Execution, Local Files Disclosures – so on and so forth.

The deserialized value, are then called as an Object in this case – the user value to pass into the variable $user.

This Part, is where the magic happens – Broken Access. Whereby it only needs the “_**clp-fm**_” cookie to authenticate it in order to proceed into the file-manager. The successfully decrypted cookie will pass the process into the backend to gain unrestricted access to the file-manager. From that point the attack escalates into a more serious threat by leveraging the feature to get user _**clp(r00t access)**_. Attack on CLP!
_ps: pun intended_

Picture above – is the successfully decrypted “**_clp-fm_**” cookie, where it contains a variable whereby the user can put any username in the server. We chose “**_clp_**” because intrinsically by default. The user “**_clp_**” has sudo permission in order to gain _**r00t**_.
### _**Banging The Door(s)? – POC**_
You Can Find The Python Code : [Here](https://github.com/datackmy/FallingSkies-CVE-2023-XXXX/blob/main/exploit2.py)

After all the flow are figured out, we constructed the exploit script to be completely automated for this vulnerability. Picture above is the example of successfully completed and automated python script.

The webshell we successfully upload into the server post exploitation
SSH login after exploitation which the user we inject into /etc/passwd with sudo privileges.
### **Special Thanks & Reference**
1. [https://github.com/datackmy/FallingSkies-CVE-2023-35885](https://github.com/datackmy/FallingSkies-CVE-2023-35885)
2. [https://www.cloudpanel.io/docs/v2/changelog/](https://www.cloudpanel.io/docs/v2/changelog/)
3. [https://nvd.nist.gov/vuln/detail/CVE-2023-35885](https://nvd.nist.gov/vuln/detail/CVE-2023-35885)