CVE-2026-58654: Grav API Plugin Avatar Upload File Validation Bypass
The Grav API plugin version 1.0.0 has a flaw in how it handles avatar uploads. When a user uploads an avatar image, the system only checks the label that the browser sends (saying 'this is an image') but doesn't actually verify what the file really is. This means someone could upload malicious code — like a PHP script or a JavaScript-laden SVG file — disguised as an image. While the web server blocks direct access to these files via HTTP, they still exist on disk and could potentially be exploited if there are other weaknesses in the server setup or if attackers find creative ways to access them. The vulnerability was fixed in version 1.0.1.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 4.3 MEDIUM · CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N
- Weaknesses (CWE)
- CWE-434
- Affected products
- 0 configuration(s)
- Published / Modified
- 2026-07-08 / 2026-07-08
NVD description (verbatim)
The Grav API plugin (getgrav/grav-plugin-api) 1.0.0 contains an unrestricted file upload vulnerability in the avatar upload endpoint (/api/v1/users/user/avatar). The endpoint validates only the client-declared MIME type (getClientMediaType) beginning with 'image/' and does not inspect the actual file content or restrict the resulting extension, allowing an authenticated user to store arbitrary content — including PHP code, SVG with embedded JavaScript, and polyglot payloads — under user/accounts/avatars/ with predictable filenames. Direct HTTP access to the stored files is blocked by .htaccess (returns 403), but the files persist on disk and could lead to remote code execution or stored XSS in the presence of a path traversal flaw or server misconfiguration. Fixed in 1.0.1.
3 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
CVE-2026-58654 is an unrestricted file upload vulnerability in the Grav API plugin's avatar upload endpoint (/api/v1/users/user/avatar). The vulnerability stems from insufficient validation: the endpoint checks only the client-provided MIME type via getClientMediaType() for an 'image/' prefix but performs no content inspection and does not enforce file extension restrictions. Authenticated users can upload arbitrary files — including PHP executables, polyglot payloads, and SVGs with embedded JavaScript — which are stored under user/accounts/avatars/ with predictable filenames. While .htaccess rules prevent direct HTTP access (HTTP 403), the files persist on disk. The risk of remote code execution or stored XSS escalates if the deployment has path traversal vulnerabilities, misconfigured web server rules, or alternative access mechanisms. The issue was corrected in version 1.0.1.
Business impact
Organizations using the Grav API plugin 1.0.0 face a moderate but real risk to data integrity and system security. If an attacker with user credentials uploads malicious files, they could potentially execute code on the server or inject malicious scripts that execute when content is served. The attack requires prior authentication, limiting the immediate blast radius, but accounts can be compromised through credential theft, insider threats, or supply-chain attacks. The predictable storage locations and persistence of files on disk mean that exploitation windows can extend over time. Reputational and compliance risks arise if the vulnerability enables data exfiltration or service disruption.
Affected systems
All deployments running Grav API plugin version 1.0.0 are affected. The vulnerability does not exist in version 1.0.1 or later. Deployments are at highest risk if they involve multi-user environments, expose the API endpoint to untrusted users, or run on servers with additional misconfigurations that could bypass the .htaccess protections or expose the avatars directory via alternative paths.
Exploitability
Exploitability is moderate. The attack requires authentication — an attacker must have valid user credentials or be able to create a user account — but does not require elevated privileges. Once authenticated, uploading a malicious file is trivial: a simple HTTP POST with a falsified 'image/' MIME type succeeds. However, triggering code execution or stored XSS depends on auxiliary weaknesses: path traversal bugs, server misconfigurations, PHP execution in the avatars directory, or other means to access or interpret the uploaded files outside the .htaccess-protected direct HTTP path. The CVSS score of 4.3 reflects the authentication requirement and the indirect nature of impact.
Remediation
Upgrade to Grav API plugin version 1.0.1 or later immediately. Version 1.0.1 implements proper file content validation and enforces file extension restrictions, closing the upload bypass. After upgrading, review the avatars directory (user/accounts/avatars/) to identify and remove any suspicious files uploaded before the patch was applied. Verify that .htaccess rules are in place and functional. Consider implementing additional controls: restrict avatar uploads to whitelisted extensions (e.g., .jpg, .png), use randomized filenames instead of predictable ones, store uploads outside the web root, and apply the principle of least privilege to API endpoints.
Patch guidance
Update the Grav API plugin from version 1.0.0 to 1.0.1 or any later release. Verify against the official Grav plugin repository or vendor advisory to confirm version numbers and download integrity. If automatic updates are unavailable, manually download and install version 1.0.1 from the official source, then restart the application. After patching, audit the avatars directory for any suspicious files created during the window the vulnerable version was active. Test the avatar upload functionality to ensure the patch does not break legitimate workflows.
Detection guidance
Monitor for suspicious file uploads to the /api/v1/users/user/avatar endpoint, particularly those with mismatched MIME types or binary patterns inconsistent with valid images. Check the user/accounts/avatars/ directory for files with unusual extensions (e.g., .php, .svg, .exe) or unexpected content. Review authentication logs for compromised accounts or anomalous login activity. Examine web server logs for POST requests to the avatar endpoint and correlate with subsequent attempts to access the avatars directory via direct paths or traversal patterns. If PHP execution is possible in the avatars directory, monitor for unusual process spawning or outbound connections from the web server process.
Why prioritize this
This vulnerability merits prompt attention despite its moderate CVSS score (4.3). The combination of a predictable attack surface (authenticated file upload), persistent storage of malicious payloads, and potential for code execution or stored XSS creates a meaningful risk in multi-user environments. The authentication requirement and lack of active exploitation (not in CISA KEV) place it below critical level, but the ease of exploitation and the persistence of uploaded files warrant prioritization above typical 4.x-scored issues. Organizations should patch within their standard update windows, typically one to two weeks.
Risk score, explained
The CVSS 3.1 score of 4.3 (MEDIUM) reflects the following: the vulnerability is network-accessible with low attack complexity, but requires user privileges (authentication). The impact on integrity is low (ability to modify or inject content), with no direct impact on confidentiality or availability. The authentication requirement and the mitigating effect of .htaccess rules prevent a higher score. However, this static score does not fully capture the risk in environments with server misconfigurations, path traversal vulnerabilities, or PHP execution in the avatars directory, where impact could escalate.
Frequently asked questions
Can an unauthenticated attacker exploit this?
No. The endpoint requires authentication, so an attacker must have valid credentials or create an account first. This requirement significantly limits the attack surface compared to public-facing upload vulnerabilities.
What happens if someone uploads a PHP file to the avatars directory?
The .htaccess rules prevent direct HTTP access (returning HTTP 403), so a simple request to the file won't execute it. However, the PHP file persists on disk. If there is a path traversal vulnerability elsewhere, a server misconfiguration, or a feature that interprets uploaded files, code execution becomes possible. The risk is latent but real.
Is this vulnerability actively exploited in the wild?
This vulnerability is not currently listed in CISA's Known Exploited Vulnerabilities (KEV) catalog, which suggests no widespread active exploitation has been publicly documented. However, the ease of exploitation means security teams should not rely on this as a reason to delay patching.
What file types are most dangerous to upload?
PHP files (if the server can execute them), SVG files with embedded JavaScript (for stored XSS), and polyglot files that are valid images but also contain executable code are highest risk. Even seemingly benign uploads are hazardous because they consume disk space and may be leveraged in multi-stage attacks.
This analysis is provided for informational purposes and reflects publicly available information and the CVE record as of the publication date. Readers should verify patch version numbers and compatibility against official vendor advisories and release notes before deploying updates. The risk posed by this vulnerability varies based on server configuration, deployment architecture, and the presence of other vulnerabilities. Organizations should conduct their own risk assessments and testing before and after patching. SEC.co makes no warranty regarding the completeness or accuracy of this analysis and disclaims liability for decisions made in reliance on it. Source: NVD (public-domain), retrieved 2026-08-17. Analysis generated by SEC.co (claude-haiku-4-5).
Weaknesses (CWE)
Related vulnerabilities
- CVE-2025-40808MEDIUMSIPROTEC 5 File Upload Vulnerability in Siemens Protective Relays
- CVE-2025-59872MEDIUMHCL ZIE for Web File Upload Code Execution Vulnerability
- CVE-2026-10172MEDIUMBdtask Multi-Store Inventory 1.0 Unrestricted File Upload Vulnerability
- CVE-2026-10205MEDIUMUnrestricted File Upload in Metasoft MetaCRM 6.4.0 – Exploit Details & Remediation
- CVE-2026-10806MEDIUMUnrestricted File Upload in mjperpinosa stumasy
- CVE-2026-10807MEDIUMUnrestricted File Upload in mjperpinosa stumasy Profile Image Handler
- CVE-2026-11333MEDIUMUnrestricted File Upload in CollegeManagementSystem Dashboard
- CVE-2026-11621MEDIUMDcat-Admin Unrestricted File Upload Vulnerability (CVSS 4.7)