title: How the host's forward and backward DNS entries match in java application makes it secure from DNS spoofing
body: <p>I am using fortify and it is showing the vulnerability by which the attacker can do DNS spoofing while I am trying to get hostname in the java application. 
  I have got one solution that by matching forward DNS and Reverse DNS entries it can be avoided. But how it is useful and how can I implement it, I am not able to find it. 
  Fortify shows vulnerability at this line </p>
  
  <p><a href="https://i.stack.imgur.com/GHDyN.png" rel="nofollow noreferrer">Link for line</a></p>
  
  <p>Fortify is showing recommendations like this:</p>
  
  <blockquote>
    <p>Recommendations:</p>
    
    <p>You can increase confidence in a domain name lookup if you check to
    make sure that the host's forward and backward DNS entries match. 
    Attackers will not be able to spoof both the forward and the reverse
    DNS entries without controlling the nameservers for the target domain.
    This is not a foolproof approach however: attackers may be able to
    convince the domain registrar to turn over the domain to a malicious
    nameserver.  Basing authentication on DNS entries is simply a risky
    proposition.</p>
  </blockquote>
  
  <p>Any help is appreciated and another solutions are also welcome. </p>
  
  <p>Thanks in advance.</p>