CVE-2024-54148:
Remote Command Execution in file editing in gogs
9.8
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.52494%
CWE
Published
12/23/2024
Updated
12/26/2024
KEV Status
No
Technology
Go
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
gogs.io/gogs | go | < 0.13.1 | 0.13.1 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from insufficient symlink validation during file rename operations in the web editor. The patch adds two critical symlink checks:
- When handling new file paths (
entry.IsSymlink()
check) - When handling existing files during renames (
entry.IsSymlink()
check onoldTreePath
)
The original vulnerable code in editFilePost only checked the new file path for symlinks, but didn't verify if the original file being renamed (oldTreePath) was a symlink. This allowed attackers to modify symlink targets by renaming them, bypassing security restrictions. The function's failure to validate both old and new paths for symlink status directly enabled the path traversal and RCE chain.