# CVE-2022-36071: Recovery codes abuse in SFTPGo

> Attackers with valid passwords can pre-generate recovery codes to bypass two-factor authentication in SFTPGo WebAdmin and WebClient.

- **Severity:** High 8.3 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 2 Sep 2022
- **Updated:** 22 Apr 2025
- **Also known as:** GHSA-54qx-8p8w-xhg8, GO-2022-0964

## What is CVE-2022-36071?

CVE-2022-36071 is a high-severity authentication bypass vulnerability in drakkan sftpgo, published on 2 Sep 2022. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

SFTPGo is configurable SFTP server with optional HTTP/S, FTP/S and WebDAV support. SFTPGo WebAdmin and WebClient support login using TOTP (Time-based One Time Passwords) as a secondary authentication factor. Because TOTPs are often configured on mobile devices that can be lost, stolen or damaged, SFTPGo also supports recovery codes. These are a set of one time use codes that can be used instead of the TOTP. In SFTPGo versions from version 2.2.0 to 2.3.3 recovery codes can be generated before enabling two-factor authentication. An attacker who knows the user's password could potentially generate some recovery codes and then bypass two-factor authentication after it is enabled on the account at a later time. This issue has been fixed in version 2.3.4. Recovery codes can now only be generated after enabling two-factor authentication and are deleted after disabling it.

Weakness: CWE-916 (Use of Password Hash With Insufficient Computational Effort), CWE-287 (Improper Authentication)

## Which versions are affected by CVE-2022-36071?

4 open source packages ship an affected version, including github.com/drakkan/sftpgo/v2 and github.com/drakkan/sftpgo. It affects 1 product.


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

Products: Sftpgo Project Sftpgo.

## How do I fix CVE-2022-36071?

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

## Is CVE-2022-36071 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-36071 exists.

## Other vulnerabilities in drakkan sftpgo

- [CVE-2022-39220](https://insights.sbomify.com/CVE-2022-39220/): XSS Vulnerabilities in WebClient (medium 6.1)
- [CVE-2026-30914](https://insights.sbomify.com/CVE-2026-30914/): SFTPGo has a Path Traversal and Permission Bypass via Path Normalization Discrepancy (medium 5.3)
- [CVE-2026-30915](https://insights.sbomify.com/CVE-2026-30915/): SFTPGo improperly sanitizes placeholders in group home directories/key prefixes (medium 5.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-36071 and fix it if it is affected.

What it is: CVE-2022-36071 is a high-severity authentication bypass vulnerability in drakkan sftpgo, published on 2 Sep 2022. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-36071 exists.

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

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-2022-36071/ (Markdown: https://insights.sbomify.com/CVE-2022-36071/index.md)
```

## Sources

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

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