There are three credit reporting agencies: Equifax, Experion and TransUnion. Creditors report to these agencies when customers fall into slow pay, failure to pay and default categories. Law suits filed against you to collect debt and judgments awarded to plaintiffs and recorded at the county level are also included on these reports.
Once you have reached a financial status where you can satisfy all of you bills in a timely fashion on a monthly basis you are on your way to re-establishing good credit.
Now it is time to get copies of your credit report and examine each of the entries on ALL THREE. Look for debts listed that are not yours and debts that have been paid off. You need to challenge these debts with sufficient proof to convince the reporting agencies and/or creditors to removed them from the record.
During this challenge period you may see your credit scores fall but once items begin to be deleted from the reports your score should rise.
This is general information and not a legal opinion or advice. There are companies that are legal entities in business to help people improved their credit scores. Attorneys also can offer you advice on how to handle these issues. As you said it can take 2 to 3 years to restore a good credit rating and it can be a lot of work but it's worth the time and effort if you can do this.
Investigate your options. You should be able to discuss some of these with an attorney free of charge or for a minimal fee. Interview several and compare what they tell you. Take clean copies of your credit reports to the meetings and don't discuss other advice that has been given to you. Also, remember that these people are in business to make money. Do not let them pressure you into enrolling in any program you can't afford and be wary of anyone who advises a debt consolidation plan where you give money to them to pay bills.
This is all I can think of to tell you. I hope some of it helps.