LLM Security: DDoS Attacks
LLM Security: DDoS Attacks
Section titled “LLM Security: DDoS Attacks”Introduction
Section titled “Introduction”DDoS attacks were once on the LLM Top 10, but a later revision dropped the entry. They remain a common technique, so this post covers them across three layers: network, application, and model.
The network and application layers are basically classic DDoS knowledge, since model services and APIs are ordinary internet-facing assets. First, let’s get the intuition for how each layer is attacked.
Say we want to eat at a restaurant. A network-layer DDoS is traffic jams on the road; an application-layer DDoS is a packed restaurant; a model-layer DDoS is keeping the chef from cooking. In real terms, the network layer targets the traffic reaching the target server — bandwidth. The application layer targets the application service and middleware on that server — connection counts, CPU, memory, business processing capacity. The model layer targets the model itself — the GPU — burning compute and tokens.
Reflection and Amplification
Section titled “Reflection and Amplification”Start with the network layer, which mostly rides on network protocols. Two concepts first: reflection and amplification. Suppose there’s a target machine, a DNS server, and an attacker. The attacker forges a request to resolve a domain name, and sets the source IP in that packet to the target’s IP. When the DNS server answers, it sends the result to the packet’s source IP — so the response meant for the attacker lands on the target instead. This mirror-like mechanism is a reflection attack.
Reflection attacks have a few properties. First, they’re UDP-based, with no source verification, so the attacker can spoof the source IP and stay hidden — hard to trace. Second, if the attacker uses many DNS servers across the internet, the target receives responses from all over the world, flooding its bandwidth.
Amplification builds on reflection. Still using DNS: when we query DNS we can send an ANY request — asking for every record type for the domain, which returns a lot of data, usually tens of times the request size. The request packet is tiny; the ANY response is large. So what reaches the target is bigger than what was sent — the packet has been amplified. That’s an amplification attack.
Amplification attacks also have a few properties. First, UDP again, no source verification, so the attacker hides easily and spoofs source IPs. Second, the response is markedly larger than the query.
Together this is a reflection-amplification attack, and the network-layer DDoS techniques below all exploit reflection and amplification over specific protocols.
NTP Reflection and Amplification
Section titled “NTP Reflection and Amplification”NTP (Network Time Protocol) synchronizes clocks across a network. Its default port is 123; devices query NTP servers to keep accurate time.
NTP has a monlist command. When a client request includes it, the NTP server returns the last 600 IPs that queried it, six per packet — so 100 response packets. One packet in, 100 packets out.
NTP runs over UDP with no client verification, so a client can spoof the source address (the victim’s address), and the NTP server sends all 100 packets there. That’s exactly the reflection-amplification pattern.
monlist is disabled by default in NTP 4.2.7p26 and later; earlier versions have it on. The play is to find NTP servers that still support it and use them.
You can search a cyberspace search engine for services with port 123 open, then batch-check for monlist with Nmap’s script or the Metasploit module. Examples:
Nmap:
nmap -sU -p 123 --script ntp-monlist -iL ip.txt -oN monlist_results.txtMetasploit:
auxiliary/scanner/ntp/ntp_monlistFilter the results and verify by hand:
ntpdc -n -c monlist <IP>Or just search Shodan for the ntpd version banner. Once you have the list and the target, craft request packets with a script and iterate over the NTP servers to attack the target — for instance with Python’s scapy. Have an AI write the script for you.
One important caveat: run the script from a server that has a public IP and whose provider doesn’t do ISP-level verification — one that permits IP spoofing. Such providers are rare, because current rules only allow packets with your real source IP. On a local network or a mainstream cloud, a spoofed source IP gets dropped at the gateway or rewritten to the real one.
DNS Reflection and Amplification
Section titled “DNS Reflection and Amplification”DNS resolves domain names to IPs and listens on port 53 by default. Here’s a quick recap of the flow. You visit a URL; the browser checks its own cache, then the OS DNS cache, then the hosts file, then the local DNS server (the resolver configured on the machine). If nothing has the record, the local resolver queries a root server. Root servers don’t store domain IPs — they store the addresses of top-level domain servers: one for .com, one for .cn, and so on. Looking up example.com, the root returns the address of the .com server, like a lookup table. The local resolver then queries that address. That server is a TLD server; it also doesn’t hold the IP, but it maps to the authoritative server’s address, which it returns. Authoritative servers are run by the domain owner — enterprises often host their own; individuals usually use a DNS cloud provider. The local resolver queries the authoritative server, which returns the IP for the domain.
The diagram below illustrates the flow:

DNS queries come in two flavors: recursive and iterative. Recursive means you ask one server for a domain’s IP; if it doesn’t have the record, it keeps querying other servers and hands you the final answer — you only make the first query and don’t care about the rest. Iterative means you ask a server, it doesn’t have the record, and it tells you where to ask next; you then go ask that server yourself, every step of the way.
In the flow above, the query you send the local resolver is recursive — the local resolver handles the root, TLD, and authoritative servers. From the local resolver’s perspective, its own queries are iterative, because the root server doesn’t return the domain IP, just a pointer to the TLD; the TLD does the same, pointing at the authoritative server.
So the local resolver is the recursive-capable server, typically run by an ISP, a cloud DNS provider, or self-hosted. DNS reflection attacks target these recursive resolvers.
The workflow mirrors NTP. Search for servers with port 53 open, then filter for recursion support. Nmap:
nmap -sU -p53 --script=dns-recursion -iL dns_ips.txt -oN recursive_results.txtYou can also use tools like DNSChecker. Once you have the list, write a batch script with Scapy. The principle is the same: spoof the target’s IP, send DNS queries — an ANY query, say, which returns every record for the domain (A, MX, TXT, and so on) — so the response is larger than the request, and recursive lookups amplify it further. Again, you need a public server that permits IP spoofing.
Memcached Reflection and Amplification
Section titled “Memcached Reflection and Amplification”Memcached is a key-value cache, similar to Redis, listening on port 11211 by default over both TCP and UDP. set stores a key-value pair, get retrieves one, and stats returns server information. Most commands behave like Redis.
Because Memcached speaks UDP, an unauthenticated instance can be used for reflection. The attacker can first set a large key-value pair on the server, or call stats, which returns a lot of data; since UDP allows spoofing the target IP, the response is amplified.
Finding Memcached servers works like the other protocols: search a cyberspace search engine by keyword or port, or scan with Nmap or Masscan. With a list in hand, check for missing authentication:
nmap -iL ip_list.txt -p 11211 --script memcached-info -oN results.txtAn unauthenticated server reports Authentication: no. You can also connect by hand:
telnet <IP> 11211Once you have a confirmed list of unauthenticated Memcached servers, find an existing exploit script or ask a model to write one and run it in bulk.
CLDAP Reflection and Amplification
Section titled “CLDAP Reflection and Amplification”LDAP is the Lightweight Directory Access Protocol — essentially a directory database. It runs over TCP, whose three-way handshake prevents spoofing the source and receiving the response. CLDAP is LDAP over UDP, with no authentication; both use port 389.
CLDAP works by sending a RootDSE request, which makes the server return its detailed configuration, supported features, and naming contexts. The response is typically several kilobytes, which is enough for amplification.
To verify CLDAP, write a check with Python’s scapy. Nmap’s LDAP scripts mostly target TCP, so their results can be misleading — write your own.
SSDP Reflection and Amplification
Section titled “SSDP Reflection and Amplification”SSDP is the Simple Service Discovery Protocol, UDP-based. Put simply, it lets a device announce itself. On a home network, when a new fridge or washing machine joins, it broadcasts over SSDP: who I am, where I am, what I can do.
That’s why your phone can find the TV on the same network, and your computer can find the network printer. Many home routers expose SSDP to the internet; the default port is 1900.
SSDP has an M-SEARCH request that returns details on all devices underneath — description file URLs, device information, cache settings — so it also supports amplification.
Verify an IP with Nmap:
nmap -sU -p 1900 --script ssdp-discover -iL ips.txt --openSNMP Reflection and Amplification
Section titled “SNMP Reflection and Amplification”SNMP, the Simple Network Management Protocol, is mainly for device monitoring. Network admins watch switches, routers, firewalls, servers, cameras, which report memory, CPU, temperature, traffic, and hardware details over SNMP.
SNMP runs over UDP on port 161. SNMPv2c has a weak default credential: public. It has a GetBulkRequest command that returns a mass of monitoring data, enabling amplification. SNMPv3 adds authentication and encryption, so it doesn’t work for this.
Verify with Nmap:
# Check whether SNMP is availablenmap -sU -p161 --script snmp-info target-IP# Guess common weak credentials to see whether the community string is the default 'public'nmap -sU -p161 --script snmp-brute target-IPOr use snmpwalk:
snmpwalk -v2c -c public target-IPWS-Discovery Reflection and Amplification
Section titled “WS-Discovery Reflection and Amplification”WS-Discovery is another device discovery protocol, on UDP port 3702. It has grown popular for discovering IoT devices: a camera needs no app configuration — your phone taps search and finds it via WS-Discovery. It resembles SSDP, but there are differences: WS-Discovery targets industrial devices such as cameras and printers and uses an XML payload, while SSDP targets home appliances and uses plain text.
Its amplification comes from a probe request and the corresponding probematch response, which carries complete device information, service addresses, XML fields, and other bulk data.
Verify with Nmap:
nmap -sU -p 3702 --script wsdd-discover target-IPMany other protocols can be abused for reflection and amplification. The principle is always the same: UDP plus IP spoofing plus a bulky response.
HTTP Flood
Section titled “HTTP Flood”Now the application layer. HTTP Flood is simple: hit the server with many concurrent threads. The target is the application’s or middleware’s processing capacity — a full request means the server must allocate a thread, parse it, and process the work. Enough requests can also saturate bandwidth, but that’s a network-layer effect, not the main goal here. Tools abound: wrk, for example.
Slowloris
Section titled “Slowloris”Slowloris is a slow attack: it connects to the server and never closes, holding connections open. It’s slower than a flood. Both happen after the TCP handshake. A flood fires a request and immediately sends the next; Slowloris sends partial headers so the target thinks more is coming and waits. Again, plenty of tools — slowhttptest among them.
Model Layer
Section titled “Model Layer”Finally, model-layer DDoS. For LLMs this mostly means maliciously burning the victim’s tokens. Token consumption is formally the tenth item on the current Top 10, unrestricted consumption, which gets its own post later. Since this post is about DDoS, here’s a demo of an unlimited endpoint being hit at high frequency. Inference is expensive, so this can either crash the service or burn a large number of tokens without crashing it.
The sample code below exposes an endpoint that processes incoming data and sends it to the model, with no rate limiting. Save it to a .js file and run it with Node:
npm install expressnode xxx.jsThe code:
const express = require('express');const app = express();app.use(express.json());
let activeTasks = 0; // Current in-flight concurrencylet totalTokensConsumed = 0; // Cumulative simulated token usage
// Rough token estimate (simulating a real LLM, where one Chinese character is about 1.5-2 tokens)function estimateTokens(text) { return Math.ceil(text.length * 1.5);}
app.post('/api/processData', async (req, res) => { const startMemory = process.memoryUsage().heapUsed / 1024 / 1024; activeTasks++;
const inputData = req.body.data || ""; const tokens = estimateTokens(inputData); totalTokensConsumed += tokens;
const requestId = Math.random().toString(36).substring(7);
// Print live monitoring data console.log(`--- [Request in: ${requestId}] ---`); console.log(`Concurrent tasks: ${activeTasks}`); console.log(`Tokens this request: ${tokens} | Total tokens: ${totalTokensConsumed}`);
// Memory metrics: // rss: total physical memory used by the process // heapUsed: heap memory actually used by the V8 engine const mem = process.memoryUsage(); console.log(`Current memory (RSS): ${(mem.rss / 1024 / 1024).toFixed(2)} MB`); console.log(`Current heap memory (Heap): ${(mem.heapUsed / 1024 / 1024).toFixed(2)} MB`); console.log(`-------------------------------\n`);
try { // Simulate 2 seconds of heavy inference latency await new Promise(resolve => setTimeout(resolve, 2000));
activeTasks--; res.status(200).send(`[${requestId}] Processing complete`); } catch (error) { activeTasks--; res.status(500).send('System crashed'); }});
app.listen(3000, () => { console.log('Monitoring server ready: http://localhost:3000');});Once it’s running, use a bulk request script or a load-testing tool. Here I used Postman:

After confirming a single request works, save the endpoint into a Collection, click Run, and choose the Performance test. The virtual user count is how many real users to simulate:

With enough users, requests start failing:

The server isn’t responding:

Suggested mitigations:
-
Cap the length of input the endpoint accepts. Since it goes to the model, that’s effectively an input-side token limit.
-
Cap the maximum output tokens. Most commercial APIs support this.
-
Rate-limit access — an IP gets, say, XX requests per minute, and anything beyond that gets a “too many requests” response.
-
Process asynchronously. Synchronous handling means one request at a time, which clogs easily.
The script below adds rate limiting, an input length limit, and asynchronous processing, using the express-rate-limit package:
npm install express-rate-limitThe code:
const express = require('express');const rateLimit = require('express-rate-limit'); // Import the rate-limiting middlewareconst app = express();
app.use(express.json());
// --- Fix: rate limiting ---const limiter = rateLimit({ // Window: 1 minute (1 * 60 * 1000 milliseconds) windowMs: 1 * 60 * 1000, // Each IP may send at most 5 requests within that minute max: 5, message: { error: "Too many requests. Please try again later." }, standardHeaders: true, legacyHeaders: false,});
// --- Helper: simulate non-blocking heavy computation (fix 3) ---function processDataAsync(data) { return new Promise((resolve) => { // Use setImmediate to break up the heavy computation and avoid blocking the event loop setImmediate(() => { console.log(`Processing ${data.length} characters asynchronously...`); // Simulate some computation resolve(); }); });}
// Apply the fixed endpointapp.post('/api/processData', limiter, async (req, res) => { let inputData = req.body.data;
// --- Fix: input validation and size limiting --- if (!inputData || typeof inputData !== 'string') { return res.status(400).send('Invalid input: string data is required'); } if (inputData.length > 500) { // Cap length at 500 characters return res.status(413).send('Input is too long. Please shorten it and try again.'); }
try { // --- Fix: asynchronous processing --- await processDataAsync(inputData);
// Simulate calling the LLM await new Promise(resolve => setTimeout(resolve, 1000));
console.log("Processed successfully"); res.status(200).send('Data processed'); } catch (error) { res.status(500).send('Internal server error'); }});
const PORT = 3000;app.listen(PORT, () => { console.log(`Secure server running at http://localhost:${PORT}`);});Now more than five requests in a minute get rejected:

Inputs over 500 characters get rejected too:

Conclusion
Section titled “Conclusion”Unrestricted consumption from the LLM Top 10 will get a dedicated post. That covers DDoS in the context of LLM security. Thanks for reading.