mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6045] [Bug] Telegram proxy sponsor does not generate valid 32-character hash in v3.5.0 #4186
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#4186
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @MR-SHARIFI-Dev on GitHub (Jul 19, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6045
Describe the bug
When I try to create a Telegram proxy sponsor link in the panel (v3.5.0), the generated secret parameter in the proxy link is invalid. Instead of a pure 32-character hexadecimal hash, the panel generates a concatenated string that includes both a hash and the hex-encoded domain name (e.g., cloudflare.com → 7777772e636c6f7564666c6172652e636f6d). This results in a secret longer than 32 characters, which Telegram rejects with the error: "Incorrect secret value. It must contain 32 hex characters like 00112233445566778899aabbccddeeff."
For example, the panel generates:
text
tg://proxy?port=9990&secret=eee872b9632bf4778722a6137edbe2debf77234562e636c6f7564666c6172652e636f6d&server=domin.com
But Telegram expects:
text
tg://proxy?port=8880&secret=00112233445566778899aabbccddeeff&server=panel.ivaworks.site
As a result, the proxy does not work in Telegram and clients cannot connect via the sponsor feature.
How to reproduce the problem
Open the panel dashboard (v3.5.0).
Go to Inbounds and create a new inbound with proxy settings (e.g., VMESS or VLESS).
Navigate to the Telegram or Proxy Sponsor section.
Click on Generate Sponsor Link or Create Proxy Sponsor.
Observe the generated secret value — it is longer than 32 characters and contains the domain name encoded in hex.
Copy the sponsor link and try to add it using the MTProxy Admin Bot in Telegram.
The bot responds with: "Incorrect secret value. It must contain 32 hex characters like 00112233445566778899aabbccddeeff."
Expected behavior
I expected the panel to generate a valid 32-character hexadecimal secret (e.g., a1b2c3d4e5f67890123456789abcdef0) that matches Telegram's MTProxy protocol requirements. The domain should only appear in the server parameter, NOT inside the secret. The sponsor link should work immediately in Telegram without additional manual modifications.
Actual behavior
Instead, the panel:
Generates a secret that includes both a random hash AND the hex-encoded domain name (e.g., eee872b...bf7777772e636c6f7564666c6172652e636f6d)
Produces a secret with 64+ characters instead of the required 32 characters
Causes Telegram to reject the proxy with the error: "Incorrect secret value. It must contain 32 hex characters"
When testing the generated link in Telegram, it shows "Invalid proxy" or "Failed to connect".
Relevant logs
bash
Panel logs (journalctl -u x-ui -n 50)
Jan 15 14:30:22 x-ui[12345]: [INFO] Generating Telegram sponsor for inbound ID 5
Jan 15 14:30:22 x-ui[12345]: [ERROR] Secret validation failed: invalid length (expected 32, got 64)
Browser DevTools Console:
js
POST /api/telegram/create-sponsor 500 (Internal Server Error)
{error: "Secret must be 32 hex characters"}
Screenshots
MTProxy Admin Bot error:
text
MTProxy Admin Bot: Now please specify its secret in hex format.
[User]: eee872b9632bf4778722a6137edbe2debf7777772e636c6f7564666c6172652e636f6d
MTProxy Admin Bot: ❌ Incorrect secret value. It must contain 32 hex characters like
00112233445566778899aabbccddeeff.
3x-ui version
3.5.0
Xray-core version
26.6.27
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 24.04 LTS
Which parts of the panel are affected?
Other (Telegram Proxy Sponsor - Backend secret generation logic)
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
None
Before submitting
I searched existing issues and this bug has not been reported.
I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
This bug report is written in English.
I have redacted any sensitive data (tokens, real domains, client UUIDs).
@github-actions[bot] commented on GitHub (Jul 19, 2026):
I checked the current source (v3.5.0 is the latest release) and could not find a 'Telegram Proxy Sponsor' section, a 'Generate Sponsor Link' button, or a 'Create Proxy Sponsor' button anywhere in the panel, for any protocol. Searching both the Go backend and the React frontend for 'sponsor' turns up one related feature, and it does not behave the way this report describes.
What actually exists
The only sponsor-related field is the per-client Ad-tag (sponsored channel) on MTProto clients (
frontend/src/pages/clients/ClientFormModal.tsx:881-890). It is rendered only when the client is attached to an MTProto inbound (showMtproto,ClientFormModal.tsx:358-361) - it does not exist for VMESS or VLESS clients, so the reproduction steps ('create a VMESS/VLESS inbound ... navigate to the Telegram or Proxy Sponsor section') don't correspond to any code path here.That field is a plain text input, not a generator. Its hint text reads: 'Optional 32-character hex tag from Telegram's proxy registration' (
internal/web/translation/en-US.json:921). The panel never derives this value with SHA-256/MD5 or anything else - it is a 32-hex-character tag you obtain from Telegram's@MTProxybotafter registering your proxy as sponsored, then paste in yourself. On save it is validated as exactly 32 hex characters both client-side (ClientFormModal.tsx:541) and server-side (model.ValidMtprotoAdTag,internal/database/model/model.go:569-575, enforced ininternal/web/service/inbound.go:815-816with the errormtproto client ad tag must be 32 hex characters). The field is optional - leaving it blank is valid and simply means that client is not routed through a sponsored channel.The neighboring field, MTProto secret, is the one value the panel does auto-generate (
GenerateFakeTLSSecret,internal/database/model/model.go:536-538):ee + 16 random bytes (32 hex chars) + hex-encoded FakeTLS domain. That is intentionally longer than 32 hex characters once the domain is appended - see #6036 (triaged yesterday) for the same 'why isn't this 32 characters' question about that field specifically.What's needed to continue
Since no control matching 'Generate Sponsor Link' / 'Create Proxy Sponsor' exists in the current source, this can't be reproduced against the code as it stands. To investigate further:
This is marked for clarification rather than a confirmed defect, since the reproduction steps do not align with any feature found in the source.
This reply was generated automatically and a maintainer may follow up.
@MHSanaei commented on GitHub (Jul 23, 2026):
I searched the whole panel (Go backend and React frontend) and there is no "Telegram Proxy Sponsor" section, "Generate Sponsor Link", or "Create Proxy Sponsor" control for any protocol — so the reproduction steps (create a VMESS/VLESS inbound → Proxy Sponsor → Generate) don't map to any code path here.
The value you're describing is the MTProto secret, which the panel does auto-generate:
ee+ 16 random bytes + the hex-encoded FakeTLS domain. It is longer than 32 hex characters by design — that's the FakeTLS secret format (ee...), which@MTProxybotaccepts. The "must be 32 hex characters" rule is the legacy non-FakeTLS format and doesn't apply here (same point as #6036). Use the generatedee...secret as-is for thetg://link.The only sponsor-related field is the per-client Ad-tag (sponsored channel), shown only for MTProto clients — a plain text input (not a generator) for the optional 32-hex tag you get from
@MTProxybotwhen you register a sponsored channel. Leaving it blank is valid. So there's no bug here; closing as a misunderstanding, happy to clarify further.