Skip to content

Maui Essentials MAPT M02:2024 – INSECURE FILE PROVIDER PATH SETTING #31097

@danardelean

Description

@danardelean

Description

The microsoft_maui_essentials_fileprovider_file_paths.xml file is identified as a potential security vulnerability during a Mobile Application Penetration Test.
The primary concern lies in the following XML section:

<paths>
<external-path name=“external_files” path=“.” />
<cache-path name=“internal_cache” path=“.” />
<external-cache-path name=“external_cache” path=“.” />
</paths>

The issue arises from the exposure of the “.” path, which allows access to the entire cache directory. Even if the Exported attribute is set to false and the GrantUriPermissions attribute is set to true, this configuration does not justify the exposure of the “.” path.

For instance, the MediaPicker.android.cs class should not utilize the root directory:

var tmpFile = FileSystemUtils.GetTemporaryFile(Application.Context.CacheDir, fileName);

Instead, a subfolder, such as “MediaPicker”, should be used. This modification allows the fileProvider to restrict access to the cache directory to the “MediaPicker” subfolder, thereby minimizing the potential impact of a security breach.

Public API Changes

Do not use the Application.Context.CacheDir, or any other app folder, directly if it is not necessary and make the fileProvider file more granular

Intended Use-Case

Improve security of the applications generated with .NET MAUI

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-essentialsEssentials: Device, Display, Connectivity, Secure Storage, Sensors, App Infoproposal/opens/needs-infoIssue needs more info from the author

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions