Loading...
Skip to main content

CVE-2022-39345 — Vulnerability in...

CRITICAL

Gin-vue-admin subject to Remote Code Execution via file upload vulnerability

Published October 25, 2022Updated November 8, 2023Source: osv

Summary

### Impact Gin-vue-admin < 2.5.4 has File upload vulnerabilities。 File upload vulnerabilities are when a web server allows users to upload files to its filesystem without sufficiently validating things like their name, type, contents, or size. Failing to properly enforce restrictions on these could mean that even a basic image upload function can be used to upload arbitrary and potentially dangerous files instead. This could even include server-side script files that enable remote code execution. ### Patches https://github.com/flipped-aurora/gin-vue-admin/pull/1264 ### Workarounds https://github.com/flipped-aurora/gin-vue-admin/pull/1264 ### References #1263 ### For more information The plugin installation function of Gin-Vue-Admin allows users to download zip packages from the plugin market and upload them for installation. This function has an arbitrary file upload vulnerability. A malicious attacker can upload a constructed zip package to traverse the directory and upload or overwrite arbitrary files on the server side. The affected code https://github.com/flipped-aurora/gin-vue-admin/blob/main/server/service/system/sys_auto_code.go line 880 called the `utils.Unzip` method ``` paths, err := utils.Unzip(GVAPLUGPINATH+file.Filename, GVAPLUGPINATH) paths = filterFile(paths) var webIndex = -1 var serverIndex = -1 for i := range paths { paths[i] = filepath.ToSlash(paths[i]) pathArr := strings.Split(paths[i], "/") ln := len(pathArr) if ln < 2 { continue } if pathArr[ln-2] == "server" && pathArr[ln-1] == "plugin" { serverIndex = i } if pathArr[ln-2] == "web" && pathArr[ln-1] == "plugin" { webIndex = i } } if webIndex == -1 && serverIndex == -1 { zap.L().Error("非标准插件,请按照文档自动迁移使用") return webIndex, serverIndex, errors.New("非标准插件,请按照文档自动迁移使用") } ... ``` The https://github.com/flipped-aurora/gin-vue-admin/blob/main/server/utils/zip.go code defines the `utils.Unzip` method ``` //解压 func Unzip(zipFile string, destDir string) ([]string, error) { zipReader, err := zip.OpenReader(zipFile) var paths []string if err != nil { return []string{}, err } defer zipReader.Close() for _, f := range zipReader.File { fpath := filepath.Join(destDir, f.Name) paths = append(paths, fpath) if f.FileInfo().IsDir() { os.MkdirAll(fpath, os.ModePerm) ... ``` It can be analyzed that after uploading a zip compressed file, the `Unzip` method will be called to decompress the compressed file, and then judge whether the compressed file contains the fixed directory structure of server, web, and plugin. Whether the zip file is correct or not, it will be decompressed first. If the directory does not exist, it will be created automatically. Therefore, malicious zip packages can be constructed, and directory traversal can be performed during automatic decompression to upload or overwrite any file. Use the Zip Slip vulnerability to construct a malicious zip package with `../../../../` filenames, and upload the malicious zip package to trigger the vulnerability. ![1](https://user-images.githubusercontent.com/113822259/197387942-e40c188d-cff0-4da3-84ba-7ca670d9bf72.png) ![2](https://user-images.githubusercontent.com/113822259/197387956-cef8fd0d-978a-47ae-a65e-e28367f6a0b8.png)

Advisory Timeline

  • First published October 25, 2022 (1448 days ago).
  • Last revised November 8, 2023 — 378 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Go
Update github.com/flipped-aurora/gin-vue-admin/server to 2.5.4 or later
go get github.com/flipped-aurora/gin-vue-admin/server@v2.5.4

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: go (1).

PackageEcosystemAffectedFixed In
github.com/flipped-aurora/gin-vue-admin/server
go
All versions2.5.4

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 9.8 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

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

Frequently Asked Questions

What is CVE-2022-39345?
Gin-vue-admin subject to Remote Code Execution via file upload vulnerability This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.8/10).
How do I check if my project is affected by CVE-2022-39345?
CVE-2022-39345 affects github.com/flipped-aurora/gin-vue-admin/server. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2022-39345 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
9.8

Exploitation is straightforward and causes maximum impact. Patch immediately.

Also Known As

GHSA-7gc4-r5jr-9hxv

Related CVEs

  • CVE-2026-107806
    CRITICAL

    Nginx UI: Authenticated Remote Code Execution via Backup Restore App Config Overwrite

  • CVE-2026-68582
    CRITICAL

    Vikunja: Link-share token reads any tenant's kanban buckets and enumerates usernames/IDs instance-wide (BOLA)

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies