Information Gathering
What to gather?
To gather:
Infrastructure (Web server, CMS, Database ...)
Application Logic
IP / Domains / Subdomains
Virtual hosts
General steps:
Use whois to find out the possible infrastruture
Use nslookup to find the IP addresses of the domain
Use whois again to find information about the found IP addresses
Use arin.net / whois.domaintools.com / ripe.net to find the ISP
Use Netcraft to do research on the domain
Gathering techniques
Whois
Example sources:
https://whois.domaintools.com
Gather:
Technical information
IP Address (e.g. DNS server)
ISP
DNS
We may use nslookup
:
To query all records:
Infrastructure
Find out the web application type and version (e.g. Apache / IIS).
Fingerprint
Find out:
URL rewriting
Load balancing
Script engine (PHP / Python / Perl / ...)
Method 1: HTTP Response
For example, Apache server may respond with a HTTP header Server: Apache
.
Method 2: Netcraft
Again, you may use https://www.netcraft.com to check the web server analysis.
Method 3: netcat
See if the response has the fields Server
/ X-Powered-By
.
Also, the set-cookie
could also reveal the technology behind. For example:
PHPSESSID
> PHPASPSSESSIONID
> .NETJSESSION
> Java
Method 4: WhatWeb
Method 5: Wappalyzer
This is a browser plugin. When browsing a site, this plugin shows the technology behind.
Fingerprint Webserver Modules
Examples of modules are mod_rewrite and .htaccess in Apache. These handle URL rewriting. Or in IIS, Ionic Isapi Rewrite or Helicon Isapi Rewrite do the same thing.
Enumerate Subdomains
Methods:
Netcraft
Google
Crawling / Brute force
Tools
Zone transfers
Google Method:
TheHarvester
Example:
theharvester -d google.com -b google -l 100 -f ./google-harvester.html
Zone Transfer
On Windows:
Or using dig
:
Find Virtual hosts
Use fierce to find them ...
Frameworks and Applications
Common applications:
Forums (phpBB, vBulletin)
CMS (Joomla, Drupal)
CRM / Blog (WordPress, Moveable types)
Social networking scripts
For the application exact version (which is important when we want to find an exploit of the application), we may:
Browse the website and look at the URL / appearance / logic
Page source: HTML comments / HTTP header
Response Header
For example, in Joomla, the uri is like:
By inspecting the option parameter, we may know the add-on installed.
Custom Applications
When seeing a customized application, ask yourself:
Purpose?
User Registration?
Admin panel?
Does it take inputs from users? What kind of input?
Any file uploads function?
What technology? JS / AJAX / Flash / ...
We could use Burp Suite as a Crawler to enumerate the sitemap. (Note: Spider is no longer free in Burp Suite)
It it always good to draw a logical diagram / flow chart / block diagram to visualize the application flow. After understanding the logic, think about the attack surface. For example:
Client-side validation
SQLi / XSS (could use Firebug to help)
Database Interaction
SQLi
File upload / download
RFI / LFI
Webshell
Display of user supplied data
XSS
Redirections
HTTP response splitting / Header manipulation
Access controls / protected pages
Authentication bypass
Error messages
Sensitive information disclosure
Charting
Draw a table of attack surface for each component
Enumerate Resources
Files / Directory
Spidering in Burp Suite Proxy.
GoBuster / DirBuster
Interesting file extensions:
.bak
_bak
01
001
inc
- include file (ASP)bac
Users
Try to use the error messages to determine whether the user exists.
Tools: Burp Suite / Patator
Relevant Information via Misconfigurations
Directory listing
Logs / Configurations Files
configuration.php
configuration.php.bak
configuration.php.old
HTTP Verbs / File Upload
If a site allowsPUT
method, there is a chance that we can upload something, provided that the directory is writable. To check, first do OPTIONS
method:
Then try:
If the response is 201 Created
, we may try to upload reverse shell! Note that the Content-length
is the request payload that should be calculated.
Google Hacking
Keywords:
intitle:
site:
filetype:"xxx"
"Index of"
"Directory listing for"
Shodan
Last updated