According to the NY Department of Financial Services "At the start of the foreclosure action, the bank must notify all tenants that the property is the subject of a foreclosure action. " If or when the property goes into foreclosure, NY law protects your rights - as long as you have a current lease agreement. In other words, if you want to stay, then make sure you have a signed lease agreement and continue to pay your rent. The department says, "Tenants residing in units that are not subject to rent control or rent stabilization may retain occupancy either until the end of their lease term or for 90 days after receipt of the notice from the new owner, whichever is greater."
So, do not worry. Once the foreclosure is final, you cannot be evicted unless you violate the lease agreement or it expires.... more