There are a number of bases on which criminal laws can be challenged. It all depends upon what kind of conduct the law prohibits.
For example, laws prohibiting flag desecration are criminal laws. They have been appealed on First Amendment, free speech grounds. Laws that ban various kinds of hate speech can be appealed on the same grounds.
A criminal law can also be challenged on privacy grounds. For example, the laws that made it a crime to distribute birth control were struck down on this basis.
It would also be possible to challenge a criminal law based on the punishment it prescribes. Such a challenge would come under the 8th Amendment.
So the grounds on which one can challenge a criminal law depend largely on what kind of action the law criminalizes.