I am undocumented, and have been in the United States for many years. There are many reasons I can't go back to my country.
People keep telling me to talk to an immigration attorney, but I am afraid to do that. How do I know the attorney is not connected to the U.S. government? What if the attorney just tells me I have no way to get papers to stay in the U.S., and then reports me for being illegal?
Immigration attorneys in the United States are independent of any government office or agency. They mostly work for themselves, in solo practices or as members of law firms.
All U.S. lawyers are bound by various ethical obligations. These include working in the best interests of the client and maintaining that person's information in the strictest confidence. A rule called "attorney-client privilege" says that attorneys may not divulge their clients’ secrets, and nor may others force them to do so.
That means an attorney you either consult with or hire to represent you cannot disclose information about you even when directly asked by immigration or other government authorities, much less take steps to actually report you.
There are a few exceptions. For example if you're planning a future crime, the attorney might need to tell someone. These aren't likely to apply to the situation you're describing, however.
It's true that there are attorneys who work for the U.S. government on immigration matters, but they never make themselves available for hire by the general public. They only work for the government; you won't find their names on any directories of lawyers seeking new clients, for example.
In seeking an attorney to consult with or provide immigration services, you will of course want to find someone you feel comfortable with and trust. Ask friends for recommendations, and understand the risks of hiring non-lawyers.
You might also be interested in learning more about what fees lawyers typically charge.