Ask a landlord-tenant lawyer and get answers ASAP
I am sorry to hear this.
In which State and town is the property located?
Do you have a lease or is this a month to month rental?
Was any reason stated in the eviction notice?
Did the landlord ever notify you that the property was in foreclosure?
I am sorry but the 5 day notice does appear to be legal, according to
The Protecting Tenants in Foreclosure Act has expired.
33-1331C states that the failure of the landlord to give you notice of the pending foreclosure gives you a claim against the landlord under 33-1361.
You could file a demurrer to the complaint that would slow this down a little but you need a local attorney to assist you with that. You can try to negotiate for more time with the new owner, or try to negotiate a new rental agreement with the new owner. The banks already have a large inventory of vacant foreclosed properties so there is a chance the bank would allow you to keep renting this one. It cannot hurt to ask.
You can get a free consultation from some of the local landlord tenant attorneys listed here.
Please follow up on this with a local attorney.
I hope this information is helpful.