Final Report
Final Report
As many Web applications are developed daily and used extensively. It becomes important for developers and
testers to improve these application securities. Pen testing, is a technique that helps developers and testers to
ensure that the security levels of their Web application are at acceptable level to be used safely. Different tools
are available for pen testing Web application; in this paper we have used many tools like
dirb,dirbuster,nmap,nikto and burpsuit etc for the enumeration of vulnerabilities in the given Web site -
http://testphp.vulnweb.com/
Reconnaissance
Host Discovery
One of the very first steps in any network reconnaissance mission is to reduce a (sometimes huge) set of IP
ranges into a list of active or interesting hosts. Scanning every port of every single IP address is slow and
usually unnecessary. Of course what makes a host interesting depends greatly on the scan purposes. Network
administrators may only be interested in hosts running a certain service, while security auditors may care about
every single device with an IP address. An administrator may be comfortable using just an ICMP ping to locate
hosts on his internal network, while an external penetration tester may use a diverse set of dozens of probes in
an attempt to evade firewall restrictions.
Nmap
Nmap is a network mapper that has emerged as one of the most popular, free network discovery tools on the
market. Nmap is now one of the core tools used by network administrators to map their networks. The program
can be used to find live hosts on a network, perform port scanning, ping sweeps, OS detection, and version
detection.
A number of recent cyberattacks have re-focused attention on the type of network auditing that Nmap provides.
Analysts have pointed out that the recent Capital One hack, for instance, could have been detected sooner if
system administrators had been monitoring connected devices.
Web Server Scanning with Nikto Scanner
There is a number of online vulnerability scanner to test your web applications on the Internet. However, if you
are looking to test Intranet applications or in-house applications, then you can use the Nikto web scanner.
Nikto is an open-source scanner and you can use it with any web servers (Apache, Nginx, IHS, OHS, Litespeed,
etc.). Sounds like a perfect in-house tool for web server scanning. It is capable of scanning for over 6700
items to detect misconfiguration, risky files, etc. and some of the features include;
It supports SSL
Find subdomain
DIRB comes with a set of preconfigured attack wordlists for easy usage but you can use your custom wordlists.
Also DIRB sometimes can be used as a classic CGI scanner, but remember is a content scanner not a
vulnerability scanner.
DIRB main purpose is to help in professional web application auditing. Specially in security related testing. It
covers some holes not covered by classic web vulnerability scanners. DIRB looks for specific web objects that
other generic CGI scanners can’t look for. It doesn’t search vulnerabilities nor does it look for web contents that
can be vulnerable.
GOBUSTER
Some of the directories and files found during dirbuster scan in the given website are as follows: -
/images/
/admin/
/pictures/
/AJAX/
/Mod_Rewrite_Shop/
/hpp/
/Flash/
/Mod_Rewrite_Shop/images/
/secured/
/cgi-bin/
/index.php
/search.php
/login.php
/product.php
/disclaimer.php
/signup.php
/categories.php
/cart.php
/artists.php
/guestbook.php
/AJAX/index.php
/Mod_Rewrite_Shop/index.php
/Flash/add.swf
/hpp/index.php
/AJAX/categories.php
/Mod_Rewrite_Shop/buy.php
/Mod_Rewrite_Shop/details.php
/logout.php
/hpp/test.php
/404.php
/AJAX/titles.php
/Mod_Rewrite_Shop/rate.php
/AJAX/artists.php
/hpp/params.php
/secured/index.php
/comment.php
/userinfo.php
/redir.php
DIRBUSTER
One of the first steps in attacking a web application is enumerating hidden directories and files. Doing so
can often yield valuable information that makes it easier to execute a precise attack, leaving less room for
errors and wasted time. There are many tools available to do this, but not all of them are created equally.
Gobuster, a directory scanner written in Go, is definitely worth exploring.
The main advantage Gobuster has over other directory scanners is speed. As a programming language, Go is
known to be fast. It also has excellent support for concurrency so that Gobuster can take advantage of
multiple threads for faster processing.
The one downfall of Gobuster, though, is the lack of recursive directory searching. For directories more than
one level deep, another scan will be needed, unfortunately. Often this isn't that big of a deal, and other
scanners can step up and fill in the gaps for Gobuster in this area.
PHP VERSION
url:
http://testphp.vulnweb.com/secured/phpinfo.php
Sensitive informations:
This page may output a large amount of information about the current state of PHP using phpinfo() function.
This includes information about PHP compilation options and extensions, the PHP version, server information
and environment (if compiled as a module), the PHP environment, OS version information, paths, master and
local values of configuration options, HTTP headers, and the PHP License. Remediation Remove the file from
production systems.
Virtual
Directory
Support Disabled
Configuration
File (php.ini)
Path /usr/local/etc/php.ini
additional .ini
files parsed /usr/local/etc/php/extensions.ini
PHP
Extension 20050922
Zend
Extension 220051025
Debug Build No
Zend Memory
Manager Enabled
Registered
PHP Streams php, file, http, ftp, https, ftps, compress.zlib
Registered
Stream Socket
Transports tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
PHP Credits
Configuration
PHP Core
allow_call_time_pass_refere
nce On On
allow_url_fopen On On
always_populate_raw_post_
data Off Off
auto_globals_jit On On
display_errors On On
enable_dl On On
expose_php On On
/ /
usr/local/lib/php/200509 usr/local/lib/php/200509
extension_dir 22 22
file_uploads On On
html_errors On On
include_path .: .:
max_execution_time 30 30
max_input_time 60 60
memory_limit 8M 8M
post_max_size 8M 8M
precision 12 12
register_argc_argv On On
register_long_arrays On On
report_memleaks On On
report_zend_debug On On
short_open_tag On On
smtp_port 25 25
upload_max_filesize 2M 2M
xmlrpc_error_number 0 0
y2k_compliance On On
apache2handler
Apache Apache/2.2.3 (FreeBSD) DAV/2 PHP/5.1.6 mod_ssl/2.2.3
Version OpenSSL/0.9.7e-p1
Apache API
Version 20051115
Server
Administrator [email protected]
Hostname:Port acuart:0
User/Group www(80)/80
Max Requests Per Child: 10000 - Keep Alive: on - Max Per Connection: 100
engine 1 1
last_modified 0 0
xbithack 0 0
ctype
ctype functions Enabled
curl
CURL support Enabled
dom
DOM/XML Enabled
exif
EXIF Support Enabled
Supported EXIF
Version 0220
ftp
FTP support Enabled
gd
GD Support Enabled
libxml
libXML support Active
mssql
MSSQL Support enabled
Active Links 0
mysql
MySQL Support enabled
Active Links 0
MYSQL_MODULE_TYPE no value
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_INCLUDE no value
MYSQL_LIBS no value
mysql.allow_persistent On On
mysql.connect_timeout 60 60
openssl
OpenSSL support Enabled
posix
Revision $Revision: 1.70.2.3 $
Reflection
Reflectio
n Enabled
$Id: php_reflection.c,v 1.164.2.33 2006/03/29 14:28:42 tony2001
Version Exp $
session
Session Support Enabled
session.bug_compat_42 On On
session.bug_compat_warn On On
session.cookie_lifetime 0 0
session.cookie_path / /
session.entropy_length 0 0
session.gc_probability 1 1
session.hash_bits_per_character 4 4
session.hash_function 0 0
session.use_cookies On On
session.use_trans_sid 0 0
SQLite
SQLite support Enabled
sqlite.assoc_case 0 0
standard
Regex Library Bundled library enabled
assert.active 1 1
assert.bail 0 0
assert.quiet_eval 0 0
assert.warning 1 1
auto_detect_line_
endings 0 0
default_socket_ti
meout 60 60
safe_mode_allow
ed_env_vars PHP_ PHP_
safe_mode_prote
cted_env_vars LD_LIBRARY_PATH LD_LIBRARY_PATH
a=href,area=href,frame=src,in a=href,area=href,frame=src,in
url_rewriter.tags put=src,form=,fieldset= put=src,form=,fieldset=
xml
XML Support active
xmlreader
XMLReader Enabled
xmlwriter
XMLWriter Enabled
xsl
XSL enabled
EXSLT enabled
Additional Modules
Module Name
Environment
Variable Value
LD_LIBRARY_PATH /usr/local/lib:
HOME /
PATH /sbin:/bin:/usr/sbin:/usr/bin
PHP Variables
Variable Value
_SERVER["HTTP_HO
ST"] Acuart
_SERVER["HTTP_AC text/xml,application/xml,application/xhtml+xml,text/h
CEPT"] tml;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
_SERVER["HTTP_AC
CEPT_LANGUAGE"] en-us,en;q=0.5
_SERVER["HTTP_AC
CEPT_ENCODING"] gzip,deflate
_SERVER["HTTP_AC
CEPT_CHARSET"] ISO-8859-1,utf-8;q=0.7,*;q=0.7
_SERVER["HTTP_KEE
P_ALIVE"] 300
_SERVER["HTTP_CO
NNECTION"] keep-alive
_SERVER["PATH"] /sbin:/bin:/usr/sbin:/usr/bin
_SERVER["SERVER_S
IGNATURE"] no value
_SERVER["SERVER_
NAME"] Acuart
_SERVER["SERVER_
ADDR"] 192.168.0.5
_SERVER["SERVER_P
ORT"] 80
_SERVER["REMOTE_ 192.168.0.26
ADDR"]
_SERVER["DOCUME
NT_ROOT"] /var/www/acuart/
_SERVER["SERVER_
ADMIN"] [email protected]
_SERVER["SCRIPT_FI
LENAME"] /var/www/acuart/secured/phpinfo.php
_SERVER["REMOTE_
PORT"] 11493
_SERVER["GATEWA
Y_INTERFACE"] CGI/1.1
_SERVER["SERVER_P
ROTOCOL"] HTTP/1.1
_SERVER["REQUEST
_METHOD"] GET
_SERVER["QUERY_S
TRING"] no value
_SERVER["REQUEST
_URI"] /secured/phpinfo.php
_SERVER["SCRIPT_N
AME"] /secured/phpinfo.php
_SERVER["PHP_SELF
"] /secured/phpinfo.php
_SERVER["REQUEST
_TIME"] 1201867164
_SERVER["argv"] Array
_SERVER["argc"] 0
_ENV["LD_LIBRARY_
PATH"] /usr/local/lib:
_ENV["HOME"] /
_ENV["PATH"] /sbin:/bin:/usr/sbin:/usr/bin
PHP License
This program is free software; you can redistribute it and/or modify it under the
terms of the PHP License as published by the PHP Group and included in the
distribution in the file: LICENSE
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If you did not receive a copy of the PHP license, or have any questions about
PHP licensing, please contact [email protected].
WEB VULNERABILITIES
On scanning the given website we founded many web vulnerabilities some are listed below
1.SQL INJECTION
Description: - SQL Injection (SQL) is a type of web application vulnerability where an attacker can manipulate
and submit a SQL command to retrieve the database information. This type of attack mostly occurs when a web
application executes by using the user-provided data without validating or encoding it.
This attack can give access to sensitive information like customer information credit card numbers, trade secrets,
personal data and more.
This attack allows an attacker to add, modify and delete data stored in the database.
2. To test if this web application is vulnerable to SQL injection or not we put a quote(’) at the end of URL
As error occurs here, this means this website is vulnerable to SQL injection attack.
3. To know how many columns are present in the table we use order by
We get to know various tables name but from these users table might be useful to us
7. To know the columns name we do the following
Remediation
1. Whitelisting is the best practice to validate input against blacklisting whenever it is practicable.
2. Do not create SQL queries with string concatenation. Instead use prepared statements or stored
procedures.
2.File Upload
File Inclusion vulnerability allows an attacker to include a file, usually exploiting a “dynamic file inclusion”
mechanism implemented in the target application. The vulnerability occurs due to the use of user-supplied input
without proper validation.
This can lead to something as outputting the contents of the file, but depending on the severity, it can also lead
to:
1.Code execution on the web server
2.Code execution on the client-side such as JavaScript which can lead to other attacks such as cross site
scripting (XSS)
3.Denial of Service (DoS)
4.Sensitive Information Disclosure
Local file inclusion (LFI) is the process of including files, that are already locally present on the server,
through the exploiting of vulnerable inclusion procedures implemented in the application. This vulnerability
occurs, for example, when a page receives, as input, the path to the file that has to be included and this input is
not properly sanitized, allowing directory traversal characters (such as dot-dot-slash) to be injected.
Directory:
/showimage.php?file=./pictures/7.jpg
url: http://testphp.vulnweb.com/showimage.php?file=./pictures/7.jpg
go to:
search in burpsuite to modify the request header i.e.
file=
The go to any link and then changes the file path to check whether it has file upload vulnerability or not
Send this request to the repeater to modify the request.
Response:
Hence this response shows warning i.e. unable to access that means it does not have file upload vulnerability.
Remediation
As the main cause is improper input validation, suggestions mainly revolve around sanitizing the input received.
1. Accept only characters and numbers for file names (A-Z 0-9). Blacklist all the special characters
which are not of any use in a filename.
2. Limit the API to allow inclusion of files only from one allowed directory so that directory traversal
can also be avoided.
Overview
Cross-Site Scripting (XSS) attacks are a type of injection, in which malicious scripts are injected into otherwise
benign and trusted websites. XSS attacks occur when an attacker uses a web application to send malicious code,
generally in the form of a browser side script, to a different end user. Flaws that allow these attacks to succeed
are quite widespread and occur anywhere a web application uses input from a user within the output it generates
without validating or encoding it.
An attacker can use XSS to send a malicious script to an unsuspecting user. The end user’s browser has no way
to know that the script should not be trusted, and will execute the script. Because it thinks the script came from a
trusted source, the malicious script can access any cookies, session tokens, or other sensitive information
retained by the browser and used with that site. These scripts can even rewrite the content of the HTML page.
2. To test if this web application is vulnerable to XSS or not we put a Script in search bar
(“<script>alert(“Hacked”)</script>”)
(http://test.vulnweb.com/)
3. And also put the script in Message
(http://test.vulnweb.com/guestbook.php)
4.This type of script is also work in comment bar
(http://test.vulnweb.com/comment.php?aid=1)
Remediations
Sanitizing. A third way to prevent cross-site scripting attacks is to sanitize user input. Sanitizing data is a strong
defense, but should not be used alone to battle XSS attacks. It’s totally possible you’ll find the need to use all
three methods of prevention in working towards a more secure application.
Url:
http://testphp.vulnweb.com/index.bak
</head>
<body>
<div id="mainLayer" style="position:absolute; width:700px; z-index:1">
<div id="masthead">
<h1 id="siteName">ACUNETIX ART</h1>
<h6 id="siteInfo">TEST and Demonstration site for Acunetix Web Vulnerability Scanner</h6>
<div id="globalNav">
<a href="index.php">home</a> | <a href="categories.php">categories</a> | <a href="artists.php">artists
</a> | <a href="disclaimer.php">disclaimer</a> | <a href="cart.php">your cart</a> |
<a href="guestbook.php">guestbook</a>
</div>
</div>
<!-- end masthead -->
<div id="navBar">
<div id="search">
<form action="search.php" method="post">
<label>search art</label>
<input name="searchFor" type="text" size="10">
<input name="goButton" type="submit" value="go">
</form>
</div>
<div id="sectionLinks">
<ul>
<li><a href="categories.php">Browse categories</a></li>
<li><a href="artists.php">Browse artists</a></li>
<li><a href="cart.php">Your cart</a></li>
<li><a href="login.php">Signup</a></li>
<li><a href="userinfo.php">Your profile</a></li>
<li><a href="guestbook.php">Our guestbook</a></li>
<?PHP if (isset($_COOKIE["login"]))echo '<li><a href="../logout.php">Logout</a>'; ?></li>
</ul>
</div>
<div class="relatedLinks">
<h3>Links</h3>
<ul>
<li><a href="http://www.acunetix.com">Security art</a></li>
<li><a href="http://www.eclectasy.com/Fractal-Explorer/index.html">Fractal Explorer</a></li>
</ul>
</div>
<div id="advert">
<p><img src="images/add.jpg" alt="" width="107" height="66"></p>
</div>
</div>
This code shows that this website uses php in database side .
2.
url:
http://testphp.vulnweb.com/pictures/wp-config.bak
gain
Remediation:
Review the cause of the code disclosure and prevent it from happening.