# CVE-2024-52309: SFTPGo allows administrators to restrict command execution from the EventManager

> Administrators with WebAdmin access can execute arbitrary system commands via EventManager, bypassing intended restrictions and gaining OS-level access.

- **Severity:** Medium 5.1 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** An administrator
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 21 Nov 2024
- **Updated:** 21 Nov 2024
- **Also known as:** GHSA-49cc-xrjf-9qf7, GO-2024-3283

## What is CVE-2024-52309?

CVE-2024-52309 is a medium-severity vulnerability in drakkan sftpgo, published on 21 Nov 2024. An attacker needs administrator access to exploit it, with no action from the victim.

### Official description

SFTPGo is a full-featured and highly configurable SFTP, HTTP/S, FTP/S and WebDAV server - S3, Google Cloud Storage, Azure Blob. One powerful feature of SFTPGo is the ability to have the EventManager execute scripts or run applications in response to certain events. This feature is very common in all software similar to SFTPGo and is generally unrestricted. However, any SFTPGo administrator with permission to run a script has access to the underlying OS/container with the same permissions as the user running SFTPGo. This is unexpected for some SFTPGo administrators who think that there is a clear distinction between accessing the system shell and accessing the SFTPGo WebAdmin UI. To avoid this confusion, running system commands is disabled by default in 2.6.3, and an allow list has been added so that system administrators configuring SFTPGo must explicitly define which commands are allowed to be configured from the WebAdmin UI.

Weakness: CWE-20 (Improper Input Validation)

## Which versions are affected by CVE-2024-52309?

6 open source packages ship an affected version, including github.com/drakkan/sftpgo/v2, github.com/drakkan/sftpgo and sftpgo.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/drakkan/sftpgo/v2` | Go | From 2.4.0 | 2.6.3 |
| `github.com/drakkan/sftpgo/v2` | Go | From 2.4.0 | 2.6.3 |
| `github.com/drakkan/sftpgo/v2` | Go | From 2.4.0 | 2.6.3 |
| `github.com/drakkan/sftpgo` | Go | All versions | None |
| `sftpgo` | Go | From 2.4.0 | 2.6.3 |
| `sftpgo` | Go | From 2.4.0 | 2.6.3 |

## How do I fix CVE-2024-52309?

Upgrade github.com/drakkan/sftpgo/v2 to 2.6.3 or later.

## Is CVE-2024-52309 being exploited?

There is no known exploitation of CVE-2024-52309 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-52309 and fix it if it is affected.

What it is: CVE-2024-52309 is a medium-severity vulnerability in drakkan sftpgo, published on 21 Nov 2024. An attacker needs administrator access to exploit it, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2024-52309 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/drakkan/sftpgo/v2 (Go): affected from 2.4.0; fixed in 2.6.3
- github.com/drakkan/sftpgo/v2 (Go): affected from 2.4.0; fixed in 2.6.3
- github.com/drakkan/sftpgo/v2 (Go): affected from 2.4.0; fixed in 2.6.3
- github.com/drakkan/sftpgo (Go): affected all versions; no fix listed
- sftpgo (Go): affected from 2.4.0; fixed in 2.6.3
- sftpgo (Go): affected from 2.4.0; fixed in 2.6.3

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-52309/ (Markdown: https://insights.sbomify.com/CVE-2024-52309/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-52309
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-52309
- OSV: https://osv.dev/vulnerability/CVE-2024-52309

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-52309/
Summaries are generated and may contain mistakes; the official description above is the record.
