CND (312-38) Network Defense Simulation

This simulation tests your ability to identify fundamental application vulnerabilities that introduce network risks. You will learn to recognize the underlying cause of memory corruption attacks and how they manifest in a networked environment.

Network Scenario

The organization runs a custom legacy service in the DMZ. This service was written in C by a former employee named John. Recently, the Security Operations Center (SOC) noticed anomalous crashes of this service. Threat actors appear to be establishing remote interactive sessions shortly after the service crashes, indicating successful exploitation over TCP port 9000.

Traffic & Logs

[+] Suricata IDS Alert [Priority 1]
11/14/2023 14:22:01 [**] [1:2006453:2] EXPLOIT Possible NOP Sled [**]
{TCP} 198.51.100.45:49211 -> 10.0.1.55:9000

[+] Packet Payload Snippet (Hex):
0x0000: 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
0x0010: 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
0x0020: 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 ................
0x0030: 31 c0 50 68 2f 2f 73 68 68 2f 62 69 6e 89 e3 50 1.Ph//shh/bin..P

Question

John works as a C programmer. He develops the following C program:

#include <stdio.h>
#include <string.h>

int main() {
    char buffer[50];
    printf("Enter input: ");
    gets(buffer); /* Receives data from network socket */
    printf("Received: %s\n", buffer);
    return 0;
}
His program is vulnerable to a __________ attack.

Expert Analysis

1. What is happening in the network

The network capture shows an inbound TCP connection sending a highly suspicious payload. The payload consists of repeating 'A's (0x41), followed by a NOP sled (`\x90`), and finally hex instructions indicative of shellcode (`/bin/sh`). This traffic is hitting a service executing poorly written C code.

2. Identify attack or behavior

This is a classic Buffer Overflow exploitation attempt over the network. The attacker is sending more data than the `buffer[50]` can handle, attempting to overwrite the instruction pointer (EIP/RIP) to execute the malicious shellcode embedded in the packet payload.

3. Why correct answer is correct

C. Buffer overflow: The C program uses the `gets()` function. In C, `gets()` does not perform bounds checking; it reads characters from standard input (or a socket, in a network context) until a newline character is encountered. If the input exceeds the 50-byte allocation of `buffer`, it overflows into adjacent memory. Network defenders must rely on IDS signatures to catch the resulting payload traversing the wire.

4. Why others are wrong

5. Defensive action

At the network layer, ensure IPS (Intrusion Prevention System) signatures for "NOP sleds" and known shellcode patterns are set to drop traffic. At the host layer, enable ASLR (Address Space Layout Randomization) and DEP (Data Execution Prevention). Ultimately, the application must be patched to replace `gets()` with a bounds-checking function like `fgets()`.

6. MINI LESSON: Detecting Memory Corruption on the Wire

Ready to enhance your CND skills?

Explore more CND simulations