I want to do a thesis paper involving illegal online resources. I don't want to be persecuted for these things though. What are some of the steps I would need to take to legitimately go about researching said illegal areas of the internet. Who would I need to contact to gain permission to legally research these sources without any legal ramifications?
You would start by seeking permission from your academic institution. If they approve it then they should employ their legal counsel to create a safe harbor for your work.
Typically the Attorney General in the relevant jurisdiction can grant this sort of permission.