GO KALI FREE

hping3

Stress Testing

Advancedhigh risk

hping3 is a command-line network tool for crafting, sending, and analyzing custom TCP/IP packets. Built for firewall testing, port scanning, OS fingerprinting, path MTU discovery, and authorized stress testing, it gives you control over nearly every field of the TCP, UDP, ICMP, and raw IP headers — the flags, sequence numbers, window size, TTL, fragmentation, and payload — and then shows you exactly how the target answers. Where Nmap runs predefined scan types, hping3 is the packet workbench you reach for when the question is "what does the firewall do with THIS exact packet?" It runs on raw sockets (so it needs root), supports scan and listen modes, and includes a Tcl scripting engine for automating protocol experiments in a lab.

Installation

sudo apt install hping3

Basic Syntax

hping3 [options] <target>

Quick Facts

Full Name
hping3
License
GNU GPL v2
Author
Salvatore Sanfilippo (antirez)
Written In
C
Platforms
Linux, macOS, BSD
Category
Stress Testing / Packet Crafting
First Release
2006
Protocols
TCP, UDP, ICMP, RAW-IP

Tool Overview

hping3 is a powerful command-line packet crafting tool that enables security professionals to construct and send custom TCP/IP packets. Unlike Nmap which follows predefined scanning patterns, hping3 gives full control over every packet field including flags, sequence numbers, window sizes, and payload content.

hping3 is widely used for firewall rule testing, port scanning, operating system fingerprinting, network performance measurement, and authorized stress testing. Its ability to craft arbitrary packets makes it invaluable for testing how network devices handle unusual or malformed traffic.

The tool supports TCP, UDP, ICMP, and RAW-IP protocols, with features for fragmentation, source IP spoofing, port scanning, and flood generation. It also includes a Tcl-based scripting engine for automated testing scenarios.

The mental model is simple: hping3 builds exactly one packet at a time, exactly the way you describe it, and then listens. You choose the protocol (TCP by default, UDP with -2, ICMP with -1, raw IP with -0), the flags (-S for SYN, -A for ACK, -F, -R, -P, -U, or combinations like the -X Xmas tree), the ports (-p for destination, -s for source), and the fine print most tools hide from you — TTL (-t), IP ID, fragmentation (-f, --mtu, --dontfrag), TCP window (-w), sequence and acknowledgment numbers (-M and -L), and an optional payload (-d for size, -E to load it from a file). The reply — or the silence — tells you how every device on the path treated that specific packet.

That precision is why hping3 survives in a world that already has Nmap. Nmap answers "which ports are open and what is running?" hping3 answers the follow-up questions a scanner cannot: does the firewall drop unsolicited ACK packets or pass them to the host? Does the IDS reassemble fragments before inspection? Is this port filtered, or is the service just slow to answer? Does the target's TCP stack hand out predictable sequence numbers or IP IDs? Firewall validation, anti-spoofing checks, MTU discovery, and stack fingerprinting are all hping3 home turf.

hping3 also has two personalities beyond probing. Scan mode (-8 with --scan) sweeps a port list with your crafted packet type. Listen mode (-9 with --listen and an -e signature) turns it into a patient receiver that only wakes up for packets carrying a secret string in the payload — a classic lab demonstration of covert channels and of moving a file across a network that was supposed to block it. Add the built-in Tcl scripting engine and APD (Annotated Packet Dump) descriptions, and hping3 becomes a small protocol laboratory rather than a single-purpose scanner. Treat it with respect: it needs root, it is loud on any monitored network, and its --flood mode exists for authorized stress tests only.

Quick Reference Commands

Verified quick-reference commands for hping3
CommandPurpose
hping3 --versionPrint the installed version.
hping3 --helpDisplay locally supported flags.
hping3 -1 -c 3 192.0.2.10Send three ICMP probes to TEST-NET-1.
hping3 -S -p 443 -c 3 192.0.2.10Send three TCP SYN probes to port 443.
hping3 | Kali Linux Tools

Common Commands

hping3 -S -p 80 targetSYN packet to port 80 — Test port response
hping3 --flood -S -p 80 targetSYN flood — Stress testing (authorized)
hping3 -1 targetICMP ping — Basic connectivity
hping3 -S --scan 1-1000 targetPort scan — Find open ports
hping3 -S -p 80 --spoof 1.2.3.4 targetSpoofed source — Test firewall rules
hping3 -A -p 80 targetACK scan — Probe stateful firewall inspection behavior
hping3 -2 -p 53 targetUDP mode — Send UDP packets to test port 53 (DNS)
hping3 -F -P -U -p 80 targetXmas scan — Set FIN, PUSH, and URG flags together
hping3 -S -p ++1 -c 100 targetIncrementing port — Increase destination port by 1 for each packet
hping3 -1 -C 8 targetICMP type — Send ICMP echo requests (type 8) explicitly
hping3 -S -p 80 --tcp-timestamp targetTCP timestamp — Estimate target uptime from timestamps
hping3 --flood -S -p 80 --rand-source targetRandomized flood — SYN flood with random spoofed sources (authorized)
hping3 -S -p 80 -f targetFragmentation — Split packets to test IDS/firewall handling
hping3 -1 -d 65495 targetLarge ICMP — Send oversized ICMP payload (ping-of-death style test)
hping3 -S -p 80 -a 10.0.0.5 targetFixed spoof — Set a specific spoofed source address
hping3 --traceroute -V -1 targetTraceroute — Map the network path using ICMP with verbose output
hping3 -Q -S -p 443 targetSequence sampling — Collect the TCP sequence numbers a target returns, useful for predictability analysis
hping3 -2 -p 161 targetUDP probe — Send a UDP packet to port 161 (SNMP); an ICMP port-unreachable reply means the port is closed
hping3 --icmp-ts targetICMP timestamp — Send an ICMP timestamp request (type 13) to learn the target's clock and check it answers ICMP
hping3 -9 --listen signature -e signature targetListen mode — Wait silently for packets carrying a signature payload (covert-channel and file-transfer lab technique)
hping3 -S -p 80 -t 5 targetCustom TTL — Set the IP time-to-live to 5 to test how far a packet travels before expiring
hping3 -S -p 80 --dontfrag --mtu 28 targetMTU test — Force small fragments with a virtual MTU to probe path MTU and fragment reassembly behavior
hping3 -S -p 80 -d 120 -E payload.txt targetFile payload — Send a 120-byte packet whose data is loaded from a file with --file
hping3 -S -p 80 -M 1000 -L 0 targetFixed seq/ack — Set exact sequence (1000) and acknowledgment (0) numbers to test stateful inspection edge cases

Step-by-Step Guide

  1. 1Get written authorization for the target and agree on a test window — hping3 sends raw packets that intrusion-prevention systems treat as hostile, and its flood modes can take services down.
  2. 2Install and confirm the basics: run sudo apt install hping3, then check connectivity with a plain ICMP probe: sudo hping3 -1 -c 3 192.168.1.10. You should see one reply line per packet with an rtt value.
  3. 3Start with a single, polite probe. Send one SYN to a known service port: sudo hping3 -S -p 443 -c 1 192.168.1.10. The -c 1 count keeps the test to exactly one packet while you learn to read the reply.
  4. 4Read the reply flags. flags=SA means SYN+ACK — the port is open and a service is listening. flags=RA means RST+ACK — the host is reachable but the port is closed. No reply at all after several packets usually means a firewall is silently dropping your traffic.
  5. 5Map the firewall with an ACK probe: sudo hping3 -A -p 443 -c 3 192.168.1.10. If you get RST replies, your unsolicited ACK packets reached the host, so the firewall is not doing stateful filtering on that path. Silence means the packets were filtered.
  6. 6Scan a small port range in scan mode: sudo hping3 -S --scan 21,22,80,443,8080 192.168.1.10. hping3 prints each port that answers, which is slower than Nmap but shows you the raw reply for every port.
  7. 7Test how the path handles fragmentation: sudo hping3 -S -p 80 -f -c 3 192.168.1.10 splits your probe into fragments. If the fragmented probe is answered but should have been blocked, the firewall or IDS may not reassemble fragments before inspecting them.
  8. 8Measure the path. Run sudo hping3 --traceroute -V -1 192.168.1.10 to list each hop, and use --icmp-ts to check whether the target answers ICMP timestamp requests — both are quick recon wins before deeper testing.
  9. 9Only in an approved stress-test window, raise the rate gradually: start with sudo hping3 -S -p 80 --fast 192.168.1.10, watch the target's CPU and response latency from a second terminal, and stop the moment the service degrades. Never jump straight to --flood against production systems.
  10. 10Record everything. Save your terminal output, note which flag combinations were answered, dropped, or rejected, and turn that into the firewall rule changes or report findings — the packet-by-packet evidence is the whole point of using hping3.

Warnings

Use Cases

Firewall Testing

Verify firewall rules by sending custom packets with specific flags, ports, and source addresses.

Port Scanning

Assess open ports using SYN, ACK, FIN, or NULL scans with full control over packet headers.

Stress Testing

Simulate denial-of-service conditions with SYN floods, ICMP floods, or custom flood patterns.

OS Fingerprinting

Identify target operating systems by analyzing responses to crafted TCP/IP packets.

Spoofing Tests

Validate anti-spoofing firewall rules by sending packets with forged source IP addresses.

Path MTU Discovery

Discover maximum transmission unit along network paths using fragmented packets.

Covert Channel Testing

Demonstrate and detect data hidden inside allowed protocols using listen mode with signature payloads.

Latency and Loss Measurement

Measure round-trip time and packet loss over TCP, UDP, or ICMP where normal ping is blocked.

Key Features

People Also Ask

How do I test firewall rules with hping3?

Send packets with different TCP flags to verify which are allowed or blocked. For example, hping3 -S -p 80 10.10.10.10 tests if SYN packets reach port 80, while hping3 -A -p 80 10.10.10.10 probes stateful inspection behavior with ACK packets. Compare responses across flag combinations to map the full rule set.

What is the difference between hping3 and Nmap?

hping3 gives you raw packet crafting control over every TCP/IP field, while Nmap provides automated scanning with predefined scan types. Use hping3 when you need to test specific firewall rules, craft custom probes, or analyze TCP/IP stack behavior at the packet level. Use Nmap for comprehensive host discovery and service detection.

How do I perform a traceroute with hping3?

Use the --traceroute flag with a protocol mode. For example, hping3 --traceroute -V -1 10.10.10.10 performs an ICMP traceroute with verbose output. You can also use TCP traceroute with --traceroute -V -S -p 80 to trace through firewalls that block ICMP.

Does hping3 require root privileges?

Yes, hping3 requires root or sudo access because it creates raw sockets to craft custom packets. Running without sudo produces permission denied errors. Always run hping3 with sudo: sudo hping3 -S -p 80 10.10.10.10.

How do I use hping3 for path MTU discovery?

Send fragmented packets with the -f flag and set DF (Don't Fragment) bit to discover the maximum transmission unit along a path. Use hping3 -S -p 80 -f 10.10.10.10 and observe ICMP Fragmentation Needed responses to determine the MTU limit.

Can hping3 detect operating systems?

hping3 can perform rudimentary OS fingerprinting by analyzing TCP/IP stack responses. Use the -O flag to enable OS detection mode, and examine differences in TTL, window size, TCP options, and response patterns to identify the target operating system.

What is the hping3 equivalent of a ping sweep?

Use ICMP mode against each host: sudo hping3 -1 -c 2 192.168.1.10 sends two echo requests and reports replies with round-trip times. For a whole subnet, testers usually script hping3 in a loop or use Nmap's -sn ping scan, then return to hping3 for the hosts that need a closer, packet-level look.

Can hping3 bypass a firewall?

hping3 does not magically bypass firewalls — it reveals how a firewall treats unusual packets. Fragmented probes, unexpected flag combinations, and spoofed sources sometimes expose rules that were written too narrowly, which is exactly what a firewall test is meant to find so the rules can be fixed. On a correctly configured stateful firewall, crafted packets are dropped like any other unauthorized traffic.

Related Tools

GoldenEye

Stress Testing

GoldenEye is an HTTP denial-of-service testing tool that utilizes KeepAlive and NoCache headers to simulate heavy concurrent traffic and test web server resilience.

Slowloris

Stress Testing

Slowloris is a denial-of-service tool that allows a single machine to test a web server's resilience against resource exhaustion by keeping numerous HTTP connections open with partial requests.

Nmap

Information Gathering

Learn how to use Nmap, the free open-source network scanner: run your first port scan, discover live hosts, detect services and operating systems, and check for vulnerabilities with NSE scripts — a beginner tutorial for Kali Linux.

tcpdump

Sniffing & Spoofing

tcpdump is a powerful, lightweight command-line packet analyzer that allows users to capture, parse, and filter TCP/IP and other packets transmitted or received over a network.

Wireshark

Sniffing & Spoofing

Wireshark tutorial for beginners: capture packets, read the three panes, filter traffic and follow TCP streams — a hands-on guide to the world's foremost network protocol analyzer.

WireGuard

Maintaining Access

WireGuard is an extremely fast, modern VPN protocol that lives inside the Linux kernel and uses state-of-the-art cryptography — Curve25519 key exchange, ChaCha20Poly1305 encryption, and the Noise protocol framework — in a core codebase of only a few thousand lines. In penetration testing and red team work it creates secure, persistent tunnels for pivoting into internal networks and maintaining encrypted access, while system administrators use the same tool for site-to-site links and road-warrior VPNs. Every peer is identified by a single public key, traffic is bound to that key by cryptokey routing (AllowedIPs), and the protocol stays completely silent toward unauthenticated packets, which makes a WireGuard port nearly invisible to scanners.

Related Cybersecurity Guides

OSINT · Intermediate

Nmap Advanced Techniques: Expert Network Scanning

Master advanced Nmap scanning techniques including NSE scripting, firewall evasion, performance tuning, and custom scan types for professional penetration testing.

Networking · Intermediate

Firewall Fundamentals: Network Security and Configuration

Learn firewall types, architectures, rule configuration, and best practices for network security and traffic filtering.

Networking · Intermediate

DNS Explained: How the Domain Name System Works and Its Security

An in-depth exploration of DNS architecture, resolution process, record types, caching, security threats, and privacy protocols like DoH and DoT.

Networking · Beginner

How to Use WireGuard: Beginner's Guide to Setting Up a WireGuard VPN in Kali Linux

How to use WireGuard: install it on Kali Linux, build your first tunnel, verify it with wg show, and fix common problems — cheat sheet and 31 FAQs.

Frequently Asked Questions

What is hping3 used for?

hping3 is a command-line packet crafting tool used for firewall testing, port scanning, network stress testing, and TCP/IP stack analysis. It allows you to send custom packets with arbitrary flags, payloads, and headers to test how network devices respond.

How do I use hping3 for port scanning?

Use hping3 -S --scan 1-1000 target_ip to SYN scan the first 1000 ports. Unlike Nmap, hping3 gives you full control over packet flags, window sizes, and TCP options. Use -S for SYN, -A for ACK, -F for FIN, and -P for PUSH scans.

Can hping3 spoof IP addresses?

Yes, use the --spoof flag to spoof the source IP address: hping3 -S -p 80 --spoof 1.2.3.4 target. This is useful for firewall rule testing to verify that spoofed traffic is properly filtered.

Is hping3 legal to use?

hping3 is a legitimate network testing tool. However, using it for flood attacks, port scanning without authorization, or any form of denial of service against systems you do not own is illegal. Always obtain explicit written permission before testing.

What do the flags in hping3 output mean?

The flags field shows which TCP flags the target set in its reply. SA means SYN+ACK: the port is open and a service accepted the handshake. RA means RST+ACK: the host is reachable but the port is closed. A lone R (RST) in response to an ACK probe means your packet reached the host unfiltered. If you receive nothing at all, a firewall is most likely dropping the packets silently.

How do I read hping3 results for open, closed, and filtered ports?

Send a SYN and watch the answer: SYN+ACK = open, RST+ACK = closed, and silence or an ICMP type 3 (destination unreachable) message = filtered. Repeat the probe 3-4 times with -c before calling a port filtered, because a single dropped packet on a busy network can imitate filtering.

What is the difference between hping3 scan mode and Nmap?

hping3's --scan mode sends one crafted packet type across a port list and shows you each raw reply, which is ideal for testing one specific hypothesis about a firewall. Nmap is a full scanner: service and version detection, OS fingerprinting, timing templates, and the NSE scripting library. Most testers scan with Nmap first, then switch to hping3 when they need a packet Nmap cannot build.

What is hping3 listen mode used for?

In listen mode (hping3 --listen) the tool waits silently and only reacts to packets whose payload contains a chosen signature string set with -e. In labs it demonstrates covert channels and simple file transfer through networks that only permit certain protocols, because the traffic looks like ordinary ICMP or TCP packets until the signature is matched.

Can hping3 measure latency and packet loss?

Yes. Every reply line shows rtt (round-trip time in milliseconds), and the statistics block printed when you stop hping3 summarizes packets transmitted, packets received, percentage packet loss, and min/avg/max round-trip times. It works with ICMP, TCP, and UDP probes, so you can measure paths where normal ping is blocked.

Why does hping3 show no replies even though the host is up?

The usual causes are: a firewall silently dropping your probe type (try a different protocol or flag combination), the target rate-limiting replies, your own outbound rules blocking raw sockets, or running without sudo so packets never leave. Test against a known-open port on a lab machine first to separate tool problems from target filtering.

What is the difference between hping2 and hping3?

hping3 is the successor to hping2 and keeps the same packet-crafting core while adding a Tcl scripting engine, APD (Annotated Packet Dump) support for describing packets in a text format, listen mode improvements, and better handling of TCP sequence number collection and fingerprinting data. On modern Kali Linux, hping3 is the version you install.

How do I limit how many packets hping3 sends?

Use -c (count) to stop after an exact number of packets, for example sudo hping3 -S -p 443 -c 4 192.168.1.10 sends exactly four SYNs. Combine it with -i to control pacing, such as -i 1 for one packet per second, and avoid --flood outside an approved stress test because flood mode removes all pacing.

Tags

#stress-testing#networking#packet-crafting#scanning

Output Explanation

Every reply hping3 receives is printed as one line, and reading that line fluently is the core skill. A typical SYN probe looks like this: "HPING 192.168.1.10 (eth0 192.168.1.10): S set, 40 headers + 0 data bytes" announces the mode (S = SYN flag set) and packet size. Each answer then appears as "len=46 ip=192.168.1.10 ttl=64 DF id=0 sport=443 flags=SA seq=0 win=29200 rtt=0.4 ms". Break it down field by field: len is the reply size in bytes; ip is the answering host; ttl is the remaining time-to-live, a rough hint at hop count and OS family (64 is typical of Linux, 128 of Windows); DF means the Don't Fragment bit was set; id is the IP identification value (watch whether it increments predictably across replies — that is what idle-scan and fingerprinting techniques analyze); sport is the source port the reply came from, i.e. the port you probed; flags is the heart of the line — SA (SYN+ACK) means the port is open, RA (RST+ACK) means closed, and no line at all means your packet was dropped or filtered; seq is the reply counter, win is the advertised TCP window size (another OS fingerprinting clue), and rtt is the round-trip time in milliseconds. For ICMP mode the line changes shape: "len=46 ip=192.168.1.1 ttl=64 id=51234 icmp_seq=0 rtt=0.5 ms". When you stop hping3 with Ctrl+C it prints a statistics block — "--- 192.168.1.10 hping statistic --- 10 packets transmitted, 9 packets received, 10% packet loss, round-trip min/avg/max" — which is the quickest health check of the path: packet loss or a wide min/max rtt spread points at congestion or rate limiting between you and the target.

Ethical Usage Notice

This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.