I am sorry but tend to look at this the other way. You may not get your deposit back but I would call it far from being in a bind.
When we purchased homes at trustee sales we HATED IT when they were tenant occupied. The fact of the matter is that there are UBER protections for tenants who occupy foreclosed homes. First and foremost, you cannot be evicted as long as you continue to honor the lease. This is an assumption that the lease is bona fide and was an arms length transaction AND is charging market rent. It must be honored by the new owner to FULL TERM.
In all probability if the home IS foreclosed on you can negotiate a sweet offer with the new owner for a buyout. As someone who used to negotiate these with the tenants we just wanted them out asap so we gave them a great deal covering their deposit and moving costs.
So if I were you I would be rather optimistic. Check with any attorney you want. As long as that lease is valid, you are in the catbirds seat.