This document is a technical analysis of the Tribe Flood Network 2000 (TFN2K) distributed denial-of-service (DDoS) attack tool, the successor to the original TFN Trojan by Mixter. Additionally, countermeasures for this attack are also covered. This document assumes a basic understanding of DDoS attacks. Analyses of related DDoS attack tools such as Stacheldraht and Trinoo are not presented here. For information about DDoS attacks and TFN2K's cousins, please refer to the following documents:
The terminology used in DDoS analyses is often confusing. For clarity, we use the following:
Client - an application that can be used to initiate attacks by sending commands to other components (see below).
Daemon - a process running on an agent (see below), responsible for receiving and carrying out commands issued by a client.
Master - a host running a client
Agent - a host running a daemon
Target - the victim (a host or network) of a distributed attack
Overview - What is TFN2K?
TFN2K allows masters to exploit the resources of a number of agents in order to coordinate an attack against one or more designated targets. Currently, UNIX, Solaris, and Windows NT platforms that are connected to the Internet, directly or indirectly, are susceptible to this attack. However, the tool could easily be ported to additional platforms.
TFN2K is a two-component system: a command driven client on the master and a daemon process operating on an agent. The master instructs its agents to attack a list of designated targets. The agents respond by flooding the targets with a barrage of packets. Multiple agents, coordinated by the master, can work in tandem during this attack to disrupt access to the target. Master-to-agent communications are encrypted, and may be intermixed with any number of decoy packets. Both master-to-agent communications and the attacks themselves can be sent via randomized TCP, UDP, and ICMP packets. Additionally, the master can falsify its IP address (spoof). These facts significantly complicate development of effective and efficient countermeasures for TFN2K.
TFN2K - The Facts:
* Commands are sent from the master to the agent via TCP, UDP, ICMP, or all three at random.
Targets may be attacked with a TCP/SYN, UDP, ICMP/PING, or BROADCAST PING (SMURF) packet flood. The daemon may also be instructed to randomly alternate between all four styles of attack.
* Packet headers between master and agent are randomized, with the exception of ICMP, which always uses a type code of ICMP_ECHOREPLY (ping response). Unlike its predecessors, the TFN2K daemon is completely silent; it does not acknowledge the commands it receives. Instead, the client issues each command 20 times, relying on probability that the daemon will receive at least one. The command packets may be interspersed with any number of decoy packets sent to random IP addresses.
* TFN2K commands are not string-based (as they are in TFN and Stacheldraht). Instead, commands are of the form "+<id>+<data>" where <id> is a single byte denoting a particular command and <data> represents the command's parameters. All commands are encrypted using a key-based CAST-256 algorithm (RFC 2612). The key is defined at compile time and is used as a password when running the TFN2K client.
* All encrypted data is Base 64 encoded before it is sent. This holds some significance, as the payload should be comprised entirely of ASCII printable characters. The TFN2K daemon uses this fact as a sanity-test when decrypting incoming packets.
* The daemon spawns a child for each attack against a target. The TFN2K daemon attempts to disguise itself by altering the contents of argv, thereby changing the process name on some platforms. The falsified process names are defined at compile time and may vary from one installation to the next. This allows TFN2K to masquerade as a normal process on the agent. Consequently, the daemon (and its children) may not be readily visible by simple inspection of the process list. All packets originating from either client or daemon can be (and are, by default) spoofed.
* The UDP packet length (as it appears in the UDP header) is three bytes longer than the actual length of the packet.
* The TCP header length (as it appears in the TCP header) is always zero. In legitimate TCP packets, this value should never be zero.
* The UDP and TCP checksums do not include the 12-byte pseudo-header, and are consequently incorrect in all TFN2K UDP and TCP packets.
Detecting TFN2K - The Signature:
All control communications are unidirectional, making TFN2K extremely problematic to detect by active means. Because it uses TCP, UDP, and ICMP packets that are randomized and encrypted, packet filtering and other passive countermeasures become impractical and inefficient. Decoy packets also complicate attempts to track down other agents participating in the denial-of-service network.
Fortunately, there are weaknesses. In what appears to be an oversight (or a bug), the Base 64 encoding (which occurs after encryption) leaves a telltale fingerprint at the end of every TFN2K packet (independent of protocol and encryption algorithm). We suspect it was the intent of the author to create variability in the length of each packet by padding with one to sixteen zeroes. Base 64 encoding of the data translates this sequence of trailing zeros into a sequence of 0x41's ('A'). The actual count of 0x41's appearing at the end of the packet will vary, but there will always be at least one. The padding algorithm is somewhat obscure (but predictable) and beyond the scope of this document. However, the presence of this fingerprint has been validated both in theory and through empirical data gathered by dumping an assortment of command packets.
A simple scan for the files tfn (the client) and td (the daemon) may also reveal the presence of TFN2K. However, these files are likely to be renamed when appearing in the wild. In addition to this, both client and daemon contain a number of strings that can be found using virus scanning methods.
Below is a partial list of some of the strings (or sub-strings) appearing in TFN2K:
NOTE: Scanners should look for pattern combinations unlikely to appear in legitimate software.
* Mixter wisely avoids embedding clear-text strings in the TFN2K daemon. However, tribe_cmd, the one function unique to the daemon, is clearly visible and can be detected with any standard grep utility.
** Because, this text is likely to be modified in many TFN2K installations, it may be problematic to definitively identify a TFN2K daemon by traditional virus-scanning means.
* Ask your ISP to configure their router to do ingress filtering on your network, preventing spoofed traffic reaching the Internet from your network. Refer them to RFC 2267.
* Use a firewall that exclusively employs application proxies. This should effectively block all TFN2K traffic. Exclusive use of application proxies is often impractical, in which case the allowed non-proxy services should be kept to a minimum.
* Disallow unnecessary ICMP, TCP, and UDP traffic. Typically only ICMP type 3 (destination unreachable) packets should be allowed.
* If ICMP cannot be blocked, disallow unsolicited (or all) ICMP_ECHOREPLY packets.
* Disallow UDP and TCP, except on a specific list of ports.
* Spoofing can be limited by configuring the firewall to disallow any outgoing packet whose source address does not reside on the protected network.
* Take measures to ensure that your systems are not vulnerable to attacks that would allow intruders to install TFN2K.
* Scan for the client/daemon files by name.
* Scan all executable files on a host system for patterns described in the previous section.
* Scan the process list for the presence of daemon processes.
* Examine incoming traffic for unsolicited ICMP_ECHOREPLY packets containing sequences of 0x41 in their trailing bytes. Additionally, verify that all other payload bytes are ASCII printable characters in the range of (2B, 2F-39, 0x41-0x5A, or 0x61-0x7A).
* Watch for a series of packets (possibly a mix of TCP, UDP, and ICMP) with identical payloads.
Once TFN2K has been identified on a host system, it is imperative that the authorities be notified immediately so that the perpetrators can be traced. Because a TFN2K daemon does not acknowledge the commands it receives, it is likely the client will continue to transmit packets to the agent system.
Additionally, a hacker observing the absence of flood activity, may attempt to reestablish direct contact with the agent system to determine the nature of the problem. In either case, the communication can be traced.
TFN2K is traceable but requires a timely response on the part of the victim. If you believe you have been the victim of TFN2K or any other DDoS attack, please contact your local authorities. In the United States, contact your local FBI office. FBI contact information can be obtained from: