Hello! I'm a veterinary nurse with 10+ years in a small animal and exotic clinic. Chameleons can commonly get pinworms. I would take a stool sample to your exotic vet ASAP so they can confirm via cytology. If he is positive, the treatment is oral Fenbendazole. It needs to be properly dosed otherwise they can die from overdose if not dosed correctly.
As a preventative measure we ALWAYS recommend our reptiles have a fecal screen done at least every 6 months to ensure we are catching any parasites before they become a problem.
I hope this helped!