Deny ICMP Ping on Outside Dialer Interface (Cisco Router)

cisco logo

How to guide to stop and deny icmp ping replies on the outside dialer interface on a Cisco router using access lists.

Deny ICMP Ping on Outside Dialer Interface for a Cisco Router

I am a firm believer of “if you don’t need it, turn it off”, icmp ping is no exception. Doing such reduces the surface area of attack, as most port scanners initially ping the target to see if there is a replying host at the other end. I configured my Cisco router to deny icmp on the “Dialer0” interface, you might need to tweak this to suit your access lists and WAN interface.

Leaving this feature on does give you extra troubleshooting abilities should you need it, don’t disable it if you do use the ping against your router to see if its up.

  • Shell on to the router or connect using a console cable.

Run all commands without the “#”

  1. #en
  2. #configure terminal
  3. #access-list 101 deny icmp any any echo
  4. #access-list 101 permit ip any any
  5. #interface dialer0
  6. #ip access-group 101 in
  7. #exit
  8. #exit

Now test to see whether an icmp packet is turned when pinging from a different internet connection.

Ping

Should you be happy with the configuration, simply run the following commands:

  1. #en
  2. #configure terminal
  3. #copy running-config startup-config
  4. #exit

If you want to revert to previous config you can either reload the router to clean the changes or reverse the changes manually:

To revert to previous configuration past this point.

To reverse the changes, simply remove “ip access-group 101 in” from the dialer interface by running the following commands:

  1. #en
  2. #configure terminal
  3. #interface dialer0
  4. #no ip access-group 101 in
  5. #exit
  6. #exit

To clean up the unused access lists:

  1. #en
  2. #configure terminal
  3. #no access-list 101 deny icmp any any echo
  4. #access-list 101 permit ip any any
  5. #exit

If you have any questions or suggestions, please feel free to comment in the comments below.

Exporting Citrix XenApp Applications to file

citrix-logo

 

How to export Citrix XenApp applications

I have had to rebuild a Citrix XenApp farm in the past, which was a long process of building the server, installing Citrix XenApp, installing the applications and republishing the applications in Citrix. I found one of the longest parts of the process is publishing all the applications from scratch. You might have “tweaked” certain settings or have a long list of access controls which can be annoying to set back up again.

A quick way to capture those settings is by exporting the published application to file so you have the ability to import later on.

  1. Log into Citrix AppCenter
  2. Expand “Applications”
  3. Locate the applications(s) you wish to export
  4. Right click -> Other Tasks -> Export Application settings to file -> Entire ApplicationExport Application
  5. Choose a location (create folders based on your Citrix folders)

You should end up with %application%.app

A good folder path to use would be /%farm name%/%folder%/%application%.app

If you only want to export the server list of the application (not sure why you would only want to do that) then right click on the application, go down to “other tasks” then “export application settings to a file” and click on “Server list only”. You will be prompted with a save as box with a location to save the file with the extension “asl”.

Obviously to import the applications back into Citrix XenApp from a .app file is to right click on the folder you wish to import the application into, move down to “other tasks” and click on “import new applications from file”.

You will once again, see your application with all settings imported into the folder you right clicked on.

This should be a fairly easy guide to follow, should you have any questions, comments or suggestions, please don’t hesitate to comment below. If you like what you have read, please share it on your favourite social media medium.

Secure Administrator account in Active Directory

MS Logo

Securing the Administrator account in Active Directory

You may be thinking this should be common knowledge but time and time again I see directories with the Administrator account still in the “Domain Admins” group and active!

Before you do this, ensure you are not using the domain administrator account for authenticating!

I always follow a simple step process to securing the Administrator account:

  1. Remove from “Domain Admins” group
  2. Rename the account
  3. Move the account to a different folder within Active Directory folders OU’s
  4. Change the password to 56 character set
  5. Disable account (you cannot remove it)
  6. Create a new account

Before you can remove the domain admins group you will need to add the domain users group and set it as the primary group.

When renaming the account, you can simply right click on the account and click “rename”. I usually change this to something obscure to make it harder to know it was the administrator account in the past. This doesn’t stop someone trying to attack it as it could be traced back to the SID as all administrator account SIDs end with a 500.

Keepass Password Generator

Password generation in KeePass

I highly recommend using a random password generator for changing the password, for my example I use the one inbuilt into KeePass. I have used every type of character possible with a 56 character length giving a total of 282bits of encryption goodness.

Don’t worry, I didn’t actually use this password!

When creating a new account, try and come up with a name that hasn’t been used before, so before you think sysadmin is a name, don’t, other people use it!

This might not be full proof but it will deter most attacks unless someone is targeting you for a particular reason.

“You can never completely defend against an attack but you can make it so hard for the attacker that they will change the target to something easier”

Should you have any questions, comments or suggestions, please don’t hesitate to comment below. If you like what you have read, please share it on your favourite social media medium.

Setting up BackTrack 5 R3


Backtrack_5_Black

Setting up BackTrack 5 R3

Out of the box you might find that BackTrack 5 doesn’t give you some basic services, this is just a quick note on how to make things work.

Run all commands without the “#”

Update Packages

#apt-get update
#apt-get upgrade

Enable SSH Keys

Generate SSH Keys

#sshd-generate

AutoStart SSH

#update-rc.d ssh defaults

Change Root Password

By default the password is “toor”, you should change this!

#passwd

Install VM-Tools

These commands will only work if you have deployed BackTrack on a VMware virtualised environment

Initiate VMtools deployment from the virtualisation console

Replace VMwareTools-#.#.#-#.tar.gz with the actual package name

#mkdir -p /mnt/vmtools
#mkdir -p /mnt/vmtools/extract
#mount /dev/cdrom /mnt/vmtools
#tar -xvf VMwareTools-#.#.#-#.tar.gz /mnt/vmtools/extract
#cd /mnt/vmtools/extract
#./install

Follow prompts and reboot

Packages

Packages can be found in the /pentest folder

Should you have any questions, comments or suggestions, please don’t hesitate to comment below. If you like what you have read, please share it on your favourite social media medium.

Reference guide to basic Telnet Commands

Reference guide to basic Telnet Commands

Occasionally you might need to test a mail server manually using Telnet and SMTP commands.

Before running Telnet you might need to install it (Microsoft Windows 7 and above) by following either three of the following steps:

By Command Prompt

  1. Open a command prompt
  2. type “appwiz”
  3. Click on “Turn Windows features on or off”
  4. Click on “Telnet Client” and click OK

By Windows

  1. Open Control Panel
  2. If view by “Category” Click on “Get Programs” under “Programs”
  3. If view by “Small icons” Click on “Programs and Features”
  4. Click on “Telnet Client” and click OK

Other Versions of Windows

http://technet.microsoft.com/en-us/library/cc771275(v=ws.10).aspx

This is great for troubleshooting a SMTP mail server as the process of sending an email can come up with errors along the way that a fat mail client might hide from you.

HELO <hostname>    =          This command initiates the SMTP conversation. The host connecting to the remote SMTP server identifies itself by its fully qualified domain name.

EHLO                          =          An alternative command for starting the conversation. This states that he sending server wants to use the extended SMTP (ESMTP) protocol.

MAIL FROM:              =          This is the start of an email message. The source email address is what will appear in the “from” field of the message

RCPT TO:                   =          This identifies the recipient of the email message. This command can be repeated multiple times for a given message in order to deliver a single message to multiple recipients.

DATA                          =          This command signifies that a stream of data, i.e the email message body will follow. The stream of data is terminated by a “.” on a line by itself.

“.”                                 =          To end the body of the message, type a full stop on a single line by itself.

QUIT                           =          Quits out of the Telnet session

Example

telnet, smtp, example

Summary

Should you have any questions, comments or suggestions, please don’t hesitate to comment below. If you like what you have read, please share it on your favourite social media medium.

How to deploy, configure and troubleshoot Postfix on Debian 7 (Wheezy)

Linux logo

How to deploy, configure and troubleshoot Postfix on Debian 7 (Wheezy)

Postfix is a free, open source mail transfer agent (MTA) that routes and delivers electronic mail.

I recently decided it might be a good idea to deploy the package in my own local network as it is a central point of configuration to an upstream SMTP server. This will come in handy later on should I decide to physically relocate my hardware and at the same time change my internet service provider.

Run commands without the “#” at the beginning.

Installing

  1. #su – root
  2. #apt-get update
  3. #apt-get upgrade
  4. #apt-get install postfixPostfix Installation 1Postfix Installation 2

Configuring SMTP Authentication to Smarthost

If your upstream SMTP host requires SMTP authentication, you will need to create a password file and add it to /etc/postfix/main.cf configuration file.
Ignore if not required

  1. #cd /etc/postfix
  2. #vi password

Add the following line
smtp.relay.com                                [email protected]:password

  • The first part needs to be the upstream SMTP server, this example is smtp.relay.com, separate by tab and type your username, add a “:” and type your password
  1. #chown root:root password
  2. #chmod 0600 password
  3. #postmap hash:password

Configuring

#vi /etc/postfix/main.cfmain.cf

Change:

  1. “relayhost” to your smart host upstream
  2. “inet_interfaces =” to all

Add:

  1. mynetworks = Add network address of internal network
  2. smtp_sasl_auth_enable = yes
  3. smtp_sasl_password_maps = hash:/etc/postfix/password
  4. smtp_sasl_security_options =
    :wq

Finishing Setup

#postfix check
#postfix reload
#netstat –tannetstat

Check to see Local Address of “0.0.0.0:25” is in a state of “LISTEN”

Troubleshooting

Check to see if postfix is running by executing the following command:

  1. #ps aux | grep postfix
Postfix Process

Open a second terminal and monitor the mail.log file while in another session telnet to the Postfix server on port 25 and attempt to send a message manually

  1. #tail –f /etc/log/mail.log

This is an example of a successful sent email

mail

 Conclusion

Should you have any questions, comments or suggestions, please don’t hesitate to comment below. If you like what you have read, please share it on your favourite social media medium.

How to stress test websites with ApacheBench

Linux logo

.

How to stress test websites with ApacheBench

Okay so you have a Microsoft IIS or Apache web server, you placed a website on it and want to know if it will “fall over” under load, well I have just the tool for that!

ApacheBench (aka AB) is a stress testing tool part of Apache, it is fully configurable tool to allow you to specify the amount of attempts on the web server and the amount of concurrent connections.

ApacheBench is part of the Apache installation so simply installing Apache2 will give you access to the tool.

To install Apache, run the following:

#apt-get install apache2

The tool requires three switches in order to work, they are the following:

  1. -c
    1. Concurrent connections. How many connections at once. The more the harder it will be stressed.
  2. -n
    1. The number of connection attempts in total. The more, the longer it will run
  3. http://address/
    1. The website address to stress test. If stressing the root of the address a trailing “/” is required after the address. e.g http://domain.com/

Depending on hardware, software and network/internet configurations, you might not be able to stress the website to the max and might end up with all types of errors when running “ab”.

I recommend looking at also using two other switches:

  1. -k
    1. Keepalive. This can be helpful if the connection drops out half way through a stress test.
  2. -r
    1. Don’t exit on socket receive error. This is probably the more important of the two additional switches and can resolve a lot of problems.

This tool can be used in two ways, for good or for bad. A denial of service can be run against a server to purposefully overload the connections to the point the server will reject any new connections.

An example of running Apachebench can be seen in the screenshot below:

ab, apachebench

This is an example of running apachebench

Examples of running ApacheBench:

  • ab -n 1000 -c 100 http://domain.com/
  • ab -n 10000 -c 1000 -k -r http://domain.com/index.html
  • ab -n 10000 -c 1000 -k -r http://domain.com/about.html

Happy stressing!

Should you have any questions, comments or suggestions, please don’t hesitate to comment below. If you like what you have read, please share it on your favourite social media medium.

How to mount cifs file systems in Linux

linux, organisation, website

Step by step guide on mount file systems in Linux distributions

File systems hosted on other platforms such as Microsoft Windows are accessible on the Linux and Unix platform by simply using the mount command.

Mounting

The procedure requires elevated privileges and a minimum of read access to the share you are connecting to.

mkdir -p /mnt/share
mount -t cifs //server/share -o domain=domain,username=username,password=password /mnt/share

-f cifs = filesystem type to mount using
//server/share = change this to your server name and share name
domain=domain (change this to your domain name, if none, remove)
username=username = change to the username to use on the server hosting the share
password=password = change to the password for the username specified

Testing

To check to see if it mounted, run the following command

df -h

Should you have any questions, comments or suggestions, please don’t hesitate to comment below. If you like what you have read, please share it on your favourite social media medium.

How to break WPA2 key with Reaver WPS Attack

backtrack, bt

How to break WPA2 key with Reaver WPS Attack

When routers are enabled with WPS (aka Wi-Fi Protected) they are anything but “protected”, the way WPS works is by a eight digit key exchange between device and router. The key exchange is not encrypted and can be “brute forced” exposing the WPA or WPA2 wireless encryption key.

WPS lets you use push buttons or PINS instead of entering a network name (SSID) and a wireless security key by hand.

With the right hardware and software, this attack can be setup in minutes and take no more than a day to expose the key, or in my case just set and forget until the next morning.

I bought a new router and changed the firmware to DD-WRT so I could turn this “feature” off, it doesn’t matter how strong your WPA key is, it comes down to a eight digit string.

One important note to take from this is that once you find out the eight digit key from the router, if the WPA key is changed on the router it can be cracked in seconds as the WPS PIN doesn’t change.

To successfully do this, you will need the following:

  1. BackTrack 5 R3
  2. ALFA USB Wifi AWUSO36NHAAWUS036NHA
  3. Reaver

Reaver comes with Backtrack 5 R3, the ALFA USB Wifi adapter is not “needed” but if you don’t have a compatible wireless adapter to use in BackTrack you might be unsuccessful.

If you want to run Reaver without it being on BackTrack, install it using the following commands:

Run all commands without the “#” at the front

  1. #apt-get update
  2. #apt-get upgrade
  3. #apt-get install reaver aircrack-ng

To tweak the attack with switches you can run “reaver” which will output the following:reaver help

  1. Shell into BackTrack 5
  2. #su – rootSwitch User
  3. #iwconfigiwconfig
  4. #airmon-ng start wlan0airmon-ng start
  5. #airodump-ng mon0airodump
  6. #reaver -i mon0 -b 01:AA:02:CC:03:DD -vvreaver attack in progress
  7. Result! (I reused the pin from an old succesful attempt)result

Diagnosing the problem(s) can be helped by using the –vv switch, it will show you step by step what the current action and result is.

If you are getting unexpected results, I highly suggest using the following switches:

  • -d 5 (add a delay to allow the router to recover)
  • -w (act as a Windows 7 operating system)
  • -c ## (lock to the actual channel of the router to prevent channel bouncing)
  • -a (auto detect the best advanced settings to use on the router)
  • –dh-small (instructs Reaver to use small diffie-hellman secret numbers to reduce the load on the router)

To scan all routers to see if they are vulnerable you can run the following command:

  1. #wash -i mon0wash

The whole process can take between 4-10 hours unless you are lucky and the router has a “default” PIN, which Reaver will try first.

Happy crackin’

Should you have any questions, comments or suggestions, please don’t hesitate to comment below. If you like what you have read, please share it on your favourite social media medium.