Posted on

Beginners guide to netdiscover

Hello, aspiring ethical hackers. In one of our previous blogposts, you learnt about network scanning. In this blogpost, you will learn about netdiscover tool. It is an active/passive network address discovering tool that was actually developed to discover wireless networks during wardriving but can also detect addresses on switched networks. It used ARP packets to detect network addresses.

It is mostly used to find the target IP address in hack the box challenges. But it can also be used to scan for network addresses of a network in real-world pen testing. It is installed by default in Kali Linux and we are going to use same for this tutorial.

Netdiscover 1

The simplest way of using netdiscover to find out network addresses is to simply type the command “netdiscover” in the terminal as shown below.

Netdiscover 2

Then it slowly scans for network addresses as shown below. This is how most people use it.

Netdiscover 3

Fast mode

However, you don’t have to wait for netdiscover to finish scanning as long as it takes. You can scan faster with netdiscover too using the “-f” option.

Netdiscover 4
Netdiscover 5

Interface mode

Netdiscover can be set to scan network addresses on a specific network interface you want. For example, on Kali Linux, let’s use the command “ip a” to view all the network interfaces connected to it.

Netdiscover 6

Interface mode can be set with the “-i” option. For example, let’s scan the interface “eth0” as shown below.

Netdiscover 7
Netdiscover 8

Scan a specific range

Similarly, netdiscover can be used to scan a specific range as shown below. For example, let’s scan the range 192.168.248.0/24.

Netdiscover 9
Netdiscover 10
Netdiscover 11

Printable form (-p)

Netdiscover can also display its output in a way easy for printing using the “-p” option.

Netdiscover 12

Posted on

Beginners guide to Zenmap

Hello, aspiring ethical hackers. In one of our previous blogposts, you learnt in detail about Nmap, the popular port scanner. If you are like me, you thought all those commands, types of scans and options are very difficult to grasp. Well, maybe even the makers of Nmap also thought the same. Hence, they release a GUI version of Nmap called Zenmap.

Zenmap is the official GUI version of Nmap security scanner. It works on almost all platforms (Linux, Windows, mac OSX, BSD etc.). Just like Nmap it is also open-source. In this blogpost you will learn in detail about Zenmap. It can be downloaded from here. Kali Linux has Zenmap in its repository as part of kaboxer. For this tutorial, we will be using this only.

In Kali Linux, open a terminal in kali and type the command “Zenmap-kbx”. If Zenmap is not already installed, the system will prompt you if you want to install it.

Zenmap 1
Zenmap 2

Type “y” to install it, Otherwise, it will open Zenmap GUI as shown below.

Zenmap 3

The interface of Zenmap can be divided in to five sections.

  1. Target section
  2. Profile section
  3. Output section
  4. Host / services section
  5. Command section

    The target section is where we specify a target. The target can be specified in all the variety of ways Nmap allows. The profile section allows you to choose a type of scan. There are various scan options available.
Zenmap 4

Let’s select Quick scan for now. The command section shows the command for each scan type you select. Yes, you can type the command also directly and run Zenmap here. But if you want to do it, you would have been content with Nmap only. For now, let’s click on ‘scan’. Very soon, the results will be out and can be seen in output section as shown below.

Zenmap 5
Zenmap 6 1

The output section has many other tabs that provide additional information about the target scanned. The ports/hosts tabs show the open ports, type of protocol it uses and the service running on it separately and clearly.

Zenmap 7

The “Topology” sub-section shows that our attacker machine and target machine in visual form.

Zenmap 8

You can even zoom on the visual representation for a better view.

Zenmap 9

The “Host details” tab shows details about the target host separately.

Zenmap 10

The “scans” section shows all the scans you have performed.

Zenmap 11

Let’s select a “Regular scan” now.

Zenmap 15
Zenmap 16

The “Hosts/services” section provides information about the target host and services running on it.

Zenmap 12
Zenmap 13

That was all about Zenmap. See how simple it is to use Zenmap for port scanning.

Posted on

Beginners guide to Commix

Hello, aspiring ethical hackers. In one of our previous blogposts, you learnt what is command injection, types of command injection etc. In this blogpost, you will learn about Commix, a tool that is used to automatically exploit command injection vulnerability.

Commix, which is short for (comm) and (injection) e(x)ploiter is an open source pen testing tool written by Anastasior Stasinopolos that is useful in automatically detecting and exploiting command injection vulnerabilities. Written in Python, commix can be installed on any platform that supports Python.

On pen testing distros like Kali Linux, commix is installed by default. So, we will be using it for this tutorial. As target, we will be using mutillidae in Metasploitable 2. Mutillidae, is an intentionally vulnerable web application for practicing ethical hacking. See how to install Metasploitable 2 in virtualBox and set up a virtual hacking lab.

A webpage “dns-lookup.php” in mutillidae has a command injection vulnerability in the Hostname/IP field. These vulnerabilities can be detected using web vulnerability scanners like OWASP ZAP (aka zaproxy), Nikto, Burpsuite etc.

Commix 1

What this webpage does is when you provide an IP or hostname, it performs a DNS lookup of that IP or hostname (For example, we have used it on google.com).

Commix 2

This is its name functioning but when you join another command to the IP/hostname using ampersand as shown below, it also executes that command as shown below.

Commix 3
Commix 4 1

Commix allows us to exploit this vulnerability automatically. To do this, with commix, we need information about the parameter being sent while sending this query. This can be achieved by using OWASP ZAP as an intercepting proxy. See how to set OWASP ZAP as an intercepting proxy.

Commix 5

The target can be specified in commix using the “-u” option and POST data can be specified using “–data” option as shown below.

Commix 28

When you execute this command, commix will prompt you to set cookies. Cookies are not needed in this case.

Commix 29

Then, commix says the parameters we are testing is vulnerable to command injection and it will prompt you for a pseudo-terminal access.

Commix 30

Selecting ‘Yes” will give us access to the commix shell a shown below.

Commix 31

Apart from giving you a terminal on the target system, commix provides a lot of enumeration options. Let’s see some of them here.

–hostname

It retrieves the hostname of the target system.

Commix 6
Commix 7

–current-user

This command retrieves the current user on the target system.

Commix 8
Commix 9

–is-root

This command checks if the current user has root privileges.

Commix 10
Commix 11

–is-admin

This command checks if the current user has admin privileges.

Commix 12

–sys-info

As you might have guessed by now, this command retrieves the system information of the target.

Commix 13
Commix 14

–users

This command retrieves all the users on the target system.

Commix 15
Commix 16

–passwords

This command retrieves passwords of all the users on the system.

Commix 17
Commix 18

Here, of course we did not get any password hashes, as we do not have enough privileges to get those.

–privileges

This command retrieves the privileges of all the users on the target system.

Commix 19

–ps-version

This command retrieves the version of the PowerShell installed on the target system.

Commix 20

–all

Instead of enumerating each item separately, you can retrieve all the information from the target system using the “–all” option.

Commix 21
Commix 22
Commix 23

–os-cmd

This command is used to execute a single operating system command on the target system. For example, let’s execute “ls” command on the target system.

Commix 24
Commix 25

–os=

This command is used to force the backend operating system (For example, Windows or UNIX.

Commix 26
Commix 27
Posted on

Beginners guide to XSSer

Hello, aspiring ethical hackers. In one of our previous blogposts, you learnt what XSS vulnerability is, what are the different types of XSS vulnerabilities and its impact on web security. Wouldn’t it be good if there was a tool that can automatically detect and exploit XSS vulnerabilities? In this blogpost, you will be learning about one such tool named XSSer which is an automatic framework to detect, exploit and report XSS vulnerabilities in web applications.

XSSer is a python script and can be installed on all Linux systems with python installed. It is installed by default in Kali Linux and we are going to use the same for this tutorial. See how to install kali Linux in virtual Box. We will be using Mutillidae in Metasploitable 2 as target to test with XSSer as it is easily available to download and this tutorial is easily reproducible. See how to install Metasploitable 2 in VirtualBox.

Mutillidae is a vulnerable web app that intentionally consists of all OWASP 10 vulnerabilities for practicing web application hacking. Also see how to create a virtual hacking lab in virtual Box. In the page shown below belonging to Mutillidae, the blog entry field consists of a XSS vulnerability. These vulnerable pages can be detected using web vulnerability scanners like OWASP ZAP aka Zaproxy, Nikto and Burpsuite etc.

XSSer 1

XSSer can also be used to scan for XSS vulnerabilities using the “–all” option” as shown below.

XSSer 2
XSSer 3
XSSer 4
XSSer 5
XSSer 6

However, here XSSer failed to find any XSS vulnerability. Let’s see how to find any XSS vulnerability in this specific section. For this, I start OWASP ZAP as intercepting proxy to capture web requests. Then, I change the setting in the browser to access the web through this proxy and visit the vulnerable page again on this browser.

XSSer 7

I type “This is a new blogpost” in the blogpost entry and save the blogpost. Now, when we view the captured web request in OWASP ZAP as shown below, we can see the request being sent to the target.

XSSer 8

Now, we copy the highlighted data above and use it in our XSSer tool. The only difference is to find out the XSS vulnerability, we add text “XSS” in the place of any vector that us vulnerable to XSS.

XSSer 9

Note the method the query is using to pass this data. There are two methods by which data is sent and received: GET and POST. XSSer has an option to use both the methods: (-g) for GET method and (-p) for POST method. OWASP ZAP has shown us that this data is being passed using the POST method. So, we will be using the same with XSSer.

XSSer 10
XSSer 11
XSSer 12
XSSer 13

Now, you can see that vector “blog_entry” is vulnerable to cross site scripting using URL method. Here, we tried one vector. XSSer provides an option to inject a list of vectors provided by XSSer. To test all these vectors, we can use the “—auto” option. XSSer in total has 1291 injection vectors.

XSSer 14
XSSer 15

As you can see, XSSer found 1287 of 1291 injection vectors in the web app. XSSer also has the option of using payloads. Here the payload can be anything even the most popular <script> alert (“HC”)</script). Here is how we specify the payload in XSSer.

XSSer 16

Here I have given the same above-mentioned script as payload.

XSSer 17

Specify your own payload

Using the “-Fp” option, you can even specify your own payload for final injection.

XSSer 18

Execute payload remotely

The “-Fr” option is used to execute the payload remotely.

XSSer 19
XSSer 20

Posted on

Complete guide to web application hacking

Hello, aspiring ethical hackers. In this blogpost, you will learn about web application hacking. Based on research of Verizon, web applications were the most exploited vector in hacking incidents and data breachers that happened last year (2023).

According to the CyCognito State Of Web application Security Testing 2024 report, each organization exposes 100s of web applications to the web out of which 70% are untested for any security vulnerabilities. These web applications provide a large attack surface which can easily be exploited by hackers. To understand threats to web applications you need to thoroughly understand what a web application is, what is web application hacking, types of attacks that affect web applications etc.

What is a web application?

A web application is any program or application that is rendered through web browsers. Any app that you use through the browser without downloading it to your Desktop or Laptop is a web app. Example of web applications are Gmail, Netflix, Yahoo, Canva etc.

A web application is hosted on a web server and application server. A web server consists of both hardware and software components. Examples of popular web server software are Apache, NGINX, Microsoft IIS, Lighthttpd, node.js, Apache Tomcat and LiteSpeed etc. To store data, web servers use a database. Most popular databases in use are MySQL, Oracle, Microsoft SQL Server, PostgreSQL, MongoDB, Redis, MariaDB, Splunk, SQLite etc.

Web Server Hacking 1

Similar to a website, a web application is written in HTML/CSS, JavaScript and it uses PHP/ASP for server side programming and Database for storing data etc. Apart from a web server there is also presence of an application server to serve web apps.

Web Application Hacking 1 1

What is web application hacking?

Hacking of these web applications to compromise the entire web server or the entire network is known as web application hacking.

Types of web application attacks

There are many attacks that can be used to compromise web applications..

Web Application Hacking 2

1. Remote File Inclusion (RFI) attack

2. Local File Inclusion attack

3. SQL injection attack

4. Cross-site scripting (XSS) attack

5. OS Command Injection attack

6. Cross site Request Forgery (CSRF) attack

7. Password cracking attack

8. Session Hijacking attack

9. Server side request forgery (SSRF) attack

Impact of a web application hacking

Compromise of a web application can have many affects. Most important of them are,

1. Data breach and Data theft:

Compromise of a web application can result in a data breach and data theft.

2. Leak of sensitive information:

Sometimes, a web application compromise can leak sensitive information about a company or organization.

3. Web app defacement:

Every web application has an index page that is the page that loads when you visit a website. When hackers change the index page and replace it with another page, it is known as website defacement.

4. Secondary attacks:

Once a web application is compromised, it can be used by hackers for other malicious purposes like hosting malware, to perform a DDoS attack or using it as a proxy to perform attacks on other websites.