# GHSA-3m6q-h5gj-7mrw: Gitea has insecure default SSH settings

> Gitea's built-in SSH server advertises weak cryptographic algorithms by default, potentially allowing downgrade attacks or interception of SSH traffic.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 22 Apr 2026
- **Also known as:** GO-2026-5091

## What is GHSA-3m6q-h5gj-7mrw?

GHSA-3m6q-h5gj-7mrw is a vulnerability in code.gitea.io/gitea, published on 22 Apr 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

## Summary

The built-in SSH server currently advertises a number of key exchange, MAC, and host key algorithms that are considered weak or broken. The defaults should be tightened so a fresh installation passes a baseline SSH security audit out of the box.

## Details

Running `ssh-audit` against a default deployment flags the following as `fail`:

- **Key exchange**
  - `ecdh-sha2-nistp256`
  - `ecdh-sha2-nistp384`
  - `ecdh-sha2-nistp521`
- **MAC**
  - `hmac-sha1`
- **Host key**
  - `ssh-rsa`

## Reproduction

```sh
docker run -it --rm positronsecurity/ssh-audit -p 2222 gitea.local
```

## Impact

Default deployments expose algorithms that are known-weak or deprecated upstream. The current workaround requires manually setting several `GITEA__server__SSH_SERVER_*` variables, which most users will never do.

### Workaround

```ini
[server]
SSH_SERVER_KEY_EXCHANGES = curve25519-sha256, diffie-hellman-group14-sha256
SSH_SERVER_CIPHERS       = chacha20-poly1305@openssh.com, aes128-ctr, aes192-ctr, aes256-ctr, aes128-gcm@openssh.com, aes256-gcm@openssh.com
SSH_SERVER_MACS          = hmac-sha2-256-etm@openssh.com, hmac-sha2-256
```

There is no exposed option to restrict host key algorithms, so `ssh-rsa` remains advertised.

## Acceptance criteria

- [ ] Default `SSH_SERVER_KEY_EXCHANGES`, `SSH_SERVER_CIPHERS`, and `SSH_SERVER_MACS` updated to the secure list above.
- [ ] New `SSH_SERVER_HOST_KEY_ALGORITHMS` option added, with a default that excludes `ssh-rsa`.
- [ ] Documentation updated to reflect the new defaults.
- [ ] `ssh-audit` against a fresh install reports no `[fail]` entries.

## Which versions are affected by GHSA-3m6q-h5gj-7mrw?

3 open source packages ship an affected version, including code.gitea.io/gitea.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `code.gitea.io/gitea` | Go | All versions | 1.25.0 |
| `code.gitea.io/gitea` | Go | All versions | 1.25.0 |
| `code.gitea.io/gitea` | Go | All versions | 1.25.0 |

## How do I fix GHSA-3m6q-h5gj-7mrw?

Upgrade code.gitea.io/gitea to 1.25.0 or later.

## Is GHSA-3m6q-h5gj-7mrw being exploited?

There is no known exploitation of GHSA-3m6q-h5gj-7mrw in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-3m6q-h5gj-7mrw and fix it if it is affected.

What it is: GHSA-3m6q-h5gj-7mrw is a vulnerability in code.gitea.io/gitea, published on 22 Apr 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-3m6q-h5gj-7mrw in the wild and no public exploit code.

Affected packages and fixed versions:
- code.gitea.io/gitea (Go): affected all versions; fixed in 1.25.0
- code.gitea.io/gitea (Go): affected all versions; fixed in 1.25.0
- code.gitea.io/gitea (Go): affected all versions; fixed in 1.25.0

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/GHSA-3m6q-h5gj-7mrw/ (Markdown: https://insights.sbomify.com/GHSA-3m6q-h5gj-7mrw/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-3m6q-h5gj-7mrw

---
From sbomify Insights: https://insights.sbomify.com/GHSA-3m6q-h5gj-7mrw/
Summaries are generated and may contain mistakes; the official description above is the record.
