The Accepted Bypass, Using STUN/TURN Patterns for C2

Senior Security Research Engineer (Elastic)

Real-time, low-latency connectivity is easily taken for granted. Significant engineering can be required to make services like Zoom work alongside network security systems. Whether we know it or not, Session Traversal Utilities for NAT (STUN) and Traversal Using Relay around NAT (TURN) network protocols are part of our everyday lives, facilitating peer-to-peer communication. This facilitation, while very useful, provides a unique behavior pattern for adversaries, an expected and accepted Network Address Translation (NAT) bypass. This talk will demonstrate how one can use these protocol patterns for command and control (C2) as well as demonstrate techniques for detection and prevention.

‍

We will start by walking through how this can be used in an attack and showcase its impact, prolonged and invisible C2. With this context, we will then explore how STUN/TURN protocol patterns work, and how to turn them into an effective C2 mechanism. Next, we will dissect these techniques through a series of demos highlighting how to use them for different evasion methods. Finally, we will conclude with some advanced techniques for applying a defense-in-depth based approach to further supplement the detections. As part of this, we will be looking at recent research into using various entropy calculations and where they can be utilized. Furthermore, we will explore their shortcomings and how attackers may adapt to these kinds of defenses. For tools, the demos will focus on Zeek, Wireshark, auditd, and Syslog data. All of the techniques discussed and the raw data are vendor-neutral. A repository with the tooling and environment deployment scripts will be available so you can try it out yourself.

‍