GHSA-C8M7-R2JV-RW63

Vulnerability from github – Published: 2026-07-07 13:02 – Updated: 2026-07-07 13:02
VLAI
Summary
EGroupware Vulnerable to Local File Inclusion via file:// URI in Mail Compose
Details

Summary

The function processes image URLs embedded in an HTML email body without validating or restricting URI schemes. The check !str_starts_with($myUrl, 'http') evaluates to true for file:// URIs, causing file_get_contents($basedir . urldecode($myUrl)) to read arbitrary files from the server filesystem and embed them as inline MIME attachments in outgoing email.

str_starts_with('file:///etc/passwd', 'http') → false !false → true

// api/src/Mail.php  
foreach($images[2] as $i => $url)
            {
                //$isData = false;
                $basedir = $data = '';
                $needTempFile = true;
                $attachmentData = ['name' => '', 'type' => '', 'file' => '', 'tmp_name' => ''];
                try
                {
                    // do not change urls for absolute images (thanks to corvuscorax)
                    if (!str_starts_with($url, 'data:'))
                    {
                        $attachmentData['name'] = basename($url); // need to resolve all sort of url
                        if (($directory = dirname($url)) == '.') $directory = '';
                        $ext = pathinfo($attachmentData['name'], PATHINFO_EXTENSION);
                        $attachmentData['type'] = MimeMagic::ext2mime($ext);
                        if ( strlen($directory) > 1 && !str_ends_with($directory, '/')) { $directory .= '/'; }
..
...
....
// processURL2InlineImages function
if ( $myUrl[0]!='/' && strlen($basedir) > 1 && !str_ends_with($basedir, '/')) { $basedir .= '/'; }
                        if ($needTempFile && empty($attachment) && !str_starts_with($myUrl, "http"))
                        {
                            try {
                                $data = file_get_contents($basedir.urldecode($myUrl));
                            }
                            catch (\Throwable $e) {
                                _egw_log_exception($e);
                            }
                        }
                    }
                    if (str_starts_with($url, 'data:'))

PoC

  1. Log in as any authenticated EGroupware user with mail access and open the mail compose window.
  2. Switch to HTML body mode and insert: <img src="file:///etc/passwd">.
  3. The server executes file_get_contents('file:///etc/passwd'), writes the content to a temp file, and attaches it as an inline MIME part.

Impact

An authenticated attacker can read arbitrary files accessible by the web server process, including /etc/passwd, application configuration files containing database credentials, private TLS keys, and environment files.

Remediation

Enforce a strict URI scheme allowlist before calling file_get_contents(). Replace the check !str_starts_with($myUrl, 'http') with if (!preg_match('#^https?://#i', $myUrl)) { continue; } to reject file://, ftp://, php://, data://, and any other non-HTTP scheme.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Packagist",
        "name": "egroupware/egroupware"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "26.0.20251208"
            },
            {
              "fixed": "26.5.20260507"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "Packagist",
        "name": "egroupware/egroupware"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "23.1.20260601"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-45016"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-73"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-07-07T13:02:43Z",
    "nvd_published_at": null,
    "severity": "MODERATE"
  },
  "details": "### Summary\nThe function processes image URLs embedded in an HTML email body without validating or restricting URI schemes. The check `!str_starts_with($myUrl, \u0027http\u0027)` evaluates to true for `file://` URIs, causing `file_get_contents($basedir . urldecode($myUrl))` to read arbitrary files from the server filesystem and embed them as inline MIME attachments in outgoing email.\n\nstr_starts_with(\u0027file:///etc/passwd\u0027, \u0027http\u0027) \u2192 **false**\n!false \u2192 **true**\n\n\n```php\n// api/src/Mail.php  \nforeach($images[2] as $i =\u003e $url)\n\t\t\t{\n\t\t\t\t//$isData = false;\n\t\t\t\t$basedir = $data = \u0027\u0027;\n\t\t\t\t$needTempFile = true;\n\t\t\t\t$attachmentData = [\u0027name\u0027 =\u003e \u0027\u0027, \u0027type\u0027 =\u003e \u0027\u0027, \u0027file\u0027 =\u003e \u0027\u0027, \u0027tmp_name\u0027 =\u003e \u0027\u0027];\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\t// do not change urls for absolute images (thanks to corvuscorax)\n\t\t\t\t\tif (!str_starts_with($url, \u0027data:\u0027))\n\t\t\t\t\t{\n\t\t\t\t\t\t$attachmentData[\u0027name\u0027] = basename($url); // need to resolve all sort of url\n\t\t\t\t\t\tif (($directory = dirname($url)) == \u0027.\u0027) $directory = \u0027\u0027;\n\t\t\t\t\t\t$ext = pathinfo($attachmentData[\u0027name\u0027], PATHINFO_EXTENSION);\n\t\t\t\t\t\t$attachmentData[\u0027type\u0027] = MimeMagic::ext2mime($ext);\n\t\t\t\t\t\tif ( strlen($directory) \u003e 1 \u0026\u0026 !str_ends_with($directory, \u0027/\u0027)) { $directory .= \u0027/\u0027; }\n..\n...\n....\n// processURL2InlineImages function\nif ( $myUrl[0]!=\u0027/\u0027 \u0026\u0026 strlen($basedir) \u003e 1 \u0026\u0026 !str_ends_with($basedir, \u0027/\u0027)) { $basedir .= \u0027/\u0027; }\n\t\t\t\t\t\tif ($needTempFile \u0026\u0026 empty($attachment) \u0026\u0026 !str_starts_with($myUrl, \"http\"))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t$data = file_get_contents($basedir.urldecode($myUrl));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (\\Throwable $e) {\n\t\t\t\t\t\t\t\t_egw_log_exception($e);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (str_starts_with($url, \u0027data:\u0027))\n```\n\n### PoC\n1. Log in as any authenticated EGroupware user with mail access and open the mail compose window.\n2. Switch to HTML body mode and insert: `\u003cimg src=\"file:///etc/passwd\"\u003e`. \n3. The server executes file_get_contents(\u0027file:///etc/passwd\u0027), writes the content to a temp file, and attaches it as an inline MIME part. \n\n\n### Impact\nAn authenticated attacker can read arbitrary files accessible by the web server process, including /etc/passwd, application configuration files containing database credentials, private TLS keys, and environment files.\n\n\n### Remediation\nEnforce a strict URI scheme allowlist before calling file_get_contents(). Replace the check `!str_starts_with($myUrl, \u0027http\u0027)` with `if (!preg_match(\u0027#^https?://#i\u0027, $myUrl)) { continue; }` to reject `file://`, `ftp://`, `php://`, `data://`, and any other non-HTTP scheme.",
  "id": "GHSA-c8m7-r2jv-rw63",
  "modified": "2026-07-07T13:02:43Z",
  "published": "2026-07-07T13:02:43Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/EGroupware/egroupware/security/advisories/GHSA-c8m7-r2jv-rw63"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/EGroupware/egroupware"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "EGroupware Vulnerable to Local File Inclusion via file:// URI in Mail Compose"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.

Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…