Skip to content

GHSA-q453-638c-h4mr CVE-2025-49222 GO-2025-3904

Mattermost Fails to Validate Remote Cluster Upload Sessions

Medium Go
Severity
6.8 / 10
Medium · CVSS 3.1
Exploit chance (EPSS)
0.30%
Chance of exploitation in the next 30 days. Higher than 22.90% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-434 Unrestricted Upload of File with Dangerous Type
Fix
Available
2 packages have a fixed version

Description

Mattermost versions 10.8.x <= 10.8.3, 10.5.x <= 10.5.8, 9.11.x <= 9.11.17, 10.9.x <= 10.9.2, 10.10.x <= 10.10.0 fail to validate upload types in remote cluster upload sessions which allows a system admin to upload non-attachment file types via shared channels that could potentially be placed in arbitrary filesystem directories.

Affected versions

Go

PackageVulnerableFixed in
github.com/mattermost/mattermost-server
>= 10.8.0, < 10.8.4
10.8.4
github.com/mattermost/mattermost-server
>= 10.5.0, < 10.5.9
10.5.9
github.com/mattermost/mattermost-server
>= 9.11.0, < 9.11.18
9.11.18
github.com/mattermost/mattermost-server
>= 10.9.0, < 10.9.3
10.9.3
github.com/mattermost/mattermost-server
>= 10.10.0, < 10.10.1
10.10.1
github.com/mattermost/mattermost-server
>= 9.11.0+incompatible, < 9.11.18+incompatible
>= 10.5.0+incompatible, < 10.5.9+incompatible
>= 10.8.0+incompatible, < 10.8.4+incompatible
>= 10.9.0+incompatible, < 10.9.3+incompatible
>= 10.10.0+incompatible, < 10.10.1+incompatible
9.11.18+incompatible
10.5.9+incompatible
10.8.4+incompatible
10.9.3+incompatible
10.10.1+incompatible
github.com/mattermost/mattermost-server/v5
<= 5.39.3
No fix yet
github.com/mattermost/mattermost-server/v5
all versions
No fix yet
github.com/mattermost/mattermost-server/v6
<= 5.7.2
No fix yet
github.com/mattermost/mattermost-server/v6
all versions
No fix yet
github.com/mattermost/mattermost/server/v8
< 8.0.0-20250708173752-d6b35c41f0ae5
8.0.0-20250708173752-d6b35c41f0ae5
github.com/mattermost/mattermost/server/v8
all versions
No fix yet

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

github.com/mattermost/mattermost-server Go → 10.8.4

go
go get github.com/mattermost/mattermost-server@v10.8.4 && go mod tidy

github.com/mattermost/mattermost/server/v8 Go → 8.0.0-20250708173752-d6b35c41f0ae5

go
go get github.com/mattermost/mattermost/server/v8@v8.0.0-20250708173752-d6b35c41f0ae5 && go mod tidy

Severity breakdown

CVSS 3.1 6.8

CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:N/A:N

Attack vector
Network
Attack complexity
Low
Privileges required
High
User interaction
None
Scope
Changed
Confidentiality
High
Integrity
None
Availability
None

Weakness

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 to prevent it
  • Architecture and Design: Generate a new, unique filename for an uploaded file instead of using the user-supplied filename, so that no external input is used at all.[REF-422] [REF-423]
  • Architecture and Design: When the set of acceptable objects, such as filenames or URLs, is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames or URLs, and reject all other inputs.
  • Architecture and Design: Consider storing the uploaded files outside of the web document root entirely. Then, use other mechanisms to deliver the files dynamically. [REF-423]
  • Implementation: Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright. For example, limiting filenames to alphanumeric characters can help to restrict the introduction of unintended file extensions.
  • Architecture and Design: Define a very limited set of allowable extensions and only generate filenames that end in these extensions. Consider the possibility of XSS (CWE-79) before allowing .html or .htm file types.
  • Implementation: Ensure that only one extension is used in the filename. Some web servers, including some versions of Apache, may process files based on inner extensions so that "filename.php.gif" is fed to the PHP interpreter.[REF-422] [REF-423]
  • Implementation: When running on a web server that supports case-insensitive filenames, perform case-insensitive evaluations of the extensions that are provided.
  • Architecture and Design: For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.
  • Implementation: Do not rely exclusively on sanity checks of file contents to ensure that the file is of the expected type and size. It may be possible for an attacker to hide code in some file segments that will still be executed by the server. For example, GIF images may contain a free-form comments field.
  • Implementation: Do not rely exclusively on the MIME content type or filename attribute when determining how to render a file. Validating the MIME content type and ensuring that it matches the extension is only a partial solution.
  • Architecture and Design, Operation: Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.
  • Architecture and Design, Operation: Run the code in a "jail" or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which files can be accessed in a particular directory or which commands can be executed by the software. OS-level examples include the Unix chroot jail, AppArmor, and SELinux. In general, managed code may provide some protection. For example, java.io.FilePermission in the Java SecurityManager allows the software to specify restrictions on file operations. This may not be a feasible solution, and it only limits the impact to the operating system; the rest of the application may still be subject to compromise. Be careful to avoid CWE-243 and other weaknesses related to jails.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-xmfh-3ccg-c9fx
Mattermost has an Incorrect Authorization issue
Low Also affects github.com/mattermost/mattermost-server
GHSA-h998-hxxj-8q83
Mattermost doesn't invalidate cached authentication state for active WebSocket connections during global session revocation
Medium Also affects github.com/mattermost/mattermost-server
GHSA-g5vr-6pgg-74qv
Mattermost doesn't enforce bot-specific permission checks on the user active status endpoint
Low Also affects github.com/mattermost/mattermost-server
GHSA-jqgv-39mg-7c2r
Mattermost doesn't authenticate Atlassian Connect installed callbacks, allowing a remote unauthenticated attacker to inject a rogue sharedSecret
Medium Also affects github.com/mattermost/mattermost-server
GHSA-mxq2-5jpg-7474
Mattermost doesn't validate channel ownership of an existing subscription before applying edits
Medium Also affects github.com/mattermost/mattermost-server
GHSA-2g8v-grq3-hq2g
Mattermost doesn't enforce administrator authorization on the {{setDefaultInstance}} call within the {{/gitlab connect}} command handler
Medium Also affects github.com/mattermost/mattermost-server
GHSA-6hxm-w4hv-vgvw
Mattermost doesn't require role-management authorization when setting the scheme_admin flag on group syncable link and patch endpoints
High Also affects github.com/mattermost/mattermost-server
GHSA-9p44-r552-4wp9
Mattermost doesn't sanitize the Remote Cluster API response on PATCH operations
Medium Also affects github.com/mattermost/mattermost-server
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor