Take the tour ×

Suppose if there is some code like

<a href="<%=request.getHeader("Host")%>/xxx/abc.do>SignIn</a>

Can an attacker fake request.getHeader("host") to point 'SignIn' anchor to attacker's URL e.g. attacker.com/xxx/abc.do? If yes, how? If no, why not?

share|improve this question
add comment

1 Answer

Not really.


However, for pen testing, I would recommend you look out for calls to request.getHeader() that make an access control decision based on on the result. For example, if the sensitive.company.com page checked that request.getHeader("referer") equaled internal.company.com before allowing the client, this would be exploitable because the client can place whatever it wants in that field.

EDIT: I would add the points made about DNS resolution and vhosts that are made in the answer to your other question Is Request.getHeader("host") vulnerable?. If the 'host' was attacker.com, the request would have gone to attacker.com in the first place.

share|improve this answer
add comment

Your Answer


