All research
Threat IntelDetectionStealers

When Chat Becomes C2: Telegram, Discord, and the Limits of Webhook Hunting

A Telegram bot or Discord webhook in malware is not always the same job. Stealers drop files; designs like Telecord keep a live session. Webhook-only hunts miss that second pattern.

When Chat Becomes C2: Telegram, Discord, and the Limits of Webhook Hunting

A malware sample can disclose more about its operator's communication choices than its embedded IP addresses. Instead of pointing to an unfamiliar server, its configuration may contain an endpoint on a service used by millions of legitimate people: Telegram's Bot API or a Discord webhook. The HTTPS destination looks familiar. The process making the request often does not.

The instinct is to classify both as “messaging C2.” But the same services can fulfill fundamentally different roles. A stealer might upload a single archive and never expect a command. A remote-access implant may need to receive tasking, preserve a session, and return output. The distinction changes what defenders should measure, which network paths matter, and how confidently an extracted token can be interpreted.

To examine that gap, OffPerimeter reviewed messaging endpoints recovered from malware configurations in our climate, then examined the public Go implementation of TelecordC2 as a separate code-level reference for a dual-platform interactive design. The two sets answer different questions: climate measures how many pipes show up and how long they last; Telecord shows one concrete interactive design.

For detection, a Discord-webhook-only hunt covers one abuse pattern, not every interaction that appears when Discord bot/Gateway features and Telegram's Bot API are combined.

01 · Climate: identifiers are not operators

As of mid-November 2026, OffPerimeter's climate on messaging endpoints recovered from malware configurations looked like this:

Measurement Value Reading
Distinct Telegram bot IDs 587 Bot identities, not operators
Distinct Discord webhook IDs 628 Webhook identities, not URLs
Families represented in that climate ~200 Family labels in the corpus
Telegram bots reviewed in one status pass 413 Subset of the climate; not all 587
Still responding in that pass 68 ~16.5% of the 413, not of 587
No longer responding 345 Point-in-time status
Chart of the OffPerimeter messaging-endpoint dataset and bounded Telegram status checks

The 68 responders are about one in six of the reviewed subset, not one in six of every Telegram id in the climate. One operator can rotate secrets or run many bots, and a webhook ID is not a Gateway session or an actor.

02 · Two jobs that look alike at the perimeter

At the network edge, a stealer posting to Telegram and an implant receiving commands through Telegram may both open TLS to api.telegram.org. Separation needs direction, API method, and process context.

Exfiltration / notification. Telegram sendMessage and sendDocument can push text and files to a bot-associated destination. A Discord incoming webhook accepts a POST to a webhook URL. The platform delivers the payload; the malware author does not need a custom receive server. A webhook POST is mainly a submission path, not the real-time event interface a Discord bot uses on the Gateway.

Interactive command and control. Telegram getUpdates can poll for pending updates. Discord applications can keep a Gateway WebSocket and receive events in real time. That is a different operating model from a one-shot webhook upload. An agent can keep an identity, accept tasking, and return output on the same channel or another.

Comparison of exfiltration channels and dual-platform interactive command and control

That is why an HTTP request containing /api/webhooks/ does not cover all Discord-based C2. A Discord bot session may use the Gateway without looking like a webhook POST, and webhook traffic can also be legitimate. Originating process, timing, and surrounding host activity decide the triage.

03 · TelecordC2 as a public dual-channel reference

We reviewed the public repository ELMERIKH/TelecordC2, pinned to commit 462b38e (branch activity through 22 February 2025). It is framed as a cross-platform red-team C2 with Go agents for Windows, Linux, and macOS. The reading here is static: the design in source, not a runtime on a victim host.

Discord selects; Telegram runs the session

In the agent source, a Discord message handler watches a configured channel. For a targeted interaction, it compares the requested agent id with a local temporary .id.txt. Only a matching agent starts its Telegram-side session. Discord becomes the multi-agent switchboard; Telegram does not need every agent awake at once.

The Telegram side uses go-telegram-bot-api, initializes the bot, and consumes updates via GetUpdatesChan. Source capabilities include shell execution, directory change, screenshot / screen share, and file transfer. Windows uses a command shell; Linux uses sh; macOS includes an AppleScript-oriented path.

Controller code also references a Discord webhook for notifications. That does not make the agent's Discord control path a webhook. Three roles stay separate: Discord bot/Gateway session, Telegram Bot API session, and webhook as a notification channel.

Code-informed high-level state transition for Telecord's Discord and Telegram control surfaces

The state change that matters for hunting

Component Evidence in reviewed source Defensive implication
Discord handler messageCreate in platform agents Possible long-lived Discord API/Gateway relationship
Agent selection Match against local .id.txt Ties an operator request to a local identity
Telegram activation startTelegramBot() after selection Telegram command traffic may follow a Discord event
Update intake GetUpdatesChan Polling is relevant to control-plane hunts
Remote actions Shell, file, screenshot branches Local process/file evidence can corroborate egress
Controller notify Webhook use in Telecord.go A webhook can exist without being primary agent control

An unusual process that talks to Discord and later to Telegram deserves more attention than either link alone. Temporal proximity alone is not enough: legitimate automation can use both platforms.

04 · Liveness is a separate question

Of 413 Telegram bots reviewed in that pass, 68 still responded (~16.5%). The rest did not. A fraction of the climate was still live at that moment, but liveness ages fast: secrets rotate, bots die, and platforms revoke access. The snapshot is climate, not a permanent alert list.

05 · Hunt behavior, not brand

What matters is the relationship between process and network, not a list of popular domains. Four progressive checks in authorized telemetry:

  1. An uncommon non-browser, non-official-client process reaches Telegram Bot API or Discord API/Gateway.
  2. The same process (or a justified parent/child tree) hits both services in a bounded window.
  3. Supporting host behavior appears nearby: unexpected child shell, staged archives, screenshot access, or new persistence.
  4. Where lawful HTTPS inspection exists, API methods can separate upload from polling; redact tokens before sharing.
Defensive hunting correlation linking endpoint processes, service role and supporting telemetry

Defender XDR: unusual messaging-API callers

Start from DeviceNetworkEvents. Depending on the source, RemoteUrl may be a hostname or a full URL.

let Services = dynamic(["api.telegram.org", "discord.com", "discordapp.com", "gateway.discord.gg"]);
DeviceNetworkEvents
| where Timestamp > ago(14d)
| extend Domain = tolower(extract(@"^(?:https?://)?([^/:?]+)", 1, tostring(RemoteUrl)))
| where Domain in (Services)
| summarize Connections=count(), FirstSeen=min(Timestamp), LastSeen=max(Timestamp),
            ServiceDomains=make_set(Domain, 10)
  by DeviceId, DeviceName, InitiatingProcessFileName, InitiatingProcessId,
     InitiatingProcessCreationTime
| order by Connections desc

Leave raw URLs and command lines out of the export, because Telegram Bot API paths and Discord webhook URLs can embed live secrets.

Defender XDR: same process, both services

DeviceNetworkEvents
| where Timestamp > ago(14d)
| extend Domain = tolower(extract(@"^(?:https?://)?([^/:?]+)", 1, tostring(RemoteUrl)))
| extend Service = case(Domain == "api.telegram.org", "Telegram",
                        Domain in ("discord.com", "discordapp.com", "gateway.discord.gg"), "Discord", "Other")
| where Service != "Other"
| summarize FirstSeen=min(Timestamp), LastSeen=max(Timestamp),
            Services=make_set(Service, 2), Connections=count()
  by DeviceId, DeviceName, InitiatingProcessFileName,
     InitiatingProcessId, InitiatingProcessCreationTime
| where set_has_element(Services, "Telegram") and set_has_element(Services, "Discord")
| order by LastSeen desc

Grouping by the same originating process sharpens the leads, though it misses designs that split Telegram and Discord across two processes. Those need ancestry, services or tasks, and a per-device timeline.

With proxy visibility, Telegram sendDocument versus getUpdates, or a Discord webhook POST versus a persistent Gateway session, can be told apart. DNS/TLS hostnames alone do not prove the method. In ATT&CK, T1567.004 fits webhook exfil and T1102.002 fits bidirectional C2 through web services.

Separate detection lanes for webhook exfil, Telegram upload/polling, and Discord bot/Gateway activity, then correlate with process identity, parent-child, persistence, file access, and approved business automation. If the business does not need these APIs, prefer egress deny-by-default; if it does, scope by application.

06 · Closing read

Finding Basis
Hundreds of distinct Telegram bot IDs and Discord webhook IDs in climate OP aggregates
~16.5% of the reviewed Telegram subset still answered at snapshot Point-in-time pass
TelecordC2 implements Discord-addressed wake of a Telegram session Pinned source

Same trusted messaging APIs, different jobs. Stealers often use them as dropboxes. Dual-channel designs like Telecord show why webhook-only Discord hunts under-count interactive control. Climate tells you the pipes keep showing up; public source shows how a second job can ride the same pipes.

Sources

  1. ELMERIKH: TelecordC2 @ 462b38e
  2. TelecordC2: Agent.go
  3. TelecordC2: USECASE
  4. Telegram: Bot API
  5. Discord: Gateway
  6. NVISO: Exploring Telegram Abuse
  7. Dragos: Instant Messaging C2 Techniques
  8. Ransom-ISAC: The Telegram Malware Ecosystem
  9. Socket: Weaponizing Discord for C2
  10. MITRE ATT&CK: T1102.002 Bidirectional Communication
  11. MITRE ATT&CK: T1567.004 Exfiltration Over Webhook
  12. MITRE: DET0035 · DET0153

OffPerimeter

When the threat surface moves onto trusted messaging APIs, the work shifts from listing domains to reading climate and behavior together. That is the lens OffPerimeter brings to this class of abuse: offperimeter.com.

OffPerimeterResearch by OffPerimeter
PRIVATE BETABeta access for a limited time

From research to your own exposure.

Explore your attack surface, credential exposure and threat intelligence with OffPerimeter.

Request Beta
OffPerimeterOFFPERIMETER BRIEF

Stay one signal ahead.

New research on exposure, credentials and emerging threats.

New researchUnsubscribe anytime