First of all, I'm sorry to hear about your circumstances. Just know that you are not alone. Numerous people are finding themselves in the same situation.
I would need a little more info to answer your question correctly. Are you the previous owner of the home that was foreclosed upon or are you renters living in the home?
If you are renters, than the bank's Realtor will make contact with you to most likely negotiate a Cash-for-Keys where the bank will pay you to help with moving arrangements. The bank will not communicate with the previous owners since you are living in the home and have possession. When the Realtor makes contact, advise them you are interested in purchasing the property. They'll be able to advise you if the bank will entertain an offer from you and will assist you in getting prequalified for a purchase loan.
If you're the previous owner, than your options are more limited. The bank won't accept an offer from you. Once the home is foreclosed upon, you also have the option of the Cash-for-Keys if the bank is offering it and if you have possession. You would typically have to move out 30-45 days in order to receive the check. Then I would start down the road of credit repair in order to be ready for homeownership again in just a few short years. The market will still most likely be down and hopefully interest rates will still be low.
Another question I have is, what makes you believe it was an unlawful foreclosure? Was there fraud involved with your original loan and/or the foreclosure? Was your modification permanent and finalized, were you in a trial modification, or were you in the process of negotiating a modification? I've worked closely with hundreds of foreclosures & evictions and I rarely come across unlawful foreclosures. Even when I have, it's typically a paperwork issue that delays only the eviction until the bank corrects the issue. If you believe the foreclosure was unlawful, then you may have a good case to present to a Real Estate attorney. I would contact one right away.
I wish you the best and please don't hesitate to contact me if you have any further questions or would like to discuss in more detail.
Realtor/Certified Pre-foreclosure Specialist
Keller Williams Realty