There is no such thing as an illegal gun. There are however, illegal uses of a gun, just like any other tool which is used to hurt others.
There are unconstitutional laws that make some guns illegally illegal. 2Amd has absolute wording. The only possible limit is the involuntary servitude wording in Section 1 of the thirteenth Amendment which could take away the right to possess firearms while incarcerated legally.