# GHSA-f8mx-cwfh-7hr2: TShock allows chat while not fully connected, possible ban evasion

> Banned users can bypass restrictions and spy on server data by skipping the connection handshake, allowing harassment and unauthorized observation.

- **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:** 3 Feb 2025

## What is GHSA-f8mx-cwfh-7hr2?

GHSA-f8mx-cwfh-7hr2 is an authentication bypass vulnerability in TShock, published on 3 Feb 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

This issue was reported to TShock by @ohayo, but was found by the Discord user by the name of `sofurry.com`. Please note that this user **does not own this domain on the internet, just the discord handle**.

TShock overrides certain Terraria vanilla systems, including chat, and the connection handling, for its own purposes, like enforcing bans. When clients connect but do not complete the connection handshake (e.g., send message number 6), they can "exist" on the server, occupy a player slot, chat, and receive data from the server despite not being fully connected. Individuals who exploit this will be able to effectively harass the server, observe the server, and utilize server resources even if banned from the server.

For servers that operate with a proxy that strictly enforces the connection handshake/sequence, this is not an issue, but for smaller servers or servers running vanilla TShock this is an issue worth patching for.

PR body supplied by @ohayo (patch writer):

Terraria's standard server by default checks for bans upon the client sending the ConnectRequest packet, however, TShock instead chooses to check if the client connecting is banned upon the Request World Data packet.

A malicious client can easily just not send this packet, and still join the server even while being banned.
Also by not sending Request World Data, the malicious client is still able to receive all packets from the server & even chat. 

Other clients will not be notified of their join/leave but will be able to see them on the player list.
Leading to potential chat spam & "spying" on packets of players within the server.

## Which versions are affected by GHSA-f8mx-cwfh-7hr2?

2 open source packages ship an affected version, including TShock.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `TShock` | NuGet | All versions | 5.2.2 |
| `TShock` | NuGet | All versions | 5.2.2 |

## How do I fix GHSA-f8mx-cwfh-7hr2?

Upgrade TShock to 5.2.2 or later.

## Is GHSA-f8mx-cwfh-7hr2 being exploited?

There is no known exploitation of GHSA-f8mx-cwfh-7hr2 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-f8mx-cwfh-7hr2 and fix it if it is affected.

What it is: GHSA-f8mx-cwfh-7hr2 is an authentication bypass vulnerability in TShock, published on 3 Feb 2025. 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-f8mx-cwfh-7hr2 in the wild and no public exploit code.

Affected packages and fixed versions:
- TShock (NuGet): affected all versions; fixed in 5.2.2
- TShock (NuGet): affected all versions; fixed in 5.2.2

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-f8mx-cwfh-7hr2/ (Markdown: https://insights.sbomify.com/GHSA-f8mx-cwfh-7hr2/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-f8mx-cwfh-7hr2

---
From sbomify Insights: https://insights.sbomify.com/GHSA-f8mx-cwfh-7hr2/
Summaries are generated and may contain mistakes; the official description above is the record.
