Challenging the sale of property during bankruptcy
I have read that even many years after an auction and resale of property, a court can declare the sale and contracts invalid due to violations in the bankruptcy procedure. If I ever buy property from such an auction or after several resales, how can I be sure that I won't have to return it to the old owner later? What steps should I take to avoid losing the property in the future because the sale procedure was violated somewhere before me?