jailhouse lawyer
noun
a prisoner who has taught himself or herself law while serving time, is knowledgeable about technical legal matters, and gives legal advice, especially to fellow prisoners.
Origin of jailhouse lawyer
1965–70;
Americanism