Friday 22 December 2017

[Workaround and Fix] - Power given, but Power Controller does not report Power Good - Cisco 2960X Stack


If you hit this page, I think you have encountered an issue similar to what I have faced in my production environment yesterday. But still let me give you a brief about what I had seen so that you can compare it with your problem and apply the fix if needed.

Problem:-

Couple of PCs which were connected to our access layer switch WS-C2960X-48LPS-L were continuously flapping. It was not the link flap, but a POE related flap. Look at the strange alerts on the interfaces,

%ILPOWER-3-CONTROLLER_PORT_ERR: Controller port error, Interface Gi1/0/32: Power given, but Power Controller does not report Power Good
%ILPOWER-7-DETECT: Interface Gi1/0/32: Power Device detected: IEEE PD
%ILPOWER-5-POWER_GRANTED: Interface Gi1/0/32: Power granted
%ILPOWER-5-IEEE_DISCONNECT: Interface Gi1/0/32: PD removed
%ILPOWER-7-DETECT: Interface Gi1/0/32: Power Device detected: IEEE PD

Solution:-

This just kept happening again and again. Though the device doesn't need POE, it appeared to be related to POE negotiation. So as a workaround I just disabled POE on the interface using below command after which the alerts just disappeared.

Switch(config-if)int g1/0/32
Switch(config-if)#power inline never
And when we checked with Cisco for the solution, they said it is a hardware fault and raised RMA for the device. 

I hope this piece of information was useful for you.

GNS3 and Palo Alto Integration - Required download links


Last week I tried to setup Palo Alto in Vmware workstation and link it with GNS3 software. In that process, I found below download links to be useful and I wanted to share it with you all.

GNS3 Palo Alto Support Page

Here is the PA GNS3 appliance support page:-
https://www.gns3.com/news/article/new-appliance-supported-palo-alt

Palo Alto Vmware Download Images

PA-VM-ESX-8.0.0.ova
https://mega.nz/#!kM9V0BSZ!q_QgVseqc5diEweOEF5zkzINYFEJZMA6Xx1jK00Zn1o

PA-VM-KVM-7.1.0.qcow2
https://mega.nz/#!RdsBXKrY!Z048jvOma_ozQD9_s18OzSB2RQ3cURnjPnEu4Magk7g

PA-VM-KVM-7.1.4.qcow2
https://mega.nz/#!pdE0FbaZ!_ifg2K_WDtySPEmwMMMzezSgF0Hp0kLKP-k9NDrtxSY

PA-VM-KVM-8.0.0.qcow2
https://mega.nz/#!1c0yTaaK!I-N_mGRg_M9H-Mlhh-7alOeQzPCj7GysJZnwpSFGT-M

PA-VM-ESX-7.0.1-u1.ova
https://mega.nz/#!hFs3CY6S!aMuvQCNQpZ3G2mm8GEYXaOdxvOrjGlp13MBeTD_rI88

PA-VM-ESX-7.1.0-u1.ova
https://mega.nz/#!EMlFXJzT!-vwvVjZZzrVnFb-ks7Lh7Xgi5rneVaz2Gdc6AQpthnM

Leave a comment if you think this is useful and let me know if you are looking for any other such links. 

Wednesday 4 January 2017

CCNA Wirelss Notes - Part 1 - Understanding basic wireless theory

In order to understand the CCNA wireless topics it's very essential to go through the following basic wireless physics concepts terms. So I have just added the notes and an image for every term to help to understand the topics better.

Frequency

The number of times the signal makes one complete up and down cycle in 1 second.


Frequency is related to bandwidth as it tells how many cycles per second.


Wavelength

The wavelength is a measure of the physical distance that a wave travels over one complete cycle. Wavelength is usually designated by the Greek symbol lambda (λ). The wavelength decreases as the frequency increases.


Wednesday 20 April 2016

[Fix] GNS3 IOU Error - Error while creating project: Client version 1.3.13 differs with server version 1.3.3


This post will help you to understand why we receive the below error and how to solve it. Even if you get different numbers, this solution will work.

=> Error while creating project: Client version 1.3.13 differs with server version 1.3.3
The IOU VM version number must match with the version number of the GNS3 software. If your IOU VM is running a different version of gns3 than your client, you will get that error message and will have to fix it. You have 2 solutions, One is to degrade your GNS3 to your IOU version. Other one is to upgrade your IOU version to match the GNS3 version.

Solution 1:  Identify the version of your IOU. For example, if it is 1.3.3, you will have to download the same (1.3.3) version of GNS3 as well.

If you want to download a specific version of GNS3, please visit https://github.com/GNS3/gns3-gui/releases.

Solution 2: If you prefer to use a newer version of GNS3, you can upgrade your old IOU VM to the newer version.

This is normal that whenever you upgrade your gns3 you also have to update it on the IOU VM. Its easy, with the IOU VM powered off,  edit its network settings to attach to "NAT" - so it can go out on the internet to update. start the VM, log on as root, pasword cisco and enter the following command:

pip3 install gns3-server==1.3.13
1.3.13 is the version of GNS3 (Use the version that you need), so I want to upgrade my IOU to the same version. Once you run the command, it should download and install the update. all sorts of warnings will flash by the screen but that doesn't matter as long as the last line says something like: "Install of gns3 was sucessful" now to shutdown your vm - use the command

shutdown -h now

once shutdown,  edit its network settings to attach to "Host-only Adapter", fire it up and you should be able to connect to it and use run IOU images (as long as you remembered to upload them to the new IOU VM.

I hope this helps, Let me know your comments.

Monday 5 October 2015

DHCP Starvation (DOS Attack - Penetration Testing) - Example Demonstration with Kali


DHCP Starvation is an attack that works by broadcasting vast numbers of DHCP requests with spoofed MAC addresses simultaneously.



I had showed my topology in the above snap, As you can see I have a router that acts as the DHCP server and a Kali linux 2.0 machine which is connected to the same network. The same steps can be followed to hack a Windows or a Linux DHCP server also. This is how my router's DHCP binding looks before the attempt,

Router (Before Attack)

R1#sh ip dhcp binding 
Bindings from all pools not associated with VRF:
IP address          Client-ID/              Lease expiration        Type
                    Hardware address/
                    User name
R1#

I used yersinia tool to perform the attack, this yersinia comes in built to your Kali operating system. Open terminal, type 'yersinia -G' and press enter.



Click on 'Launch Attack'. Select the tab 'DHCP' and check the second box 'sending DISCOVER packet' and press OK. Within seconds, hundreds of DHCP requests will be sent and the router will be busy handling all our requests and won't be able to handle IP addresses to genuine users. Below logs are taken after the attack,

Router (After Attack)

R1#sh ip dhcp binding 
% The DHCP database could not be locked. Please retry the command later.
R1#
Router couldn't respond, I had taken the below output after 10 mins.

R1#sh ip dhcp binding 
Bindings from all pools not associated with VRF:
IP address          Client-ID/              Lease expiration        Type
                    Hardware address/
                    User name
120.0.0.4           3669.9348.85d1          Mar 01 2002 12:20 AM    Automatic
120.0.0.5           7add.b556.f179          Mar 01 2002 12:20 AM    Automatic
120.0.0.6           347b.0c74.8013          Mar 01 2002 12:20 AM    Automatic
120.0.0.7           f976.c10d.205f          Mar 01 2002 12:20 AM    Automatic
120.0.0.8           b2de.b66b.5b30          Mar 01 2002 12:20 AM    Automatic
120.0.0.9           32cd.4b14.c1f7          Mar 01 2002 12:20 AM    Automatic
120.0.0.10          d0fd.bd17.a548          Mar 01 2002 12:20 AM    Automatic
120.0.0.11          e4be.180a.3fbd          Mar 01 2002 12:20 AM    Automatic
120.0.0.12          559b.e206.ffd0          Mar 01 2002 12:20 AM    Automatic
120.0.0.13          4e64.0231.a81d          Mar 01 2002 12:20 AM    Automatic
120.0.0.14          ac61.c36b.8931          Mar 01 2002 12:21 AM    Automatic
120.0.0.15          763d.5c2f.0d07          Mar 01 2002 12:21 AM    Automatic
120.0.0.16          d738.1831.3ffa          Mar 01 2002 12:21 AM    Automatic
120.0.0.17          0f64.dc31.3bfd          Mar 01 2002 12:21 AM    Automatic
120.0.0.18          beae.bf51.f15b          Mar 01 2002 12:21 AM    Automatic
120.0.0.19          b511.3b23.4732          Mar 01 2002 12:21 AM    Automatic
120.0.0.20          e682.902a.2069          Mar 01 2002 12:21 AM    Automatic
120.0.0.21          d253.6658.b71c          Mar 01 2002 12:21 AM    Automatic
120.0.0.22          11ed.8f0f.f330          Mar 01 2002 12:21 AM    Automatic
 --More-- 

As you can see, all the IPs are assigned to Kali's duplicate DHCP requests. To stop the attack, click on 'List attackts' and Cancel all attacks.

Mitigation

To secure our network from this attack, we have two options.

1) DHCP Snooping
2) Port Security

Cisco IOS Mitigation

To enable DHCP Snooping on a Cisco IOS switch, follow these steps:

switch(config)# ip dhcp snooping
!Enables DHCP Snooping globally!
switch(config)# ip dhcp snooping vlan <vlan_id> {,<vlan_id>}
!Enables DHCP Snooping for Specific VLANs!
switch(config-if)# ip dhcp snooping trust
!Sets the interface to trusted state; can then pass DHCP replies!
switch(config-if)# ip dhcp snooping limit rate <rate>
!Sets rate limit for DHCP Snooping!

To know more about DHCP snooping, visit http://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst6500/ios/12-2SX/configuration/guide/book/snoodhcp.html

Cisco CatOS Mitigation

To mitigate DHCP Starvation attacks with port security on CatOS, use the following:

set port security 5/1 enable
set port security 5/1 port max 1
set port security 5/1 violation restrict
set port security 5/1 age 2
set port security 5/1 timer-type inactivity


Kali 2.0 Post Installation Tips | Kali - GNS3 - Xming | Virtual Ethical hacking Setup


Last month I had posted how to install kali on Vmware workstation, this will be the third post in my Kali linux tutorial series. Here in this post, I will be discussing the recommended post installation tips. Below are the few tips which will be covered in this post,

Installing Vmware tools on Kali 2.0

To install Vmware tools, open terminal and paste below commands one by one, make sure that you have internet connection.

apt-get update

apt-get install -y linux-headers-$(uname -r)

apt-get install open-vm-toolbox

Once you have executed the above commands, reboot your kali machine.

Resolving apt-get repository issues

If for some reason you chose “no” when asked “use a network mirror” during your Kali installation, you may be missing some entries in your /etc/apt/sources.list file.

If that's the case, Add below 4 lines to your sources.list file,

deb http://http.kali.org/kali sana main non-free contrib

deb http://security.kali.org/kali-security sana/updates main contrib non-free
deb-src http://http.kali.org/kali sana main non-free contrib

deb-src http://security.kali.org/kali-security sana/updates main contrib non-free

This will solve your problem with the repositories.

Checking for latest updates

Execute the below commands to update your Kali linux.

apt-get update
apt-get dist-upgrade

Network settings in Kali

You can use ifconfig command to set the IP address and Gateway for your Kali, but these settings will not available after a reboot. If you want permanent network settings, you have to edit '/etc/network/interfaces' file. Here is a sample,

iface eth0 inet static
address 1.1.1.1
mask 255.0.0.0
network 1.0.0.0
gateway 1.1.1.2
dns-nameserver 1.1.1.3

allow-hotplug eth0

Enabling SSH 

To enable SSH on your kali, you have to edit '/etc/ssh/sshd_config' file. Add ListenAddress, make sure to remove the # in the beginning,

ListenAddress 1.1.1.1

Also add # in the below line,

#PermitRootLogin without-password

Start the SSH service by using below commands,
/etc/init.d/ssh start
update-rc.d -f ssh defaults

To Unmute Audio

apt-get install alsa-utils -y

Kali with GNS3 - Simulate network Attacks

I am network engineer, I like playing with networking stuffs. I have GNS3 already installed in my machine. Also by integrating GNS3 and Kali linux, I can simulate various network attacks. I recommend you to install GNS3 as well. Once you have GNS3 installed, connect your router to the VMware adapter of your Kali VM.



Make sure that your router and Kali are pinging each other. You can refer the snapshots below, to get an idea.

Xming

Xming is an application that allows you to display X programs, in your putty. You can download Xming from http://sourceforge.net/projects/xming/. For example, if you want to execute a graphical program on a SSH session, you can use this. I highly recommend to install this as well. Once you have installed Xming in your windows machine, Change the putty settings so that it forwards X11 settings to your Xming application.


Ethical Hacking - Cisco HSRP with Kali linux - Example Demonstration and Security precautions


The Hot Swappable Router Protocol (HSRP) is a way to build redundancy into your network by allowing two or more routers to continuously test each other for connectivity, and take over if a router fails.As multiple routers can participate in the HSRP group, there has to be an election to determine who's the primary router.

This HSRP election is based on a priority value (0 to 255) that is configured on each router in the group. By default, the priority is 100. The router with the highest priority value (255 is highest) becomes the active router for the group. If all router priorities are equal or set to the default value, the router with the highest IP address on the HSRP interface becomes the active router.
In this post, we are going to make our Kali machine a HSRP participant and to become the active router by setting the highest priority to it. Yersinia tool (in built in Kali) helps us to perform this test with ease. For more information on HSRP, please refer RFC 2281

Yersinia

Yersinia is a layer 2- attack toolkit designed to take advantage of weaknesses in various network protocols. One of these protocols is HSRP, with yersinia you can perform below attacks on a HSRP environment.

<0> NONDOS attack sending raw HSRP packet
<1> NONDOS attack becoming ACTIVE router
<2> NONDOS attack becoming ACTIVE router (MITM)

These options are self explanatory, We are going with option 1 in this post.

Hacking HSRP with Kali (or) Backtrack

As illustrated in the snap below, I have crated a simple GNS3 topolgy with 2 HSRP enabled routers and a Kali linux machine which is connected to the same network.

And below are some of the outputs that are taken from the routers. As you can see R1 is acting as the HSRP active router with a priority value of 110 and R2 is the standby router.

Router 1: (Before Attempt)

R1#sh standby br
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Fa0/0       1    110 P Active  local           120.0.0.12      120.0.0.13
R1#sh standby fastEthernet 0/0
FastEthernet0/0 - Group 1
  State is Active
    2 state changes, last state change 00:07:31
  Virtual IP address is 120.0.0.13
  Active virtual MAC address is 0000.0c07.ac01
    Local virtual MAC address is 0000.0c07.ac01 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 1.300 secs
  Preemption enabled
  Active router is local
  Standby router is 120.0.0.12, priority 100 (expires in 7.452 sec)
  Priority 110 (configured 110)
  Group name is "hsrp-Fa0/0-1" (default)

Router 2: (Before Attempt)

R2#sh standby br
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Fa0/0       1    100   Standby 120.0.0.11      local           120.0.0.13
R2#sh stand fa0/0
FastEthernet0/0 - Group 1
  State is Standby
    1 state change, last state change 00:07:09
  Virtual IP address is 120.0.0.13
  Active virtual MAC address is 0000.0c07.ac01
    Local virtual MAC address is 0000.0c07.ac01 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 2.096 secs
  Preemption disabled
  Active router is 120.0.0.11, priority 110 (expires in 9.960 sec)
  Standby router is local
  Priority 100 (default 100)
  Group name is "hsrp-Fa0/0-1" (default)

Let's begin,

Open Terminal window in your Kali machine. Type the below command and press enter,

yersinia -G

This opens the yerginia tool in a Graphical window, the same task can be performed by using interactive text based window also (yersinia -I). In this particular post, we'll go with -G.


Click on 'Launch Attack', Select the HSRP tab.

Note: If you have multiple network adapters in your Kali box, you may have to ensure which interface is selected by default (Click on Edit Interfaces).

As we have already mentioned this gives us three options, we'll go with option 2. Check Option 2 (becoming ACTIVE router), and press OK. A window would appear, you can enter and IP and press OK. This doesn't have to be on same subnet. You can enter any.


That's it, within seconds you'll see your routers becoming standby, your Kali will takeover and become the blackhole in your network.

Below are some of the logs taken after the attack,

Router 1 (After):

R1#
*Mar  1 00:12:43.567: %HSRP-5-STATECHANGE: FastEthernet0/0 Grp 1 state Speak -> Standby
R1#sh standby br              
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Fa0/0       1    110 P Standby 1.1.1.1         local           120.0.0.13

Router 2 (After):

R2#
*Mar  1 00:12:33.587: %HSRP-5-STATECHANGE: FastEthernet0/0 Grp 1 state Standby -> Listen
R2#sh standby br    
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Fa0/0       1    100   Listen  1.1.1.1         120.0.0.11      120.0.0.13

Mitigation:

You have two options to prevent these kind of attacks,

1) Use an ACL to drop HSRP messages from unknown IPs
2) Use HSRP Authentication

To enable HSRP authentication with a MD5 key-chain, enter the following configuration:

(config)# key chain <NAME>
(config-keychain)# key <ID_number>
(config-keychain-key)# key-string <passphrase>
(config-if)# standby 1 authentication md5 key-chain <NAME>

This has to be configured on all HSRP participants, Now when the attacker performs this attack, you'll see below logs on your routers.

%HSRP-4-BADAUTH: Bad authentication from 192.168.0.22, group 1, remote state Active

Access Control Lists (ACLs), are also recommended to mitigate these attacks. By only allowing certain IP addresses to access 224.0.0.2 or 224.0.0.12, it becomes much harder for the attacker to pull off a successful strike. To enable an ACL that sets up these restrictions, use the following:

(config)# interface <interface>
(config-if)# ip access-group 101 in
(config-if)# access-list 101 permit udp host <ip> host 224.0.0.2 eq 1985
(config-if)# access-list 101 deny udp any any eq 1985
(config-if)# access-list 101 permit ip any any

Note: Replace <ip> with a valid host IP address. This line should be used for each router that participates in the HSRP process.
Note: 1985 is the UDP port number that HSRP runs on.

I hope this post is helpful, let me know if you have any queries through comments section.