teanants rights when landlord is in foreclosure
If the bank purchases the property and you are a "bona fide" tenant, which means you lived there pre-foreclosure and are not related to the borrower, the bank cannot evict you without "just cause," which is typically non-payment of rent; creating a disturbance; or not allowing landlord/owner to make repairs. The bank has to notify you of the change of ownership and of your rights to a court hearing.
If a private entity purchases the property, the can evict you, even without just cause, but are required to give you ninety days notice and must go through the formal eviction process.
In either case, you have a right to a court hearing before being evicted.