DEF CON 30 - Tomer Bar - OopsSec -The bad, the worst and the ugly of APT’s operations security
Description
A deep dive into the operational security (OPSEC) failures of various APT groups and cybercriminals. The presentation demonstrates how researchers exploit simple mistakes like open directories, leaked API tokens, and poor error handling to de-anonymize attackers and monitor their campaigns.
OopsSec: How Advanced Threat Actors Expose Themselves Through Poor OPSEC
Introduction
In the high-stakes world of cybersecurity, we often view Advanced Persistent Threats (APTs) as monolithic, infallible entities with unlimited resources and perfect execution. However, the reality is far more human. Tomer Bar’s DEF CON 30 presentation, "OopsSec," pulls back the curtain on the startlingly amateurish operational security (OPSEC) mistakes made by state-sponsored actors and sophisticated cybercriminals alike.
This blog post explores how security researchers turn the tables on attackers by exploiting their laziness, poor coding practices, and infrastructure leaks. Whether you are a threat hunter, a red teamer, or a curious developer, understanding these failures provides a unique perspective on the modern threat landscape and the "mind game" involved in high-level cyber defense.
Background & Context
Operation Security (OPSEC) is the process of identifying critical information to determine if friendly actions can be observed by adversary intelligence systems. For an APT, good OPSEC means keeping their Command and Control (C2) infrastructure hidden, their malware samples unattributable, and their communications encrypted.
In recent years, the barrier to entry for cybercrime has lowered with the rise of Malware-as-a-Service (MaaS). While the malware itself might be sophisticated, the individuals deploying it often lack the discipline to maintain a secure environment. This gap creates a massive opportunity for defenders. As Bar notes, the goal is to study attackers in their own "backyards"—their C2 servers, their internal chats, and their development environments.
Technical Deep Dive
The Anatomy of an OPSEC Failure
One of the most common mistakes identified was the use of Open Directories. Attackers often host their malware, exfiltrated data, and even their backend source code in directories that are not properly protected. In the case of a Gaza-based threat actor, researchers found a directory named CCC that contained nearly 3 terabytes of exfiltrated victim data, including voice recordings and SMS logs, all accessible via a browser.
Another critical failure point is Information Leakage via Error Messages. Many modern C2 backends are built on frameworks like Laravel. When these are left in "debug" mode or improperly configured, sending an unexpected request (like a GET instead of a POST) can trigger an error page that reveals database credentials, API keys, and internal file paths.
Exploiting the Telegram Bot API
Perhaps the most fascinating technique discussed is the exploitation of the Telegram Bot API. Many attackers use Telegram as a lightweight, reliable C2 channel. They hardcode a Bot Token and a Chat ID into their malware to send stolen data directly to a private Telegram group.
However, if a researcher extracts that token, they can use the official Telegram API to:
getUpdates: View all recent messages sent to the bot, including stolen credit cards and credentials.getChat: Retrieve information about the group, including invite links.- Join the Group: Researchers can use the invite link to join the group as a silent observer, monitoring the attackers' internal conversations and identifying their real-world identities.
The Infy Case: Advanced OPSEC
Not all actors are sloppy. The Iranian group 'Infy' (active since 2007) utilized advanced techniques to thwart researchers:
- Domain Generation Algorithms (DGA): The malware generates 100 new domains weekly, making it nearly impossible to sinkhole the entire operation.
- C2 Signature Verification: The malware only communicates with a server if it can provide a valid digital signature, preventing researchers from impersonating the C2 to capture victim data.
Even so, Bar's team identified a "weakest link" in the way files were synced from European frontend servers to the attackers' internal machines in Iran, proving that persistence and a deep understanding of infrastructure can eventually overcome even the best defenses.
Step-by-Step De-anonymization
If you find a malware sample using Telegram for exfiltration, the process typically looks like this:
- Extract the Token: Use a tool like
stringsor a decompiler likejadxto find the stringbotXXXXXXXXX:YYYYYYYYYYYYY. - Query the API: Use
curlto hithttps://api.telegram.org/bot<TOKEN>/getUpdates. - Identify the Chat: Look for the
chat_idin the JSON response. - Enumerate Admins: Use the
getChatAdministratorsmethod to find the usernames of the attackers. - Pivot to Social Media: Cross-reference these usernames with forums (like R10.net) or professional networks (LinkedIn) to find real names and locations.
Mitigation & Defense
For organizations, the lessons of "OopsSec" are clear:
- Egress Filtering: Block communication to known Telegram API endpoints if your environment doesn't require them. This breaks the exfiltration chain for many MaaS stealers.
- Monitor for DGAs: Implement DNS security solutions that can detect and block high-frequency, algorithmically generated domain requests.
- Credential Hygiene: Use unique, strong passwords for all infrastructure. The research found many C2 panels protected by
123456. - Threat Intelligence: Don't just block IPs; study the TTPs (Tactics, Techniques, and Procedures) to understand the motive and the target profile of the actor.
Conclusion & Key Takeaways
The most "advanced" threats are still operated by humans who make mistakes. By focusing on the infrastructure rather than just the malware, security researchers can gain a comprehensive view of an attack campaign. The key takeaways are:
- Advanced malware does not guarantee advanced OPSEC.
- Infrastructure leaks (open directories, .env files) are a goldmine for attribution.
- Telegram is currently a major blind spot and a primary exfiltration channel.
- Continuous monitoring of attacker 'backyards' allows for proactive defense and misinformation counterattacks.
Always remember to conduct research within legal and ethical boundaries, reporting findings to relevant authorities to help protect victims.
AI Summary
Tomer Bar, Director of Security Research at SafeBreach, presents a seven-year study into the operational security failures of Advanced Persistent Threat (APT) groups and large-scale cybercrime operations. The core thesis is that advanced technical capabilities in malware development do not always translate to strong OPSEC. Bar categorizes threat actors into several groups, starting with a Gaza-based actor active since 2012. This group suffered from basic web vulnerabilities, such as a 2FA bypass on their control panel where direct navigation to inner pages required no authentication. Furthermore, a simple GET request to their Laravel-based backend triggered an error that exposed MySQL database credentials, allowing researchers to map 8,000 victims and exfiltrate 2-3 terabytes of data. The research then pivots to Iranian cybercriminals targeting credit cards via the 'divar.ir' marketplace. These attackers utilized Telegram bots for exfiltration, but left their Telegram bot API tokens hardcoded in malware or accessible via open directories. By using the 'getUpdates' and 'getChat' Telegram APIs, Bar was able to join the attackers' private groups, monitor stolen credit card data in real-time, and identify the attackers. One attacker, Amir Ranjabar, was de-anonymized because he tested malware on his own device, leaking his home address, bank account, and car details. The talk also covers Russian-speaking actors using 'Mars Stealer' and Golang-based info stealers. These groups targeted cryptocurrency and NFTs, specifically using YouTube links for delivery. Despite using advanced packing and anti-emulation techniques (like checking for the computer name 'HAL9TH'), they too leaked Telegram bot tokens. Turkish actors, known as the 'Bread Boat' group, focused on phishing MetaMask passphrases. They promoted their sites using Google Ads but failed to secure their backends, leaving `.env` files and `test.txt` log files publicly accessible. Finally, Bar discusses 'Infy', an Iranian nation-state actor with significantly better OPSEC, utilizing Domain Generation Algorithms (DGA) and C2 signature verification. Despite these hurdles, researchers found a 'weakest link' in the transmission of files between European C2 servers and Iranian infrastructure, allowing them to monitor the group's activity for years. The presentation concludes that consistent monitoring of an attacker's 'backyard'—their infrastructure and communications—is essential for effective defense and attribution.
Related Videos

Smishmash - Text Based 2fa Spoofing Using OSINT, Phishing Techniques and a Burner Phone

DEF CON 33 Recon Village - Mapping the Shadow War From Estonia to Ukraine - Evgueni Erchov

DEF CON 33 Recon Village - How to Become One of Them: Deep Cover Ops - Sean Jones, Kaloyan Ivanov

