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.

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

<strong>the</strong>y navigated <strong>the</strong> set of files created by <strong>the</strong> author, requesting each file via its<br />

name within <strong>the</strong> directory tree residing on <strong>the</strong> server.<br />

Although <strong>the</strong> evolution of <strong>web</strong> <strong>application</strong>s has fundamentally changed <strong>the</strong><br />

experience of interacting with <strong>the</strong> <strong>web</strong>, <strong>the</strong> picture just described is still applicable<br />

to <strong>the</strong> majority of <strong>web</strong> <strong>application</strong> content and functionality. Individual<br />

functions are typically accessed via a unique URL, which is usually <strong>the</strong> name<br />

of <strong>the</strong> server-side script that implements <strong>the</strong> function. The parameters to <strong>the</strong><br />

request (residing in ei<strong>the</strong>r <strong>the</strong> URL query string or <strong>the</strong> body of a POST request)<br />

do not tell <strong>the</strong> <strong>application</strong> what function to perform; <strong>the</strong>y tell it what information<br />

to use when performing it. In this context, <strong>the</strong> methodology of constructing a<br />

URL-based map can be effective in cataloging <strong>the</strong> <strong>application</strong>’s functionality.<br />

In <strong>application</strong>s that use REST-style URLs, parts of <strong>the</strong> URL file path contain<br />

strings that in fact function as parameter values. In this situation, by mapping<br />

URLs, a spider maps both <strong>the</strong> <strong>application</strong> functions and <strong>the</strong> list of known<br />

parameter values to those functions.<br />

In some <strong>application</strong>s, however, <strong>the</strong> picture based on <strong>application</strong> “pages”<br />

is inappropriate. Although it may be possible to shoehorn any <strong>application</strong>’s<br />

structure into this form of representation, in many cases a different picture,<br />

based on functional paths, is far more useful for cataloging its content and<br />

functionality. Consider an <strong>application</strong> that is accessed using only requests of<br />

<strong>the</strong> following form:<br />

POST /bank.jsp HTTP/1.1<br />

Host: wahh-bank.com<br />

Content-Length: 106<br />

servlet=TransferFunds&method=confirmTransfer&fromAccount=10372918&to<br />

Account=<br />

3910852&amount=291.23&Submit=Ok<br />

Here, every request is made to a single URL. The parameters to <strong>the</strong> request<br />

are used to tell <strong>the</strong> <strong>application</strong> what function to perform by naming <strong>the</strong> Java<br />

servlet and method to invoke. Fur<strong>the</strong>r parameters provide <strong>the</strong> information to<br />

use in performing <strong>the</strong> function. In <strong>the</strong> picture based on <strong>application</strong> pages, <strong>the</strong><br />

<strong>application</strong> appears to have only a single function, and a URL-based map does<br />

not elucidate its functionality. However, if we map <strong>the</strong> <strong>application</strong> in terms of<br />

functional paths, we can obtain a much more informative and useful catalog of<br />

its functionality. Figure 4-10 is a partial map of <strong>the</strong> functional paths that exist<br />

within <strong>the</strong> <strong>application</strong>.

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

Saved successfully!

Ooh no, something went wrong!