MTProxy icon indicating copy to clipboard operation
MTProxy copied to clipboard

MTProxy appears to be completely ineffective / blocked in real-world usage (2025)

Open GabrielKidd opened this issue 11 months ago • 10 comments

What I’ve tried

Fresh clone and rebuild of MTProxy from the official repository

Multiple secrets tested:

Classic secret

dd-prefixed secret

Fake-TLS style secret

Different listening ports:

443

8443

Random high ports

Verified the following:

MTProxy process is running normally

Listening ports are reachable from clients

TCP connections and initial handshakes complete successfully

Observed behavior

Telegram clients are able to reach the MTProxy server

However, the MTProxy server fails to complete a handshake with Telegram’s official servers

From logs and behavior, the failure occurs between the proxy and Telegram upstream, not between client and proxy

As a result:

Client connections stall indefinitely or time out

In some cases, a short-lived connection is established and then dropped

This behavior is consistent across:

Multiple VPS providers

Different geographic regions

Different ISPs and client networks

Conclusion

Although client → proxy connectivity works at the TCP level, proxy → Telegram server communication fails, making MTProxy unusable in practice.

This suggests that MTProxy traffic is either:

Blocked upstream,

Rejected by Telegram servers,

Or no longer compatible with the current Telegram backend infrastructure.

GabrielKidd avatar Dec 23 '25 09:12 GabrielKidd

i do agree. i tested too and its not working.

taheri79 avatar Jan 17 '26 18:01 taheri79

+1

interhin avatar Jan 18 '26 10:01 interhin

+1

chilango74 avatar Jan 20 '26 14:01 chilango74

Same issue. Spent two days, 3 linux VPS. And today ChatGPT sent me here. :-)

What is the actual solution?

Inhum avatar Mar 20 '26 19:03 Inhum

Compiled and setup proxy on vps in finland. Everything works and intended.

makerbeleg avatar Mar 21 '26 10:03 makerbeleg

Compiled and setup proxy on vps in finland. Everything works and intended.

Where are you connecting from and via what network (home ISP/mobile network)?

Inhum avatar Mar 21 '26 17:03 Inhum

Compiled and setup proxy on vps in finland. Everything works and intended.

Where are you connecting from and via what network (home ISP/mobile network)?

From Russia. Works on both desktop and mobile.

makerbeleg avatar Mar 21 '26 17:03 makerbeleg

Compiled and setup proxy on vps in finland. Everything works and intended.

Where are you connecting from and via what network (home ISP/mobile network)?

From Russia. Works on both desktop and mobile.

I tried AWS in Oregon. Maybe depends on certain mobile operator. Switched to Tailscale.

Inhum avatar Mar 21 '26 17:03 Inhum

This is almost certainly DPI-based blocking. The original MTProxy only supports obfuscated2 (dd prefix), which sends raw MTProto framing over TCP — DPI systems have had reliable signatures for this since at least 2019. The byte stream has no higher-level protocol framing, so it stands out as "not any known protocol" even without deep inspection.

I maintain teleproxy, a fork that adds fake-TLS transport (ee prefix secrets). The connection looks like a TLS 1.3 handshake to a real domain — DPI sees what appears to be ordinary HTTPS. On top of that, Dynamic Record Sizing graduates TLS record lengths the way a real web server would (small during TCP slow-start, ramping up), so statistical analysis of packet sizes doesn't flag it either.

If the server IP itself gets flagged, teleproxy also supports SOCKS5 upstream to chain through a separate exit point.

rkline0x avatar Apr 04 '26 16:04 rkline0x

Yo, doodes. Root cause for at least some of these reports: missing --nat-info when the proxy egresses through NAT — worth checking before assuming Telegram is blocking datacenter IPs.

My proxy (upstream HEAD f36d8af, March-2026 build, and a Nov-2025 build) had exactly the symptom described: client→proxy TCP works, but the proxy↔DC handshake dies. Packet captures on the backend connections show a deterministic pattern:

proxy → DC: 44 B  (plaintext)
DC → proxy: 44 B (plaintext)
proxy → DC: 48 B (first encrypted frame)
DC → proxy: FIN

Why: the middle-protocol AES keys are derived from both endpoint IPs — aes_create_keys() in net/net-crypto-aes.c mixes server_ip and client_ip (plus ports, nonces, timestamp, secret) into the key material. For outbound DC connections the proxy feeds nat_translate_ip(c->our_ip) into it (net/net-tcp-rpc-client.c:677). Without a --nat-info rule, nat_translate_ip is the identity function — so if the proxy sits behind NAT/MASQ (docker bridge + host NAT, WireGuard exit with MASQ, port-forwarded home server...), the proxy derives keys with its private source IP while the DC derives keys with your public egress IP. The DC can't decrypt the second frame and resets the connection.

This also explains the provider/region variance reported here: setups where the proxy binds the public IP directly work; NAT'd setups (dockerized proxy, NAT'd cloud VM) fail. We reproduced the failure 100% of the time through two different MASQ egresses and got success immediately once the correct global address was announced — same binary, same secret, same config.

Fix:

mtproto-proxy ... --nat-info <local-addr>:<global-addr>

e.g. for a dockerized proxy: --nat-info 172.17.0.2:123.4.567.89 (container IP : host public IP).

Verified on my side: with the correct mapping, the handshakes complete on every DC (capture: the DC now answers 48 B-for-48 B past the point where it used to FIN), backend connections stay ESTABLISHED, and clients (Telethon MTProxy transports and official apps) pass traffic end-to-end.

Two practical notes:

  1. Detect it: if ip addr on the proxy box shows a private source IP that differs from what an external "what's my IP" endpoint reports through the same egress path, you're NAT'd and need --nat-info.
  2. Automate it: container IPs are ephemeral and egress IPs change, so we derive the mapping at container start (read local IP from the interface, query the public IP through the same egress) and inject --nat-info local:global into the proxy args.

Speculation on timing (unverified): the IP mixing has been in this codebase for years, so the server side apparently tolerated the mismatch until sometime around Dec 2025 — matching this issue's onset — and now enforces it. That would simultaneously explain the sudden breakage of long-working NAT'd proxies.

If you're hitting this: check whether your proxy's egress is NAT'd before concluding the IP range is blocked.

VGoshev avatar Oct 15 '26 00:10 VGoshev