• No results found

Common frameworks

In document OWASP Testing Guide v4 (Page 44-46)

Specific files and folders

Specific files and folders are different for each specific frame- work. It is recommended to install the corresponding framework during penetration tests in order to have better understanding of what infrastructure is presented and what files might be left on the server. However, several good file lists already exist and one good example is FuzzDB wordlists of predictable files/folders (http://code.google.com/p/fuzzdb/).

Tools

A list of general and well-known tools is presented below. There are also a lot of other utilities, as well as framework-based finger- printing tools.

WhatWeb

Website: http://www.morningstarsecurity.com/research/whatweb

Currently one of the best fingerprinting tools on the market. Included in a default Kali Linux build. Language: Ruby Matches for fingerprinting are made with:

• Text strings (case sensitive) • Regular expressions

• Google Hack Database queries (limited set of keywords) • MD5 hashes

• URL recognition • HTML tag patterns The cookie CAKEPHP has automatically been set, which gives in-

formation about the framework being used. List of common cook- ies names is presented in chapter #Cookies_2. Limitations are the same - it is possible to change the name of the cookie. For exam- ple, for the selected CakePHP framework this could be done by the following configuration (excerpt from core.php):

/**

* The name of CakePHP’s session cookie. *

* Note the guidelines for Session names states: “The session name references

* the session id in cookies and URLs. It should contain only al- phanumeric * characters.” * @link http://php.net/session_name */ Configure::write(‘Session.cookie’, ‘CAKEPHP’); GET /cake HTTP /1.1 Host: defcon-moscow.org

User-Agent: Mozilla75.0 |Macintosh; Intel Mac OS X 10.7; rv: 22. 0) Gecko/20100101 Firefox/22 . 0

Accept: text/html, application/xhtml + xml, application/xml; q=0.9, */*; q=0 , 8

Accept - Language: ru-ru, ru; q=0.8, en-us; q=0.5 , en; q=0 . 3 Accept - Encoding: gzip, deflate

DNT: 1 Cookie: CAKEPHP=rm72kprivgmau5fmjdesbuqi71; Connection: Keep-alive Cache-Control: max-age=0 Framework Zope CakePHP Laravel %framework_name% powered by built upon running Framework Adobe ColdFusion Microsoft ASP.NET ZK Business Catalyst Indexhibit Cookie name BITRIX_ AMP django Keyword <!-- START headerTags.cfm __VIEWSTATE <!-- ZK <!-- BC_OBNW --> ndxz-studio HTML source code General Markers Specific markers Cookies

Another similar and somehow more reliable way to determine the current web framework are framework-specific cookies.

Consider the following HTTP-request:

However, these changes are less likely to be made than changes to the X-Powered-By header, so this approach can be considered as more reliable.

HTML source code

This technique is based on finding certain patterns in the HTML page source code. Often one can find a lot of information which helps a tester to recognize a specific web framework. One of the common markers are HTML comments that directly lead to framework disclosure. More often certain framework-specific paths can be found, i.e. links to framework-specific css and/or js folders. Finally, specific script variables might also point to a cer- tain framework.

From the screenshot below one can easily learn the used frame- work and its version by the mentioned markers. The comment, specific paths and script variables can all help an attacker to quickly determine an instance of ZK framework.

• Custom ruby code for passive and aggressive operations

Sample output is presented on a screenshot below:

BlindElephant

Website: https://community.qualys.com/community/blindelephant

This great tool works on the principle of static file checksum based version difference thus providing a very high quality of fingerprint- ing. Language: Python

Sample output of a successful fingerprint:

Wappalyzer

Website: http://wappalyzer.com

Wapplyzer is a Firefox Chrome plug-in. It works only on regular ex- pression matching and doesn’t need anything other than the page to be loaded on browser. It works completely at the browser level and gives results in the form of icons. Although sometimes it has false positives, this is very handy to have notion of what technol- ogies were used to construct a target website immediately after browsing a page.

Sample output of a plug-in is presented on a screenshot below.

References Whitepapers

• Saumil Shah: “An Introduction to HTTP fingerprinting” - http:// www.net-square.com/httprint_paper.html

• Anant Shrivastava : “Web Application Finger Printing” - http:// anantshri.info/articles/web_app_finger_printing.html

Remediation

The general advice is to use several of the tools described above and check logs to better understand what exactly helps an attack- er to disclose the web framework. By performing multiple scans after changes have been made to hide framework tracks, it’s pos- sible to achieve a better level of security and to make sure of the framework can not be detected by automatic scans. Below are some specific recommendations by framework marker location and some additional interesting approaches.

HTTP headers

Check the configuration and disable or obfuscate all HTTP-head- ers that disclose information the technologies used. Here is an interesting article about HTTP-headers obfuscation using Net- scaler: http://grahamhosking.blogspot.ru/2013/07/obfuscat- ing-http-header-using-netscaler.html

Cookies

It is recommended to change cookie names by making changes in the corresponding configuration files.

HTML source code

Manually check the contents of the HTML code and remove every- thing that explicitly points to the framework.

General guidelines:

• Make sure there are no visual markers disclosing the framework pentester$ python BlindElephant.py http://my_target drupal

Loaded /Library/Python/2.7/site-packages/blindelephant/ dbs/drupal.pkl with 145 versions, 478 differentiating paths, and 434 version groups.

Starting BlindElephant fingerprint for version of drupal at http://my_target

Hit http://my_target/CHANGELOG.txt

File produced no match. Error: Retrieved file doesn’t match known fingerprint. 527b085a3717bd691d47713dff74acf4 Hit http://my_target/INSTALL.txt

File produced no match. Error: Retrieved file doesn’t match known fingerprint. 14dfc133e4101be6f0ef5c64566da4a4 Hit http://my_target/misc/drupal.js

Possible versions based on result: 7.12, 7.13, 7.14 Hit http://my_target/MAINTAINERS.txt

File produced no match. Error: Retrieved file doesn’t match known fingerprint. 36b740941a19912f3fdbfcca7caa08ca Hit http://my_target/themes/garland/style.css

Possible versions based on result: 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 7.10, 7.11, 7.12, 7.13, 7.14

...

Fingerprinting resulted in: 7.14

• Remove any unnecessary comments (copyrights, bug information, specific framework comments)

• Remove META and generator tags

• Use the companies own css or js files and do not store those in a framework-specific folders

• Do not use default scripts on the page or obfuscate them if they must be used.

Specific files and folders General guidelines:

• Remove any unnecessary or unused files on the server. This implies text files disclosing information about versions and installation too.

• Restrict access to other files in order to achieve 404-response when accessing them from outside. This can be done, for example, by modifying htaccess file and adding RewriteCond or RewriteRule there. An example of such restriction for two common WordPress folders is presented below.

However, these are not the only ways to restrict access. In order to automate this process, certain framework-specific plugins exist.

One example for WordPress is StealthLogin (http://wordpress.org/

plugins/stealth-login-page).

Additional approaches General guidelines: [1] Checksum management

The purpose of this approach is to beat checksum-based scanners and not let them disclose files by their hashes. Generally, there are two approaches in checksum management:

• Change the location of where those files are placed (i.e. move them to another folder, or rename the existing folder) • Modify the contents - even slight modification results in a

completely different hash sum, so adding a single byte in the end of the file should not be a big problem.

[2] Controlled chaos

A funny and effective method that involves adding bogus files and folders from other frameworks in order to fool scanners and con- fuse an attacker. But be careful not to overwrite existing files and folders and to break the current framework!

Fingerprint Web Application

In document OWASP Testing Guide v4 (Page 44-46)

Outline

Related documents