# GHSA-q347-cg56-pcq4: SSRF in repository migration

> A malicious user can exploit repository migration to discover internal network services, requiring an upgrade to Gogs.

- **Severity:** Not scored
- **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:** 14 Mar 2022
- **Also known as:** GO-2022-0377

## What is GHSA-q347-cg56-pcq4?

GHSA-q347-cg56-pcq4 is a server-side request forgery vulnerability in gogs.io/gogs, published on 14 Mar 2022. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

### Impact

The malicious user is able to discover services in the internal network through repository migration functionality. All installations accepting public traffic are affected.

### Patches

Internal network CIDRs are prohibited to be used as repository migration targets. Users should upgrade to 0.12.5 or the latest 0.13.0+dev.

### Workarounds

Run Gogs in its own private network.

### References

https://www.huntr.dev/bounties/327797d7-ae41-498f-9bff-cc0bf98cf531/

### For more information

If you have any questions or comments about this advisory, please post on #6754.

## Which versions are affected by GHSA-q347-cg56-pcq4?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `gogs.io/gogs` | Go | All versions | 0.12.5 |
| `gogs.io/gogs` | Go | All versions | 0.12.5 |
| `gogs.io/gogs` | Go | All versions | 0.12.5 |

## How do I fix GHSA-q347-cg56-pcq4?

Upgrade gogs.io/gogs to 0.12.5 or later.

## Is GHSA-q347-cg56-pcq4 being exploited?

There is no known exploitation of GHSA-q347-cg56-pcq4 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-q347-cg56-pcq4 and fix it if it is affected.

What it is: GHSA-q347-cg56-pcq4 is a server-side request forgery vulnerability in gogs.io/gogs, published on 14 Mar 2022. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-q347-cg56-pcq4 in the wild and no public exploit code.

Affected packages and fixed versions:
- gogs.io/gogs (Go): affected all versions; fixed in 0.12.5
- gogs.io/gogs (Go): affected all versions; fixed in 0.12.5
- gogs.io/gogs (Go): affected all versions; fixed in 0.12.5

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-q347-cg56-pcq4/ (Markdown: https://insights.sbomify.com/GHSA-q347-cg56-pcq4/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-q347-cg56-pcq4

---
From sbomify Insights: https://insights.sbomify.com/GHSA-q347-cg56-pcq4/
Summaries are generated and may contain mistakes; the official description above is the record.
