Directory Traversal and Source code disclosure vulnerability


 (What's the main issue in the application?)

The web server exposes a Source Code via version control system - Git.

The Directory Listing feature that was enabled on the server side is discloses the directories that stores sensitive files that are related to the Source Code

(Who can access? What are the possible risks)

An external attacker may download the source code and disclose sensitive information regarding the development and possibly other sensitive data.

In the application I found two ways of disclosing source code.

Instance#1:

After performing nikto I found directories as shown 

An attacker may use automated tools to discover, download and extract git repositories. https://github.com/internetwache/GitTools



Note: Due to the fact that the server has Directory Listing feature enabled, makes even easier to download the git repositories using simple wget command. wget --mirror -I .git TARGET.COM/.git/

Instance#2: 

The attacker may run Directory Fuzzing attack and disclose directories that stores sensitive files.

/backend 

/test

/frontend

/test directory stores server.js file./frontend directory stores different files and backup files.
Recommendations: 
(Tips for mitigating the issue.)

Either remove the git folder from your webserver or ensure that you deny all access to the .git folders.
Disable Directory Listing on the server.
Disable unprotected HTTP protocol and enable HTTPS protocol only.

References:
https://en.internetwache.org/dont-publicly-expose-git-or-how-we-downloaded-your-websites-sourcecode-an-analysis-of-alexas-1m-28-07-2015/






Comments

Popular posts from this blog

File Upload Security Testing Checklists

SAML Security Test Cases

Drozer - A Framework for Android Application Security Assessment.