CVE-2022-32065
Description
An arbitrary file upload vulnerability in the background management module of RuoYi v4.7.3 and below allows attackers to execute arbitrary code via a crafted HTML file.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
com.ruoyi:ruoyiMaven | < 4.7.4 | 4.7.4 |
Affected products
2Patches
Vulnerability mechanics
Root cause
"Missing file-type validation in the avatar upload function allows arbitrary file uploads."
Attack vector
An attacker with access to the background management module can upload a crafted HTML file (or other executable file) as the user avatar via the `updateAvatar` endpoint. Because the original code did not validate the uploaded file's MIME type or extension, the attacker can supply a file containing arbitrary code (e.g., a JSP webshell) that, once uploaded, can be accessed and executed on the server. The patch restricts uploads to image extensions only, closing this vector [patch_id=1641467].
Affected code
The vulnerability resides in the avatar upload endpoint in `SysProfileController.java` at the `updateAvatar` method. The original code called `FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file)` without any file-type restriction, allowing arbitrary file uploads.
What the fix does
The patch adds a third argument `MimeTypeUtils.IMAGE_EXTENSION` to the `FileUploadUtils.upload()` call, which restricts uploaded avatar files to allowed image extensions (e.g., jpg, png, gif). The `InvalidExtensionException` error message was also localized to Chinese, but the key security fix is the extension whitelist. This prevents attackers from uploading non-image files such as HTML, JSP, or PHP files that could be used to execute arbitrary code on the server [patch_id=1641467][patch_id=1641468].
Preconditions
- authAttacker must have access to the background management module of RuoYi
- networkThe avatar upload endpoint must be reachable
Generated on May 23, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
6- github.com/advisories/GHSA-6w2f-6wq3-rjvfghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2022-32065ghsaADVISORY
- gitee.com/y_project/RuoYi/commit/d8b2a9a905fb750fa60e2400238cf4750a77c5e6ghsax_refsource_MISCWEB
- gitee.com/y_project/RuoYi/issues/I57IMEghsax_refsource_MISCWEB
- github.com/yangzongzhuan/RuoYi/commit/d8b2a9a905fb750fa60e2400238cf4750a77c5e6ghsax_refsource_MISCWEB
- github.com/yangzongzhuan/RuoYi/issues/118ghsax_refsource_MISCWEB
News mentions
0No linked articles in our index yet.