What Is hping3? Packet Crafting Explained for Defenders

hping3 is a free, command-line packet crafting tool for Linux and Unix. Instead of sending normal traffic, it lets a user build TCP, UDP, ICMP or raw IP packets with chosen flags, sizes and rates. Security engineers use it in labs to test whether firewall rules and intrusion detection systems behave as expected. Attackers misuse the same ability for stealthy scans and SYN floods.

Jun 18, 2025 - 10:56
Updated: 
112.1k

Network Security in Cybersecurity & Ethical Hacking · Troubleshooting

What Is hping3? Packet Crafting Explained for Defenders

Quick answer: hping3 is a free, command-line packet crafting tool for Linux and Unix. Instead of sending normal traffic, it lets a user build TCP, UDP, ICMP or raw IP packets with chosen flags, sizes and rates. Security engineers use it in labs to test whether firewall rules and intrusion detection systems behave as expected. Attackers misuse the same ability for stealthy scans and SYN floods. Using it against systems you do not own without written permission is illegal under the IT Act 2000. Defenders should watch for unusual flag combinations and floods, and protect services with SYN cookies, rate limiting, stateful firewalls and upstream DDoS protection.

Key takeaways

  • hping3 crafts packets by hand; it is a test instrument, not an exploit.
  • Its legitimate value is checking that firewalls and IDS rules do what you think.
  • Its misuse is mainly denial of service and evasive scanning.
  • Crafted traffic often looks abnormal, which helps detection.
  • SYN cookies and rate limits blunt the most common abuse.

Table of Contents

What Is hping3 and What Is Packet Crafting?

The hping project describes the tool as a TCP/IP packet assembler and analyser. Ordinary programs let the operating system decide how packets look. Packet crafting tools give that control to the user: which TCP flags are set, which source port is used, how large the payload is and how fast packets are sent. The TCP rules they play with are defined in RFC 9293.

Why Do Engineers and Attackers Use hping3?

Legitimate lab useMisuse to defend against
Verify a firewall drops packets with odd flag combinationsScans with unusual flags to slip past simple filters
Check that an IDS rule fires on a known patternSpoofed source scans that hide the real origin
Measure path behaviour and MTU issuesSYN floods that exhaust connection tables (T1498)
Teach how TCP handshakes workService discovery on unauthorised targets (T1046)

Authorised firewall testing is described in NIST SP 800-115 as part of security testing, and it should be done in a lab or an agreed maintenance window.

Sending crafted or flooding traffic to systems you do not own can disrupt services and amounts to damage or denial of access under Section 43 of the IT Act, 2000, with criminal liability under Section 66. Even a short test against a production site without written approval can cause outages. Keep tests inside isolated labs or within a signed scope that lists targets, rates and stop conditions.

What Traces Does Crafted Traffic Leave?

  • TCP packets with flag combinations that normal stacks never send.
  • Large numbers of SYN packets without the final ACK of a handshake.
  • Identical packet sizes and perfectly regular timing.
  • Source addresses that are bogons or that never answer return traffic.
  • Spikes in half-open connections on the target server.

How Do You Detect hping3-Style Traffic?

IDS engines such as Snort and Suricata include community rules for invalid TCP flag combinations and SYN flood thresholds. Zeek records connection states, so many flows that end in a half-open state stand out. Firewalls with stateful inspection log packets that do not belong to any known session. NetFlow or IPFIX data from routers helps spot volume floods early. CISA's DDoS guidance recommends preparing a response plan and contacts with your provider before an attack.

How Do You Check SYN Flood Protection on Your Linux Server?

This read-only check shows whether SYN cookies are enabled on your own Linux host. The kernel documentation explains that a value of 1 sends cookies when the SYN backlog overflows.

sysctl net.ipv4.tcp_syncookies
sysctl net.ipv4.tcp_max_syn_backlog

How Do You Reduce the Impact of Packet Floods?

ControlEffect
SYN cookiesServer survives backlog exhaustion, as described in RFC 4987
Rate limiting at the edgeCaps new connections per source
Stateful firewallDrops packets outside valid sessions and odd flag sets
Anti-spoofing filtersBlocks packets with impossible source addresses
Upstream DDoS protectionAbsorbs volume before it reaches your link

To understand the flags involved, read our guide to TCP communication flags, and see our network scanning tool comparison. Safe lab practice is part of our network security training.

References

Frequently Asked Questions

hping3 is a free command-line packet crafting tool that builds TCP, UDP, ICMP or raw IP packets with chosen flags, sizes and rates.

It is building network packets by hand instead of letting the operating system decide, so you control flags, ports, sizes and timing.

It is a dual-use test instrument. Engineers use it to verify firewalls and IDS rules, while attackers misuse it for scans and floods.

Only on your own systems or with written permission. Flooding or probing others can breach Sections 43 and 66 of the IT Act 2000.

Look for many SYN packets without completed handshakes, rising half-open connections, IDS threshold alerts and flow data spikes.

SYN cookies let a server answer connection requests without storing state until the handshake completes, so floods do not fill the backlog.

A stateful firewall drops packets outside valid sessions and odd flag combinations, though volume floods also need upstream protection.

In an isolated lab of virtual machines you own, never on production networks or third-party systems without a signed scope.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.