Showing posts with label Tech. Show all posts
Showing posts with label Tech. Show all posts

Monday, August 21, 2017

Common HTTP Status Codes (RFC 2616)


Some of the common HTTP Status codes taken from RFC 2616 which can help penetration testers / cybersecurity analysts / IT Admins are below :



Transaction/Error Status Description
Successful Transactions 200 OK
Successful Transactions 201 Created
Successful Transactions 202 Accepted
Redirected Transactions 301 Moved Permanently
Redirected Transactions 302 Moved Temporarily
Redirected Transactions 304 Not Modified
Client Side Errors 400 Bad Request
Client Side Errors 401 Unauthorised
Client Side Errors 403 Forbidden
Client Side Errors 404 Not Found
Server Side Errors 500 Internal Server Error
Server Side Errors 501 Not Implemented
Server Side Errors 502 Bad Gateway
Server Side Errors 503 Service Unavailable






Sunday, August 20, 2017

Encoded Characters Map to Standard Characters



  •     %3c = <
  •     %20 = (a space character)
  •     %22 = “
  •     %3a = :
  •     %27 = ‘
  •     %2e = .
  •     %2f = /
  •     %3e = >
  •     %5c = \

Sunday, July 16, 2017

Cyber Security - In Reality

Recently I came to know about an incident which forced me to draft my thoughts here on my blog about Attack Surfaces and Attack Vectors. This will also talk about some preventive measures which are basics and should be taken care in the organisation. That said, we should also understand that if someone tells us that his tool/ or he can make our organisations security posture unbreakable and hack proof, please ignore them to start with. Our focus should always be to perform internal assessments and to apply best practices as much as possible to reduce the attack vectors and surfaces, and to have processes to deal with such security incidents. There will always be a new way which the hackers will work out to penetrate the network.

The IT space currently has been under pressure due to cyber attacks and viruses / malware being released leading to huge losses and creating a panic specially for the IT support teams as they were not ready for it. We all should accept that this is now a new normal and instead of pushing the panic button we need to change our strategy and get the people with the right skills to do the job.

I think it was John Chambers who said that "There are two types of companies: those that have been hacked, and those who don't know they have been hacked." and actually I feel that is very true.

I personally am of an opinion that no tool can solve all your issues, you should put the right people on the job, do extensive analysis, change your current processes and ways of work. Tools come in the end. 

Attack Surface 

It is the sum of the different points, the attack vectors, in a given computing device or network that are accessible to an unauthorised user which is called the "Attacker"

  • Classification of Attack Surface

    • Network
      • Open Ports
      • Insecure Protocols
      • Low Bandwidths
      • Multiple users for administrative accounts
    • Software
      • Improper Coding
      • Privacy Settings
      • Opensource Apps without support for patch and releases
    • Physical
      • Internal Employees
      • Rouge Devices
      • Social Engineering
      • Passwords on notebooks / sticky notes / etc
      • Phishing Emails

  • Reducing Attack Surfaces
    • As I mentioned above, attacks are unstoppable
    • We should be focussing on the high risk areas first
    • We will have to deploy advanced techniques and technologies against emerging threats
    • We should perform an internal analysis of the attack surface
    • We should perform an internal vulnerability assessment on the system and software
    • Formulate an security incident response process
    • We should consider deploying Security Incident Management tools e.g. SIEM

  • Areas to Focus
    • Hide vulnerable ports
    • To implement a technique to perform a realtime monitoring of data flows over the network
    • Design and Develop of network infrastructure with recommended security features. Follow security by design.
    • Promptly respond to changes realtime
    • Uninstall / Remove all the unused applications / services from servers
    • Limit the number of users and applications for both performance and security reasons
    • Enforce policies and procedures to everyone in the organisation
    • Cut down on unnecessary requests (emails, database access)
    • Use load balancers, advance firewalls, VLAN's, honeypots to divert the attacker from high value areas

Attack Vectors 

Methods by which a hacker exploits the systems, network and software based on possible attack surfaces. The most common attack vectors are : Viruses, emails, spam, ads and spyware.

  • Classification of Attack Vectors
    • Low Risk - Low threat to the the business / IT environment
    • Medium Risk - Threat with a mitigation workaround available
    • High Risk - Imminent threat to the business / IT environment
  • Examples of Attack Vectors
    • SQL Injection
    • DDoS Attacks
    • Phishing
    • Eaves Dropping
    • Malware Injection
           (I assume that you are aware of the techniques which are specified in the examples above)

  • Preventive Measures
    • Update all the systems / devices with the latest patches
    • Updated Antivirus
    • Deploy Advanced Firewall protection and endpoint security
    • Deploy Honeypots
    • Deploy Load Balancers
    • Enforce appropriate security policies
    • Provide education to the users of the environment
    • Deploy Security Incident Management tools e.g. SIEM

Now with EU GDPR in the mix, it will be even more interesting to see the response by the IT Teams. My advise, don't panic just start working step by step on the points mentioned above and you should be there. Experience in IT and awareness about Cyber Security and Data Protection is all what it  should take.

If anyone is looking for any help you can reach me on : catchme@ashuarunsethi.in, I love to work on new challenges in my free time. 


Thursday, July 21, 2016

Flush / Reset DNS Cache in a Mac OS


You can use the below commands in the terminal to flush DNS / Reset DNS Cache on your macbook / Mac OS :

OS X Yosemite and later ( OS X v10.10.4 or later ):
sudo killall -HUP mDNSResponder

OS X v10.10 through v10.10.3:
sudo discoveryutil mdnsflushcache

OS X Mavericks, Mountain Lion, and Lion (OS X v10.9.5 and earlier):
sudo killall -HUP mDNSResponder

Mac OS X Snow Leopard (OS X v10.6 through v10.6.8):
sudo dscacheutil -flushcache

Saturday, October 24, 2015

Common TCP/IP Ports For Penetration Testers

Some of the ports of interests for penetration testers are :

Port Number Usage ProtocolSome Enumeration Commands and Tools
21 FTP TCP Nmap NSE,
22 SSH TCP,UDP TBD
23 Telnet TCP TBD
25 SMTP TCP Nmap NSE
53 DNS TCP,UDP Nmap NSE, dnsrecon, nslookup
80 HTTP TCP,UDP Nmap NSE, nikto, dirbuster
123 NTP TCP TBD
135 Microsoft RPC TCP,UDP Nmap NSE, 
137 NetBIOS Name Service TCP,UDP Nmap NSE, 
139 NetBIOS Session Service,
Samba (SMB,CIFS)
TCP,UDP Nmap NSE, smbclient
161 SNMP TCP,UDP snmpwalk, onesixtyone
162 SNMP Trap TCP,UDP snmpwalk, onesixtyone
389 LDAP TCP,UDP TBD
443 HTTPS TCP,UDP Nmap NSE, nikto, dirbuster
445 Microsoft-ds TCP Nmap NSE, PsExec, nbtstat
3306 MySQL TCP Nmap NSE, sqlmap
3368 Global Catalogue TCP TBD
3389 RDP TCP TBD
List of Ports and usage


If you have any suggestions, please leave your comments below to add some here..

Monday, September 7, 2015

Convert VMX,VMDK to OVF, OVA Format

Problem Statement :

I recently got a dump of a virtual machine, it was exported from VMWare hence it had the respective .vmdk's, .vmx's.. I work on a mac and use VirtualBox to host VM's. The problem begun when I tried to import the virtual machine to my laptop. You cannot import it using VirtualBox. The other option was to install VMWare player on my laptop for that VM specifically which didn't make much sense. Moreover, You would not get VMWare player free for mac, you would need to either buy VMWare Fusion or download a 30 day trial, which again does not solve my purpose.

So in essence I wanted to covert the available VMWare proprietary files in a format which can be imported on my regular VirtualBox

Fix :

There is a tool available from VMWare called OVFTool which can be used to convert the existing VMWare files in any appropriate format.

You can download this tool from here : https://www.vmware.com/support/developer/ovf/

Steps :
  • Install the OVFTool dmg.
  • Locate the package / binary. For me it was 
/Applications/VMware\ OVF\ Tool/.
  • To make it easier I did mv this folder without spaces,named the folder to "VMWareOVF" 
$sudo mv VMware\ OVF\ Tool/ VMWareOVF
  • Added this in the path variable so that "ovftool" can be run in the shell without giving the path to the command
export PATH=$PATH:/Applications/VMWareOVF/
  • Crosscheck if the path has been updated using the command "env | grep ^PATH"
PATH=/sw/bin:/sw/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/Applications/VMWareOVF/ 
  • "cd" into the folder where the VMWare files are kept. Suppose the vmx file name is "subject.vmx"
  • Create a folder by the name "OVF" where you will keep the converted "ovf" file
  • Give the below command 
$ ovftool subject.vmx OVF/convertedsubject.ovf
  • Once you give this command you would see an output screen showing the progress of the conversion
  • Once you have the converted file, you just need to import the appliance

Hope this helps you. Thanks for the read.

Sunday, August 30, 2015

The Concept of Apache Hadoop Mapreduce 2 or YARN ( Yet Another Resource Negotiator )


Introduction


Comparing to the previous versions of Hadoop, where we had the NameNode and JobTracker daemons on the Master node, MapReduce 2 or YARN was introduced to split the functionalities of JobTracker to specific daemons for resource management and job scheduling.

Comparison



If we see the diagram above, in previous versions of Hadoop, we had the cluster resource management layer tightly coupled and a part of the Mapreduce layer. In Hadoop 2.0, the we see a new layer Yet Another Resource Negotiator (YARN) has been introduced between Mapreduce and HDFS i.e. responsible for cluster resource management. 

To know the reason why this change was needed, let us first recap how it worked in Hadoop 1.0 understanding the downsides as well.


If you follow the figure above, in Hadoop 1.0 , the JobTracker is a part of the MapReduce framework which manages the MapReduce Jobs / Applications along with doing the cluster resource management. Every MapRed job is divided into a number of Map and Reduce tasks, which run on datanodes (slaves) having an assigned or limited number of tasks slots. Having said that JobTracker manages the jobs along with the cluster resource management, JobTracker keeps an account for all these tasks, the predefined task slots on machines, status of the running tasks, resource reporting and management of the cluster, re-firing task jobs incase any of the tasks failed, and finally to clean up temporary resources and release task slots once the task is complete. Additionally, the tightly integrated JobTracker is also one of the reasons why non-MapReduce applications cannot be run on the Hadoop nodes, some e.g. realtime jobs, running ad-hoc queries. Also, there can be only one JobTracker in a cluster, hence we can figure out the load this daemon alone deals with.

To summarise it, MapReduce 2.0 - YARN overcomes the below issues from MapReduce 1 :
  1. Scalability – Since the primary focus of YARN is scheduling, it can manage these huge clusters more efficiently. The ability to process data rapidly increases
  2. Compatibility with existing MapReduce based application–  YARN can easily configure and run the existing MapReduce application without any hindrance or modification in existing processes.
  3. Better Cluster Utilisation – YARN Resource Manager optimizes the cluster utilization as per the given criteria, such as capacity guarantees, fairness, and other Service Level Agreements. 
  4. Support for additional workloads apart from MapReduce – Upcoming programming models such as graph processing and iterative modelings are now a part of data processing. These new models are easily integrated with YARN, which helps the senior management in any organization to realize their real time data and other market trends.
  5. Agility – YARN facilitates the operation of the resource management layer in a more Agile manner.

Components of Mapreduce 2.0 - YARN


As mentioned in the beginning of this blog, YARN has split the JobTrackers responsibility into 2, i.e. Resource Management and Job Scheduling. Yarn achieves that using the below components
  1. Global Resource Manager (RM): This is the root of YARN, and it governs the entire cluster. It has an inbuilt scheduler, uses capacity scheduling by default. This provides resources to all applications running in the cluster. RM interacts with the Node Managers (Point 3 below) and Application Masters (Point 2 below)
  2. Application Master per Application (AM) : The Node Manager initiates the Application master container as instructed by the RM. Application master negotiates appropriate resource containers from RM, track the status and monitor the progress as well. AM is the container that controls the entire application / task.
  3. Node Manager per Node slave (NM) : The NM launches the containers, monitors the CPU, RAM, disk, network etc on the nodes and report it back to the RM to make a judgement call to cater new requests coming in. 
  4. Container per application running on Node manager : In contrast to the previous versions of Hadoop where we allocated slots to task, in MapReduce 2.0 respective NMs allocates resources per node available for an application in form of containers.
I hope this blog may help you clear the concept, will add / update more as it comes.

Cheers.


Sunday, January 25, 2015

Anonymous Browsing : Using ProxyChains

This is one of the ways I use to view some links which are currently blocked by my ISP.

I do all the restricted browsing using Kali Linux. I hope you have heard of this version, you can find more info about this OS >> Here . It is an interesting playground and is bundled with extensive tools which can be used to "explore" the world around you... well be careful while exploring though ;-)

My System :
  • Host Machine : MacBook Air
  • Host OS  : OS X Yosemite (10.10.1)
  • Guest OS : Kali GNU/Linux
  • VM Software : Virtual Box 4.3
Configuring ProxyChains :

  1. ProxyChains work on TOR (Details about TOR : Here ) so you need to check if tor is currently installed and running on the system. There are several ways to do it , 1- 
    • Check if the tor file exists : ls -l /etc/init.d/tor
    • Run this command and see if you you see any active listening ports : 
      • netstat -tanp |grep tor
  2. If ProxyChains is not available, you will have to install the package using the below command:
      • apt-get install tor
  3. Once it is installed, you will have to start the service using the command below :
      • /etc/init.d/tor start
  4. Now you have to check if this has been started properly, and to confirm the port on which it has started. For that you have to re-use the command "netstat -tanp |grep tor", normally this service starts on port 9050
  5. Now once you have TOR all set, some configurations you might want to consider for using proxychains :
    1. open the proxychains.conf : vi /etc/proxychains.conf
    2. Unhash dynamic_chain and random_chain parameters
    3. add new socks4/socks5 proxies, you can get a list from : Here
    4. Make sure you do not remove the loopback address from the proxy list, and the TOR port should be same as the port here
    5. Save and close the file
  6. Now open Firefox, change the proxy settings to 127.0.0.1 and port 9050, save and close
  7. Testing : Open the site www.cmyip.com, you will now be hidden behind some other ip. If it still shows your public IP, there is a problem with your configuration.
  8. Testing : From command line , give the command as below -
    1. proxychains firefox www.cmyip.com , it will show you some other IP. (e.g as the snapshot below, I am not in Netherlands for sure :-D)

Another one, pointing to swiss.. 



I suppose the settings would be the same for other distributions of linux, happy to help if any concerns.


Saturday, January 24, 2015

No Network on XP installed as Guest on VirtualBox

In case you have been searching on the web how to fix your network issues on a recently installed Win XP on a Virtual Box this trick might help you.

My System :

  • Host Machine : MacBook Air
  • Host OS  : OS X Yosemite (10.10.1)
  • VM Software : Virtual Box 4.3
Observations :

  • Under network connections in XP you will not find any local area network or wireless network icon
  • If you go to the device manager on your XP, you will observe there is nothing under network adapters  and you will an unknown network device, which if you uninstall and scan the system again, will end up as unknown again.
  • Generally when you install XP, by default it will pick either a Bridged or a NAT'ed network. Both are fine you don't have to mess with that.
Fix :

  1. Install the VirtualBox guest additions (I expect you know about it, if you are using VB)
  2. Configure the shared folders (In windows XP, accessed the network and browsed for the folder in the network)
  3. Download the driver for Windows XP , Final Release - File name: PRO2K3XP_32.exe - You can download from Here 
  4. Put the downloaded file in the shared folder you created in step 2
  5. Install the file / driver from the Windows XP VM.
  6. And there you are, you will start seeing something happening in the task bar below, the network icon will pop and go, try browsing and you are all set.

Tuesday, January 29, 2013

Missing eth0


You might face issues that when you restart / clone / change nics of your linux box and run the ifconfig command checking interfaces, you will see eth0 missing.

The reason of this is that the old MAC address is cached by the network configurations in some distribution on linux..

The file which has the cached entry is  : /etc/udev/rules.d/70-persistent-net.rules
You can follow the below 2 methods to fix this problem.


  1. Edit the above file, remove the old entry of "eth0" , change "eth1" reference to "eth0"
  2. Move this file in /tmp as a backup, and reboot the system. [ You have a backup, incase this doesn't work,playing safe ]



Sunday, December 30, 2012

Check your NIC Driver in Linux

You may follow the below steps / commands when checking your ethernet drivers etc loaded on your linux box :

1-  You should know your interfaces name, you may use ifconfig command to check that, generally its eth0.

2- To know what driver / make is your network card, give the below command, you will fetch the module name as the output in first coloumn, in below example is e1000

grep eth0 /var/log/dmesg


3- Now you need to check the version of the drivers installed, use the modinfo command, it will show you the output as below :

$modinfo e1000 [Output below is truncated]


To be more specific about the version, you can give command as below :

$modinfo e1000 |grep version


Thursday, March 22, 2012

"sysprep" tool on every Startup

Sysprep tool is "System Preperation Tool" used for deployment of windows PC's. This helps in rolling out installations of windows OS over multiple hosts with minimal intervention of the administrator.

But in some cases where you purchase branded PC's like Dell, HP and you re-install it using recovery disks, when you start using your PC after the complete installation / recovery , you will see the sysprep tool popping up everytime on your screen on every reboot.. which becomes very annoying. You might think to get rid of it using the "msconfig" and removing from startup OR by checking the Start -> Programs -> Startup folder , but that might not help.

A solution which worked for me is as below:


1. Go to Start -> Run -> Regedit
2. First things first, take a backup of your registry.
3. Now go to HKLM -> SYSTEM -> Setup.


4. Double click the "CmdLine" key and make it blank.
5. Similarly edit "AuditInProgress" "FactoryPreInstallInProgress" "SetupType" and make the value "0"
6. Reboot your host.

You should not see the annoying sysprep window now..


The Azure Synapse Resource Provider Error

  If you are get the error " The Azure Synapse resource provider (Microsoft.Synapse) needs to be registered with the selected subscript...