Once you’ve arrived at an agreement with the owner in default, the foreclosing lender and any other lien holders, you can put the agreement in writing. If you’re not familiar with how to draw up a purchase agreement, you should have a local real estate agent or real estate attorney help.
Any purchase agreement should make closing the deal contingent on a full title search conducted by a title company or attorney. The purchase agreement should also allow for a professional inspection of the property before closing the deal.
An escrow company, who acts as a third party, can manage the transfer of money and property ownership. Assuming that you have your financing secured, this should be a fairly smooth process.