19.09.2017 Views

the-web-application-hackers-handbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 4 n Mapping <strong>the</strong> Application 107<br />

Identifying Server-Side Functionality<br />

It is often possible to infer a great deal about server-side functionality and structure,<br />

or at least make an educated guess, by observing clues that <strong>the</strong> <strong>application</strong><br />

discloses to <strong>the</strong> client.<br />

Dissecting Requests<br />

Consider <strong>the</strong> following URL, which is used to access a search function:<br />

https://wahh-app.com/calendar.jsp?name=new%20applicants&isExpired=<br />

0&startDate=22%2F09%2F2010&endDate=22%2F03%2F2011&OrderBy=name<br />

As you have seen, <strong>the</strong> .jsp file extension indicates that Java Server Pages are<br />

in use. You may guess that a search function will retrieve its information from<br />

ei<strong>the</strong>r an indexing system or a database. The presence of <strong>the</strong> OrderBy parameter<br />

suggests that a back-end database is being used and that <strong>the</strong> value you submit<br />

may be used as <strong>the</strong> ORDER BY clause of a SQL query. This parameter may well<br />

be vulnerable to SQL injection, as may any of <strong>the</strong> o<strong>the</strong>r parameters if <strong>the</strong>y are<br />

used in database queries (see Chapter 9).<br />

Also of interest among <strong>the</strong> o<strong>the</strong>r parameters is <strong>the</strong> isExpired field. This<br />

appears to be a Boolean flag specifying whe<strong>the</strong>r <strong>the</strong> search query should include<br />

expired content. If <strong>the</strong> <strong>application</strong> designers did not expect ordinary users to<br />

be able retrieve any expired content, changing this parameter from 0 to 1 could<br />

identify an access control vulnerability (see Chapter 8).<br />

The following URL, which allows users to access a content management<br />

system, contains a different set of clues:<br />

https://wahh-app.com/workbench.aspx?template=NewBranch.tpl&loc=<br />

/default&ver=2.31&edit=false<br />

Here, <strong>the</strong> .aspx file extension indicates that this is an ASP.NET <strong>application</strong>. It also<br />

appears highly likely that <strong>the</strong> template parameter is used to specify a filename,<br />

and <strong>the</strong> loc parameter is used to specify a directory. The possible file extension<br />

.tpl appears to confirm this, as does <strong>the</strong> location /default, which could very<br />

well be a directory name. It is possible that <strong>the</strong> <strong>application</strong> retrieves <strong>the</strong> template<br />

file specified and includes <strong>the</strong> contents in its response. These parameters may<br />

well be vulnerable to path traversal attacks, allowing arbitrary files to be read<br />

from <strong>the</strong> server (see Chapter 10).<br />

Also of interest is <strong>the</strong> edit parameter, which is set to false. It may be that<br />

changing this value to true will modify <strong>the</strong> registration functionality, potentially<br />

enabling an attacker to edit items that <strong>the</strong> <strong>application</strong> developer did not<br />

intend to be editable. The ver parameter does not have any readily guessable<br />

purpose, but it may be that modifying this will cause <strong>the</strong> <strong>application</strong> to perform<br />

a different set of functions that an attacker could exploit.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!