19.09.2017 Views

the-web-application-hackers-handbook

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 19 n Finding Vulnerabilities in Source Code 711<br />

char buf[200]; // I hope this is big enough<br />

...<br />

strcpy(buf, userinput);<br />

Searching a large codebase for comments indicating common problems is<br />

frequently an effective source of low-hanging fruit. Here are some search terms<br />

that have proven useful:<br />

n bug<br />

n problem<br />

n bad<br />

n hope<br />

n todo<br />

n fix<br />

n overflow<br />

n crash<br />

n inject<br />

n xss<br />

n trust<br />

The Java Platform<br />

This section describes ways to acquire user-supplied input, ways to interact with<br />

<strong>the</strong> user’s session, potentially dangerous APIs, and security-relevant configuration<br />

options on <strong>the</strong> Java platform.<br />

Identifying User-Supplied Data<br />

Java <strong>application</strong>s acquire user-submitted input via <strong>the</strong> javax.servlet.http.<br />

HttpServletRequest interface, which extends <strong>the</strong> javax.servlet.ServletRequest<br />

interface. These two interfaces contain numerous APIs that <strong>web</strong> <strong>application</strong>s<br />

can use to access user-supplied data. The APIs listed in Table 19-1 can be used<br />

to obtain data from <strong>the</strong> user request.

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

Saved successfully!

Ooh no, something went wrong!