Security deposit should be in a escrow account, and should be refund to you, or possibly transfer to the new owner.
Your lease is a contract and the new owner will have to honor it. They probably will want you to stay, the foreclouse process doesn't effect you lease, the new owners this is...